File tree Expand file tree Collapse file tree 2 files changed +66
-0
lines changed
Aspid.UnityFastTools/Assets/Plugins/Aspid/UnityFastTools/Documentation Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Original file line number Diff line number Diff line change 1+ # Unity Fast Tools
2+ ** Unity Fast Tools** is a set of tools designed to minimize routine code writing in Unity.
3+ ## Source Code
4+ ### [[ Aspid.UnityFastTools] ( https://github.com/VPDPersonal/Aspid.UnityFastTools )] [[ Aspid.UnityFastTools.Generators] ( https://github.com/VPDPersonal/Aspid.UnityFastTools.Generators )]
5+ ---
6+ ## ** Examples**
7+ ``` csharp
8+ using UnityEngine ;
9+ using Aspid .UnityFastTools ;
10+
11+ public class MyBehaviour : MonoBehaviour
12+ {
13+ private void Update ()
14+ {
15+ DoSomething1 ();
16+ DoSomething2 ();
17+ }
18+
19+ private void DoSomething1 ()
20+ {
21+ using var _ = this .Marker ();
22+ // Some code
23+ }
24+
25+ private void DoSomething2 ()
26+ {
27+ using (this .Marker ())
28+ {
29+ // Some code
30+ using var _ = this .Marker ().WithName (" Calculate" );
31+ // Some code
32+ }
33+ }
34+ }
35+ ```
36+ ### Generated code
37+ ``` csharp
38+ using System ;
39+ using Unity .Profiling ;
40+ using System .Runtime .CompilerServices ;
41+
42+ internal static class __MyBehaviourProfilerMarkerExtensions
43+ {
44+ private static readonly ProfilerMarker DoSomething1_line_13 = new (" MyBehaviour.DoSomething1 (13)" );
45+ private static readonly ProfilerMarker DoSomething2_line_19 = new (" MyBehaviour.DoSomething2 (19)" );
46+ private static readonly ProfilerMarker DoSomething2_line_22 = new (" MyBehaviour.Calculate (22)" );
47+
48+ public static ProfilerMarker.AutoScope Marker (this MyBehaviour _ , [CallerLineNumberAttribute ] int line = - 1 )
49+ {
50+ if (line is 13 ) return DoSomething1_line_13 .Auto ();
51+ if (line is 19 ) return DoSomething2_line_19 .Auto ();
52+ if (line is 22 ) return DoSomething2_line_22 .Auto ();
53+
54+ throw new Exception ();
55+ }
56+ }
57+ ```
58+
59+ ![ Aspid.UnityFastTools.MarkerTest.png] ( Images/Aspid.UnityFastTools.MarkerTest.png )
You can’t perform that action at this time.
0 commit comments