@ -1,5 +1,5 @@ | |||||
fileFormatVersion: 2 | fileFormatVersion: 2 | ||||
guid: d2ef7c61cf0a63a439bf63d461541ce3 | |||||
guid: 7a8bfbd0555f21048abd1415f2c47893 | |||||
folderAsset: yes | folderAsset: yes | ||||
DefaultImporter: | DefaultImporter: | ||||
externalObjects: {} | externalObjects: {} |
@ -1,5 +1,5 @@ | |||||
fileFormatVersion: 2 | fileFormatVersion: 2 | ||||
guid: 1eba5231ebd032b4db5d58d699e0f0de | |||||
guid: 040e0c0ec80bb52409744b03671df838 | |||||
folderAsset: yes | folderAsset: yes | ||||
DefaultImporter: | DefaultImporter: | ||||
externalObjects: {} | externalObjects: {} |
@ -0,0 +1,8 @@ | |||||
fileFormatVersion: 2 | |||||
guid: f134e8ccabae44c45b14bad67978a30b | |||||
folderAsset: yes | |||||
DefaultImporter: | |||||
externalObjects: {} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -0,0 +1,8 @@ | |||||
fileFormatVersion: 2 | |||||
guid: affc4046c2a5111479cf285e82bedb4f | |||||
folderAsset: yes | |||||
DefaultImporter: | |||||
externalObjects: {} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -0,0 +1,22 @@ | |||||
using System.Collections; | |||||
using System.Collections.Generic; | |||||
using UnityEngine; | |||||
/// <summary> | |||||
/// Example of a script using [HideInPrfab] | |||||
/// </summary> | |||||
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 | |||||
} |
@ -0,0 +1,11 @@ | |||||
fileFormatVersion: 2 | |||||
guid: b3a8b00c985891a448737258d9b09ede | |||||
MonoImporter: | |||||
externalObjects: {} | |||||
serializedVersion: 2 | |||||
defaultReferences: [] | |||||
executionOrder: 0 | |||||
icon: {instanceID: 0} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -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} |
@ -0,0 +1,8 @@ | |||||
fileFormatVersion: 2 | |||||
guid: 3e4c28a2ff8a30f4da1d96c254a14fc5 | |||||
NativeFormatImporter: | |||||
externalObjects: {} | |||||
mainObjectFileID: 100100000 | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -0,0 +1,8 @@ | |||||
fileFormatVersion: 2 | |||||
guid: 5629afcda35004c4d99c76bde4f4eeb7 | |||||
folderAsset: yes | |||||
DefaultImporter: | |||||
externalObjects: {} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -0,0 +1,53 @@ | |||||
using UnityEngine; | |||||
#if UNITY_EDITOR | |||||
using UnityEditor; | |||||
#endif | |||||
/// <summary> | |||||
/// Class for the Hide in Prefab Attribute | |||||
/// </summary> | |||||
/// <remarks> | |||||
/// Class is empty because we have no parameters needed for this attribute | |||||
/// </remarks> | |||||
public class HideInPrefabAttribute : PropertyAttribute | |||||
{ | |||||
} | |||||
#if UNITY_EDITOR | |||||
/// <summary> | |||||
/// Override for the Property Drawer which draws the GUI | |||||
/// </summary> | |||||
[CustomPropertyDrawer(typeof(HideInPrefabAttribute))] | |||||
public class HideInPrefabDrawer : PropertyDrawer | |||||
{ | |||||
//On GUI override | |||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) | |||||
{ | |||||
//get the type of the object this property is attched to | |||||
PrefabType type = PrefabUtility.GetPrefabType(property.serializedObject.targetObject); | |||||
//if the type isn't a perfab then draw the property | |||||
if (type != PrefabType.Prefab) | |||||
EditorGUI.PropertyField(position, property, label); | |||||
} | |||||
//Override GetPropertyHeight | |||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) | |||||
{ | |||||
//get the type of the object this property is attched to | |||||
PrefabType type = PrefabUtility.GetPrefabType(property.serializedObject.targetObject); | |||||
//if type prefab return zero height (because it won't be drawn) | |||||
if (type == PrefabType.Prefab) | |||||
return 0; | |||||
//else return normal height | |||||
return base.GetPropertyHeight(property, label); | |||||
} | |||||
} | |||||
#endif |
@ -0,0 +1,11 @@ | |||||
fileFormatVersion: 2 | |||||
guid: 7ffee7f5af11da344ae52c6c92cce67c | |||||
MonoImporter: | |||||
externalObjects: {} | |||||
serializedVersion: 2 | |||||
defaultReferences: [] | |||||
executionOrder: 0 | |||||
icon: {instanceID: 0} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |