-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from DerpyNewbie/feature/newbie-inject-propert…
…y-drawer Add property drawer for NewbieInjected fields
- Loading branch information
Showing
3 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
Packages/dev.derpynewbie.common/Editor/NewbieInjectPropertyDrawer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace DerpyNewbie.Common.Editor | ||
{ | ||
[CustomPropertyDrawer(typeof(NewbieInject))] | ||
public class NewbieInjectPropertyDrawer : PropertyDrawer | ||
{ | ||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) | ||
{ | ||
var newbieInject = (NewbieInject)attribute; | ||
|
||
using (new EditorGUI.DisabledScope(true)) | ||
{ | ||
label.text = $"{label.text} (NewbieInjected-{newbieInject.Scope})"; | ||
EditorGUI.PropertyField(position, property, label); | ||
} | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Packages/dev.derpynewbie.common/Editor/NewbieInjectPropertyDrawer.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters