diff --git a/Assets/Editor/Editor AddOn.meta b/Assets/Editor Add On.meta similarity index 77% rename from Assets/Editor/Editor AddOn.meta rename to Assets/Editor Add On.meta index c80949d..03841ef 100644 --- a/Assets/Editor/Editor AddOn.meta +++ b/Assets/Editor Add On.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1eba5231ebd032b4db5d58d699e0f0de +guid: 7a8bfbd0555f21048abd1415f2c47893 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Editor Add On/Custom Attributes.meta b/Assets/Editor Add On/Custom Attributes.meta new file mode 100644 index 0000000..6b84961 --- /dev/null +++ b/Assets/Editor Add On/Custom Attributes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 040e0c0ec80bb52409744b03671df838 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Add On/Custom Attributes/Hide in Prefab.meta b/Assets/Editor Add On/Custom Attributes/Hide in Prefab.meta new file mode 100644 index 0000000..1356328 --- /dev/null +++ b/Assets/Editor Add On/Custom Attributes/Hide in Prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f134e8ccabae44c45b14bad67978a30b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Examples.meta b/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Examples.meta new file mode 100644 index 0000000..c3283e5 --- /dev/null +++ b/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Examples.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: affc4046c2a5111479cf285e82bedb4f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Examples/HideInPrefabExample.cs b/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Examples/HideInPrefabExample.cs new file mode 100644 index 0000000..7cb6a64 --- /dev/null +++ b/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Examples/HideInPrefabExample.cs @@ -0,0 +1,19 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class HideInPrefabExample : MonoBehaviour { + + [Header ("Drag Me into scene to show hidden properties.")] + + + [HideInPrefab] + public float HiddenFloat = 5; //Hidden in prefab inspector + public float ShownFloat = 6; //Not hidden in prefab inspector + [HideInInspector] + public float AlwaysHiddenFloat = 7; //Always hidden (Unity's default implementation) + + [HideInPrefab] + public GameObject HiddenGameObject; //Hidden in Prefab inspector + public GameObject ShownGameObject; //NotHidden in Prefab inspector +} diff --git a/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Examples/HideInPrefabExample.cs.meta b/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Examples/HideInPrefabExample.cs.meta new file mode 100644 index 0000000..cffa6cf --- /dev/null +++ b/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Examples/HideInPrefabExample.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b3a8b00c985891a448737258d9b09ede +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Examples/HideInPrefabExample.prefab b/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Examples/HideInPrefabExample.prefab new file mode 100644 index 0000000..a84f9e0 --- /dev/null +++ b/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Examples/HideInPrefabExample.prefab @@ -0,0 +1,58 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 1839211675386134} + m_IsPrefabParent: 1 +--- !u!1 &1839211675386134 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4904693562653106} + - component: {fileID: 114800799608557334} + m_Layer: 0 + m_Name: HideInPrefabExample + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4904693562653106 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1839211675386134} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &114800799608557334 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1839211675386134} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b3a8b00c985891a448737258d9b09ede, type: 3} + m_Name: + m_EditorClassIdentifier: + HiddenFloat: 5 + ShownFloat: 6 + AlwaysHiddenFloat: 7 + HiddenGameObject: {fileID: 0} + ShownGameObject: {fileID: 0} diff --git a/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Examples/HideInPrefabExample.prefab.meta b/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Examples/HideInPrefabExample.prefab.meta new file mode 100644 index 0000000..5b6c5df --- /dev/null +++ b/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Examples/HideInPrefabExample.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3e4c28a2ff8a30f4da1d96c254a14fc5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Scripts.meta b/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Scripts.meta new file mode 100644 index 0000000..2cbbcb7 --- /dev/null +++ b/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5629afcda35004c4d99c76bde4f4eeb7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Scripts/HideInPrefabAttribute.cs b/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Scripts/HideInPrefabAttribute.cs new file mode 100644 index 0000000..17ee791 --- /dev/null +++ b/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Scripts/HideInPrefabAttribute.cs @@ -0,0 +1,32 @@ +using UnityEngine; + +#if UNITY_EDITOR +using UnityEditor; +#endif + +public class HideInPrefabAttribute : PropertyAttribute +{ + +} + +[CustomPropertyDrawer(typeof(HideInPrefabAttribute))] +public class HideInPrefabDrawer : PropertyDrawer +{ + + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + PrefabType type = PrefabUtility.GetPrefabType(property.serializedObject.targetObject); + + if (type != PrefabType.Prefab) + EditorGUI.PropertyField(position, property, label); + } + + public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + PrefabType type = PrefabUtility.GetPrefabType(property.serializedObject.targetObject); + if (type == PrefabType.Prefab) + return 0; + + return base.GetPropertyHeight(property, label); + } +} diff --git a/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Scripts/HideInPrefabAttribute.cs.meta b/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Scripts/HideInPrefabAttribute.cs.meta new file mode 100644 index 0000000..29b0fd7 --- /dev/null +++ b/Assets/Editor Add On/Custom Attributes/Hide in Prefab/Scripts/HideInPrefabAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7ffee7f5af11da344ae52c6c92cce67c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: