From 4f5368a3bb1b57b35bfa5f15f40893ca70ab0821 Mon Sep 17 00:00:00 2001 From: Kaynn Cahya Date: Tue, 12 Feb 2019 00:33:56 +0800 Subject: [PATCH] Added Tag Attribute Drawer Added TagAttribute Basically a drop-down that shows all the tag. --- Attributes/Editor/TagAttributeDrawer.cs | 11 +++++++++++ Attributes/Editor/TagAttributeDrawer.cs.meta | 11 +++++++++++ Attributes/TagAttribute.cs | 5 +++++ Attributes/TagAttribute.cs.meta | 11 +++++++++++ 4 files changed, 38 insertions(+) create mode 100644 Attributes/Editor/TagAttributeDrawer.cs create mode 100644 Attributes/Editor/TagAttributeDrawer.cs.meta create mode 100644 Attributes/TagAttribute.cs create mode 100644 Attributes/TagAttribute.cs.meta diff --git a/Attributes/Editor/TagAttributeDrawer.cs b/Attributes/Editor/TagAttributeDrawer.cs new file mode 100644 index 0000000..a9442dd --- /dev/null +++ b/Attributes/Editor/TagAttributeDrawer.cs @@ -0,0 +1,11 @@ +using UnityEditor; +using UnityEngine; + +[CustomPropertyDrawer(typeof(TagAttribute))] +public class TagAttributeDrawer : PropertyDrawer +{ + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + property.stringValue = EditorGUI.TagField(position, label, property.stringValue); + } +} diff --git a/Attributes/Editor/TagAttributeDrawer.cs.meta b/Attributes/Editor/TagAttributeDrawer.cs.meta new file mode 100644 index 0000000..38e9d49 --- /dev/null +++ b/Attributes/Editor/TagAttributeDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6d25f5c39af05cc43a64259e458254d3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Attributes/TagAttribute.cs b/Attributes/TagAttribute.cs new file mode 100644 index 0000000..0d09b1c --- /dev/null +++ b/Attributes/TagAttribute.cs @@ -0,0 +1,5 @@ +using UnityEngine; + +public class TagAttribute : PropertyAttribute +{ +} diff --git a/Attributes/TagAttribute.cs.meta b/Attributes/TagAttribute.cs.meta new file mode 100644 index 0000000..0395f9d --- /dev/null +++ b/Attributes/TagAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4112d636c944a774aae43810656bde88 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: