Skip to content

Commit a34281d

Browse files
authored
Merge pull request #5 from VPDPersonal/Feature/Add-Editor-Extensions
Add editor extensions
2 parents f86d57c + dbc7ede commit a34281d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1967
-3
lines changed
35.6 KB
Loading

Aspid.UnityFastTools/Assets/Plugins/Aspid/UnityFastTools/Documentation/Images/Aspid.UnityFastTools.VisualElement.png.meta

Lines changed: 143 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Aspid.UnityFastTools/Assets/Plugins/Aspid/UnityFastTools/Documentation/README.md

Lines changed: 94 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
# Unity Fast Tools
2-
**Unity Fast Tools** is a set of tools designed to minimize routine code writing in Unity.
2+
**Unity Fast Tools** is a set of tools designed to minimize routine code writing in Unity.
33
## Source Code
44
### [[Aspid.UnityFastTools](https://github.com/VPDPersonal/Aspid.UnityFastTools)] [[Aspid.UnityFastTools.Generators](https://github.com/VPDPersonal/Aspid.UnityFastTools.Generators)]
5+
6+
---
7+
8+
## Integration
9+
You can install Aspid.UnitiFastTools using one of the following methods:
10+
* **Download .unitypackage**: Visit the [Release page on GitHub](https://github.com/VPDPersonal/Aspid.UnityFastTools/releases) and download the latest version, `Aspid.UnityFastTools.X.X.X.unitypackage`. Import it into your project.
11+
512
---
6-
## **Examples**
13+
14+
## ProfilerMarker
715
``` csharp
816
using UnityEngine;
917
using Aspid.UnityFastTools;
@@ -56,4 +64,88 @@ internal static class __MyBehaviourProfilerMarkerExtensions
5664
}
5765
```
5866

67+
### Result
68+
5969
![Aspid.UnityFastTools.MarkerTest.png](Images/Aspid.UnityFastTools.MarkerTest.png)
70+
71+
## IMGUI Extensions
72+
``` csharp
73+
usign UnityEditor;
74+
using Aspid.UnityFastTools.Editors;
75+
76+
[CustomEditor(typeof(MyBegaviour))]
77+
public class MyEditor : Editor
78+
{
79+
public void override OnInspectorGUI()
80+
{
81+
// Or using (VerticalScope.Begin());
82+
using (AspidEdtiroGUILayout.BeginVertical())
83+
{
84+
85+
}
86+
87+
// Or using (HorizontalScope.Begin());
88+
using (AspidEdtiroGUILayout.BegingHorizontal())
89+
{
90+
91+
}
92+
93+
var position = Vector2.zero;
94+
// Or using (ScrollViewScope.Begin(ref position));
95+
using (AspidEdtiroGUILayout.BeginScrollView(ref position))
96+
{
97+
98+
}
99+
}
100+
}
101+
```
102+
103+
## VisualElement Extensions
104+
``` csharp
105+
using UnityEditor;
106+
using UnityEngine;
107+
using UnityEngine.UIElements;
108+
using Aspid.UnityFastTools.Editors;
109+
110+
[CustomEditor(typeof(VisualElementInspector))]
111+
public class VisualElementInspectorEditor : Editor
112+
{
113+
public override VisualElement CreateInspectorGUI()
114+
{
115+
const string iconPath = "Editor/VisualElementIcon";
116+
117+
var scriptName = target.GetScriptName();
118+
var darkColor = new Color(0.15f, 0.15f, 0.15f);
119+
var lightColor = new Color(0.75f, 0.75f, 0.75f);
120+
121+
return new VisualElement()
122+
.SetName("Header")
123+
.SetBackgroundColor(darkColor)
124+
.SetFlexDirection(FlexDirection.Row)
125+
.SetPadding(top : 5, bottom : 5, left: 10, right: 10)
126+
.SetBorderRadius(topLeft: 10, topRight:10, bottomLeft:10, bottomRight:10)
127+
.AddChild(new Image()
128+
.SetName("HeaderIcon")
129+
.SetImageFromResource(iconPath)
130+
.SetSize(width: 40, height: 40))
131+
.AddChild(new Label(scriptName)
132+
.SetName("HeaderText")
133+
.SetFlexGrow(1)
134+
.SetFontSize(16)
135+
.SetFlexShrink(1)
136+
.SetMargin(left: 10)
137+
.SetColor(lightColor)
138+
.SetAlignSelf(Align.Center)
139+
.SetOverflow(Overflow.Hidden)
140+
.SetWhiteSpace(WhiteSpace.NoWrap)
141+
.SetTextOverflow(TextOverflow.Ellipsis)
142+
.SetUnityFontStyleAndWeight(FontStyle.Bold)
143+
);
144+
}
145+
}
146+
```
147+
148+
### Result
149+
150+
![Aspid.UnityFastTools.VisualElement.png](Images/Aspid.UnityFastTools.VisualElement.png)
151+

Aspid.UnityFastTools/Assets/Plugins/Aspid/UnityFastTools/Samples/VisualElements.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Aspid.UnityFastTools/Assets/Plugins/Aspid/UnityFastTools/Samples/VisualElements/Resources.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Aspid.UnityFastTools/Assets/Plugins/Aspid/UnityFastTools/Samples/VisualElements/Resources/Editor.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
253 KB
Loading

0 commit comments

Comments
 (0)