|
1 |
| -# Unity Forge Property Drawers [](http://mit-license.org) |
| 1 | +[](https://github.com/rfadeev/unity-forge-property-drawers/blob/master/LICENSE.md) |
| 2 | +# Unity Forge Property Drawers |
2 | 3 | Custom propery drawers to ease fields value management in Unity editor.
|
3 | 4 |
|
4 | 5 | ## Attributes list
|
5 | 6 | * [AnimationName](#animationname)
|
6 | 7 | * [AnimatorLayerName](#animatorlayername)
|
7 | 8 | * [AnimatorParameterName](#animatorparametername)
|
8 | 9 | * [AnimatorStateName](#animatorstatename)
|
| 10 | +* [AssetPath](#assetpath) |
9 | 11 | * [GameObjectLayer](#gameobjectlayer)
|
10 | 12 | * [GameObjectTag](#gameobjecttag)
|
11 | 13 | * [ScenePath](#scenepath)
|
@@ -100,6 +102,22 @@ private string exampleStateName;
|
100 | 102 | ### Caveats
|
101 | 103 | Since layer index is [decoupled](https://docs.unity3d.com/ScriptReference/Animator.Play.html) from animator state name in Unity API, state name alone does not determine state and state index value should be managed separately. If only one animation layer is used, it's not the problem and `Play(string stateName)` overload can be used safely for fields using `AnimatorStateName` attribute.
|
102 | 104 |
|
| 105 | +## AssetPath |
| 106 | + |
| 107 | + |
| 108 | +### Attribute usage |
| 109 | +Add attribute to string field to enable show object field instead of text input for object path. Object selection updates serialized value of the string field. Attribute declataion requires object type. Attribute supports both full project path (like "Assets/Sprites/MySpriteA.png") and resources path type (like "Sprites/MySpriteB" for full path value "Assets/Resources/Sprites/MySpriteB.png"). Additionnal option allows to preview path value which is serialized. |
| 110 | +```csharp |
| 111 | +[SerializeField, AssetPath(typeof(Sprite), false)] |
| 112 | +private string spriteProjectPath01; |
| 113 | +[SerializeField, AssetPath(typeof(Sprite), true)] |
| 114 | +private string spriteResourcesPath01; |
| 115 | +[SerializeField, AssetPath(typeof(Sprite), false, true)] |
| 116 | +private string spriteProjectPath02; |
| 117 | +[SerializeField, AssetPath(typeof(Sprite), true, true)] |
| 118 | +private string spriteResourcesPath02; |
| 119 | +``` |
| 120 | + |
103 | 121 | ## GameObjectLayer
|
104 | 122 | 
|
105 | 123 |
|
|
0 commit comments