diff --git a/Assets/NaughtyAttributes/Samples/DemoScene/DemoScene.unity b/Assets/NaughtyAttributes/Samples/DemoScene/DemoScene.unity index 3c134139..d90fd912 100644 --- a/Assets/NaughtyAttributes/Samples/DemoScene/DemoScene.unity +++ b/Assets/NaughtyAttributes/Samples/DemoScene/DemoScene.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.44657874, g: 0.49641258, b: 0.5748172, a: 1} + m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -98,8 +98,7 @@ LightmapSettings: m_TrainingDataDestination: TrainingData m_LightProbeSampleCountMultiplier: 4 m_LightingDataAsset: {fileID: 0} - m_LightingSettings: {fileID: 4890085278179872738, guid: 98ee975b74776234986f4d35f14c4ccc, - type: 2} + m_LightingSettings: {fileID: 4890085278179872738, guid: 98ee975b74776234986f4d35f14c4ccc, type: 2} --- !u!196 &4 NavMeshSettings: serializedVersion: 2 @@ -150,6 +149,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 0 @@ -182,9 +182,10 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} - m_RootOrder: 24 + m_RootOrder: 25 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &114650325 MonoBehaviour: @@ -295,6 +296,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 9 @@ -343,9 +345,10 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} - m_RootOrder: 28 + m_RootOrder: 29 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &237121642 MonoBehaviour: @@ -391,9 +394,10 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} - m_RootOrder: 31 + m_RootOrder: 32 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &369789278 MonoBehaviour: @@ -439,9 +443,10 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} - m_RootOrder: 23 + m_RootOrder: 24 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &572382751 MonoBehaviour: @@ -492,6 +497,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 11 @@ -540,6 +546,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 2 @@ -582,9 +589,10 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} - m_RootOrder: 21 + m_RootOrder: 22 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &779670086 GameObject: @@ -613,6 +621,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 4 @@ -634,6 +643,57 @@ MonoBehaviour: stringValue: A nest2: vectorValue: {x: 1, y: 0, z: 0} +--- !u!1 &855157609 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 855157610} + - component: {fileID: 855157611} + m_Layer: 0 + m_Name: Type + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &855157610 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 855157609} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 21 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &855157611 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 855157609} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90bebd76d1525c04686583e7f6475250, type: 3} + m_Name: + m_EditorClassIdentifier: + WaitForGenerate: + - NaughtyAttributes.TypeTest+A + - NaughtyAttributes.TypeTest+B + - NaughtyAttributes.TypeTest+A+B + - NaughtyAttributes.TypeTest+C + - C + type: 0 --- !u!1 &892661554 GameObject: m_ObjectHideFlags: 0 @@ -661,6 +721,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 15 @@ -709,6 +770,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 16 @@ -732,8 +794,7 @@ MonoBehaviour: prefab1: {fileID: 1981131855061102, guid: 7ec354ef3daae7641b7a3fa5e1fe0c81, type: 3} nest2: sprite2: {fileID: 21300000, guid: 005888ede18a58e4db8d069cfa3007cb, type: 3} - prefab2: {fileID: 1981131855061102, guid: 7ec354ef3daae7641b7a3fa5e1fe0c81, - type: 3} + prefab2: {fileID: 1981131855061102, guid: 7ec354ef3daae7641b7a3fa5e1fe0c81, type: 3} --- !u!1 &948946033 GameObject: m_ObjectHideFlags: 0 @@ -761,6 +822,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 12 @@ -811,6 +873,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 10 @@ -862,6 +925,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 7 @@ -909,6 +973,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: - {fileID: 106181863} - {fileID: 1178133860} @@ -931,6 +996,7 @@ Transform: - {fileID: 1194502638} - {fileID: 1609261820} - {fileID: 1380469385} + - {fileID: 855157610} - {fileID: 732714204} - {fileID: 1784643785} - {fileID: 572382749} @@ -974,6 +1040,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 1 @@ -1003,7 +1070,7 @@ MonoBehaviour: name1: Trigger0 --- !u!95 &1178133862 Animator: - serializedVersion: 3 + serializedVersion: 4 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} @@ -1016,6 +1083,7 @@ Animator: m_UpdateMode: 0 m_ApplyRootMotion: 0 m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 m_WarningMessage: m_HasTransformHierarchy: 1 m_AllowConstantClipSamplingOptimization: 1 @@ -1047,6 +1115,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 18 @@ -1090,6 +1159,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 14 @@ -1162,9 +1232,10 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} - m_RootOrder: 26 + m_RootOrder: 27 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1293624597 MonoBehaviour: @@ -1210,6 +1281,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 20 @@ -1320,6 +1392,7 @@ Transform: m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} m_LocalPosition: {x: 0, y: 3, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 1 @@ -1351,9 +1424,10 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} - m_RootOrder: 32 + m_RootOrder: 33 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1463483879 MonoBehaviour: @@ -1404,9 +1478,10 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} - m_RootOrder: 25 + m_RootOrder: 26 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1524906392 MonoBehaviour: @@ -1517,6 +1592,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 8 @@ -1626,6 +1702,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 1, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 @@ -1657,6 +1734,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 19 @@ -1708,6 +1786,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 6 @@ -1756,9 +1835,10 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} - m_RootOrder: 29 + m_RootOrder: 30 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1706612701 GameObject: @@ -1787,9 +1867,10 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} - m_RootOrder: 30 + m_RootOrder: 31 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1706612703 MonoBehaviour: @@ -1862,6 +1943,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 13 @@ -1923,9 +2005,10 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} - m_RootOrder: 22 + m_RootOrder: 23 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1784643786 MonoBehaviour: @@ -1976,9 +2059,10 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} - m_RootOrder: 27 + m_RootOrder: 28 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1871127831 MonoBehaviour: @@ -2024,6 +2108,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 17 @@ -2067,6 +2152,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 5 @@ -2115,6 +2201,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 2 @@ -2159,6 +2246,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1148579784} m_RootOrder: 3 diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/TypeAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/TypeAttribute.cs new file mode 100644 index 00000000..baaed385 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/TypeAttribute.cs @@ -0,0 +1,14 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class TypeAttribute : DrawerAttribute + { + public Type[] types; + public TypeAttribute(params Type[] types) + { + this.types = types; + } + } +} \ No newline at end of file diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/TypeAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/TypeAttribute.cs.meta new file mode 100644 index 00000000..4b9773df --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/TypeAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fa9d78bac58d5ea439a23b522e1338fc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/TypePropertyDrawer.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/TypePropertyDrawer.cs new file mode 100644 index 00000000..5ab7efa6 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/TypePropertyDrawer.cs @@ -0,0 +1,30 @@ +using UnityEngine; +using UnityEditor; +using System.Linq; +using System; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(TypeAttribute))] + public class TypeAttributePropertyDrawer : PropertyDrawerBase + { + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + if (attribute is TypeAttribute attr && property.type == "string") + { + GUIContent[] TypeNames = attr.types.Select(type => new GUIContent(type.FullName)).ToArray(); + int index = Array.FindIndex(attr.types, type => type.FullName == property.stringValue); + index = EditorGUI.Popup(rect, label, index, TypeNames); + if (index >= 0) + { + property.stringValue = attr.types[index].FullName; + } + + }else{ + string message = string.Format("{0} supports only string fields", typeof(TypeAttribute).Name); + EditorGUI.LabelField(rect, label, new GUIContent(message)); + + } + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/TypePropertyDrawer.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/TypePropertyDrawer.cs.meta new file mode 100644 index 00000000..fd7e7fd6 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/TypePropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 87facc7db394ca246b03a4198df9354f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/TypeTest.cs b/Assets/NaughtyAttributes/Scripts/Test/TypeTest.cs new file mode 100644 index 00000000..42410b5d --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/TypeTest.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +namespace NaughtyAttributes +{ + public class TypeTest : MonoBehaviour + { + [Type(typeof(A), typeof(B), typeof(A.B), typeof(C), typeof(global::C))] + public List WaitForGenerate; + + [Button] + void Generate() + { + foreach (var typeName in WaitForGenerate) + { + Type type = Type.GetType(typeName); + object obj = Activator.CreateInstance(type); + Debug.Log(obj); + } + } + + [Type(typeof(MonoBehaviour), typeof(ScriptableObject))] + public int type; + + public class A + { + public int a; + public class B + { + } + } + + public class B + { + public int b; + } + public class C + { + public int c; + } + + + } + +} + +public class C +{ + public int c; +} \ No newline at end of file diff --git a/Assets/NaughtyAttributes/Scripts/Test/TypeTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/TypeTest.cs.meta new file mode 100644 index 00000000..e3d950d8 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/TypeTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 90bebd76d1525c04686583e7f6475250 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: