Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ollyisonit/unityeditorattributes
A collection of dynamic property drawer attributes for use in the Unity Editor.
https://github.com/ollyisonit/unityeditorattributes
unity unity-editor unity-scripts
Last synced: about 2 months ago
JSON representation
A collection of dynamic property drawer attributes for use in the Unity Editor.
- Host: GitHub
- URL: https://github.com/ollyisonit/unityeditorattributes
- Owner: ollyisonit
- License: gpl-3.0
- Created: 2020-07-07T01:21:10.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-02T06:19:21.000Z (9 months ago)
- Last Synced: 2024-04-02T14:28:34.337Z (9 months ago)
- Topics: unity, unity-editor, unity-scripts
- Language: C#
- Homepage:
- Size: 1.4 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Unity Editor Attributes
A collection of dynamic property drawer attributes for use in the Unity Editor.
## Features### ReadOnly Attribute
Attribute that allows a field to be displayed in-editor but not edited.![](readme-assets/read-only-example.PNG)
``` C#
[ReadOnly]
public string readOnly = "You can't edit this!";
```### Rename Attribute
Changes the display name of the field in-editor.![](readme-assets/display-name-example.png)
``` C#
[Rename("Display Name!")]
public int hiddenName = 0;
```### ConditionalHide Attribute
Dynamically hides and shows fields in-editor based on the state of the object.Here's a simple example where two fields are hidden/shown based on the state of a tickbox:
![](readme-assets/ConditionalHideDemo1.gif)
``` C#
public bool toggle = true;[ConditionalHide("toggle", true)]
public string toggleOn = "Toggle is on!";[ConditionalHide("toggle", false)]
public string toggleOff = "Toggle is off!";
```And a more complex example with multiple tickboxes are taken into account:
![](readme-assets/ConditionalHideDemo2.gif)
``` C#
public bool toggle2 = true;
public bool toggle3 = true;[ConditionalHide(new string[] { "toggle2", "toggle3" }, new object[] { true, true },
ConditionalHideAttribute.FoldBehavior.Or)]
public string OneActive = "One toggle active!";[ConditionalHide(new string[] { "toggle2", "toggle3" }, new object[] { true, true },
ConditionalHideAttribute.FoldBehavior.And)]
public string BothActive = "Both toggles active!";
```### PropertyDrawerFinder
A utility class that can retrieve property drawers for types and fields. Useful for developing your own complex property drawers.## Installation
[Download](https://github.com/ollyisonit/UnityEditorAttributes/releases/latest) or clone this repository and put it in the Assets folder of your Unity project.