From 7c3452daa35818bd93de86c8d8abd872b25a589b Mon Sep 17 00:00:00 2001 From: NIMFER Date: Sat, 28 Aug 2021 00:15:07 +0200 Subject: [PATCH] Added new inspector atributes and started to lay out for trap system --- Assets/Input/PlayerControls.cs | 29 + Assets/Input/PlayerControls.inputactions | 19 + Assets/InputSystem.inputsettings.asset | 26 + Assets/InputSystem.inputsettings.asset.meta | 8 + Assets/NaughtyAttributes.meta | 8 + Assets/NaughtyAttributes/README.html | 1648 ++++ Assets/NaughtyAttributes/README.html.meta | 7 + Assets/NaughtyAttributes/Samples.meta | 8 + .../NaughtyAttributes/Samples/DemoScene.meta | 10 + .../Samples/DemoScene/DemoScene.unity | 2208 +++++ .../Samples/DemoScene/DemoScene.unity.meta | 9 + .../DemoScene/DemoSceneSettings.lighting | 63 + .../DemoScene/DemoSceneSettings.lighting.meta | 8 + .../Samples/DemoScene/TestAssets.meta | 10 + .../Samples/DemoScene/TestAssets/Cube.prefab | 93 + .../DemoScene/TestAssets/Cube.prefab.meta | 10 + .../DemoScene/TestAssets/DummyAnimation.anim | 169 + .../TestAssets/DummyAnimation.anim.meta | 8 + .../DummyAnimatorController.controller | 120 + .../DummyAnimatorController.controller.meta | 8 + .../TestAssets/NaughtyScriptableObject.asset | 18 + .../NaughtyScriptableObject.asset.meta | 10 + .../TestAssets/TestScriptableObject 0.asset | 17 + .../TestScriptableObject 0.asset.meta | 8 + .../TestAssets/TestScriptableObject 1.asset | 16 + .../TestScriptableObject 1.asset.meta | 8 + .../DemoScene/TestAssets/icon-github.png | 3 + .../DemoScene/TestAssets/icon-github.png.meta | 127 + Assets/NaughtyAttributes/Scripts.meta | 10 + Assets/NaughtyAttributes/Scripts/Core.meta | 10 + .../Scripts/Core/DrawerAttributes.meta | 8 + .../DrawerAttributes/AllowNestingAttribute.cs | 9 + .../AllowNestingAttribute.cs.meta | 11 + .../AnimatorParamAttribute.cs | 24 + .../AnimatorParamAttribute.cs.meta | 11 + .../DrawerAttributes/CurveRangeAttribute.cs | 30 + .../CurveRangeAttribute.cs.meta | 11 + .../Core/DrawerAttributes/DrawerAttribute.cs | 11 + .../DrawerAttributes/DrawerAttribute.cs.meta | 11 + .../DrawerAttributes/DropdownAttribute.cs | 57 + .../DropdownAttribute.cs.meta | 11 + .../DrawerAttributes/EnumFlagsAttribute.cs | 9 + .../EnumFlagsAttribute.cs.meta | 11 + .../Core/DrawerAttributes/Expandable.cs | 9 + .../Core/DrawerAttributes/Expandable.cs.meta | 11 + .../HorizontalLineAttribute.cs | 20 + .../HorizontalLineAttribute.cs.meta | 11 + .../Core/DrawerAttributes/InfoBoxAttribute.cs | 24 + .../DrawerAttributes/InfoBoxAttribute.cs.meta | 11 + .../DrawerAttributes/InputAxisAttribute.cs | 9 + .../InputAxisAttribute.cs.meta | 11 + .../Core/DrawerAttributes/LayerAttribute.cs | 9 + .../DrawerAttributes/LayerAttribute.cs.meta | 11 + .../DrawerAttributes/MinMaxSliderAttribute.cs | 17 + .../MinMaxSliderAttribute.cs.meta | 11 + .../DrawerAttributes/ProgressBarAttribute.cs | 37 + .../ProgressBarAttribute.cs.meta | 11 + .../ResizableTextAreaAttribute.cs | 9 + .../ResizableTextAreaAttribute.cs.meta | 11 + .../Core/DrawerAttributes/SceneAttribute.cs | 9 + .../DrawerAttributes/SceneAttribute.cs.meta | 11 + .../ShowAssetPreviewAttribute.cs | 20 + .../ShowAssetPreviewAttribute.cs.meta | 11 + .../Core/DrawerAttributes/TagAttribute.cs | 9 + .../DrawerAttributes/TagAttribute.cs.meta | 11 + .../Core/DrawerAttributes_SpecialCase.meta | 8 + .../ButtonAttribute.cs | 33 + .../ButtonAttribute.cs.meta | 11 + .../ReorderableListAttribute.cs | 9 + .../ReorderableListAttribute.cs.meta | 11 + .../ShowNativePropertyAttribute.cs | 9 + .../ShowNativePropertyAttribute.cs.meta | 11 + .../ShowNonSerializedFieldAttribute.cs | 9 + .../ShowNonSerializedFieldAttribute.cs.meta | 11 + .../SpecialCaseDrawerAttribute.cs | 8 + .../SpecialCaseDrawerAttribute.cs.meta | 11 + .../Scripts/Core/INaughtyAttribute.cs | 8 + .../Scripts/Core/INaughtyAttribute.cs.meta | 11 + .../Scripts/Core/MetaAttributes.meta | 8 + .../Core/MetaAttributes/BoxGroupAttribute.cs | 15 + .../MetaAttributes/BoxGroupAttribute.cs.meta | 11 + .../Core/MetaAttributes/DisableIfAttribute.cs | 26 + .../MetaAttributes/DisableIfAttribute.cs.meta | 11 + .../Core/MetaAttributes/EnableIfAttribute.cs | 26 + .../MetaAttributes/EnableIfAttribute.cs.meta | 11 + .../MetaAttributes/EnableIfAttributeBase.cs | 39 + .../EnableIfAttributeBase.cs.meta | 11 + .../Core/MetaAttributes/FoldoutAttribute.cs | 15 + .../MetaAttributes/FoldoutAttribute.cs.meta | 11 + .../Core/MetaAttributes/HideIfAttribute.cs | 26 + .../MetaAttributes/HideIfAttribute.cs.meta | 11 + .../Core/MetaAttributes/IGroupAttribute.cs | 8 + .../MetaAttributes/IGroupAttribute.cs.meta | 11 + .../Core/MetaAttributes/LabelAttribute.cs | 15 + .../MetaAttributes/LabelAttribute.cs.meta | 11 + .../Core/MetaAttributes/MetaAttribute.cs | 8 + .../Core/MetaAttributes/MetaAttribute.cs.meta | 11 + .../MetaAttributes/OnValueChangedAttribute.cs | 15 + .../OnValueChangedAttribute.cs.meta | 11 + .../Core/MetaAttributes/ReadOnlyAttribute.cs | 10 + .../MetaAttributes/ReadOnlyAttribute.cs.meta | 11 + .../Core/MetaAttributes/ShowIfAttribute.cs | 26 + .../MetaAttributes/ShowIfAttribute.cs.meta | 11 + .../MetaAttributes/ShowIfAttributeBase.cs | 39 + .../ShowIfAttributeBase.cs.meta | 11 + .../Core/NaughtyAttributes.Core.asmdef | 12 + .../Core/NaughtyAttributes.Core.asmdef.meta | 7 + .../Scripts/Core/Utility.meta | 8 + .../Scripts/Core/Utility/EColor.cs | 56 + .../Scripts/Core/Utility/EColor.cs.meta | 11 + .../Core/Utility/EConditionOperator.cs | 10 + .../Core/Utility/EConditionOperator.cs.meta | 11 + .../Scripts/Core/ValidatorAttributes.meta | 8 + .../ValidatorAttributes/MaxValueAttribute.cs | 20 + .../MaxValueAttribute.cs.meta | 11 + .../ValidatorAttributes/MinValueAttribute.cs | 20 + .../MinValueAttribute.cs.meta | 11 + .../ValidatorAttributes/RequiredAttribute.cs | 15 + .../RequiredAttribute.cs.meta | 11 + .../ValidateInputAttribute.cs | 17 + .../ValidateInputAttribute.cs.meta | 11 + .../ValidatorAttributes/ValidatorAttribute.cs | 8 + .../ValidatorAttribute.cs.meta | 11 + Assets/NaughtyAttributes/Scripts/Editor.meta | 10 + .../Scripts/Editor/DecoratorDrawers.meta | 8 + .../HorizontalLineDecoratorDrawer.cs | 23 + .../HorizontalLineDecoratorDrawer.cs.meta | 11 + .../InfoBoxDecoratorDrawer.cs | 59 + .../InfoBoxDecoratorDrawer.cs.meta | 11 + .../Editor/NaughtyAttributes.Editor.asmdef | 16 + .../NaughtyAttributes.Editor.asmdef.meta | 7 + .../Scripts/Editor/NaughtyInspector.cs | 221 + .../Scripts/Editor/NaughtyInspector.cs.meta | 11 + .../Scripts/Editor/PropertyDrawers.meta | 8 + .../AllowNestingPropertyDrawer.cs | 16 + .../AllowNestingPropertyDrawer.cs.meta | 11 + .../AnimatorParamPropertyDrawer.cs | 173 + .../AnimatorParamPropertyDrawer.cs.meta | 11 + .../CurveRangePropertyDrawer.cs | 42 + .../CurveRangePropertyDrawer.cs.meta | 11 + .../PropertyDrawers/DropdownPropertyDrawer.cs | 177 + .../DropdownPropertyDrawer.cs.meta | 11 + .../EnumFlagsPropertyDrawer.cs | 38 + .../EnumFlagsPropertyDrawer.cs.meta | 11 + .../ExpandablePropertyDrawer.cs | 195 + .../ExpandablePropertyDrawer.cs.meta | 11 + .../InputAxisPropertyDrawer.cs | 77 + .../InputAxisPropertyDrawer.cs.meta | 11 + .../PropertyDrawers/LayerPropertyDrawer.cs | 88 + .../LayerPropertyDrawer.cs.meta | 11 + .../MinMaxSliderPropertyDrawer.cs | 108 + .../MinMaxSliderPropertyDrawer.cs.meta | 11 + .../ProgressBarPropertyDrawer.cs | 154 + .../ProgressBarPropertyDrawer.cs.meta | 11 + .../PropertyDrawers/PropertyDrawerBase.cs | 94 + .../PropertyDrawerBase.cs.meta | 11 + .../ResizableTextAreaPropertyDrawer.cs | 80 + .../ResizableTextAreaPropertyDrawer.cs.meta | 11 + .../PropertyDrawers/ScenePropertyDrawer.cs | 99 + .../ScenePropertyDrawer.cs.meta | 11 + .../ShowAssetPreviewPropertyDrawer.cs | 110 + .../ShowAssetPreviewPropertyDrawer.cs.meta | 11 + .../PropertyDrawers/TagPropertyDrawer.cs | 62 + .../PropertyDrawers/TagPropertyDrawer.cs.meta | 11 + .../Editor/PropertyDrawers_SpecialCase.meta | 8 + .../ReorderableListPropertyDrawer.cs | 205 + .../ReorderableListPropertyDrawer.cs.meta | 11 + .../SpecialCasePropertyDrawerBase.cs | 74 + .../SpecialCasePropertyDrawerBase.cs.meta | 11 + .../Scripts/Editor/PropertyValidators.meta | 8 + .../MaxValuePropertyValidator.cs | 53 + .../MaxValuePropertyValidator.cs.meta | 11 + .../MinValuePropertyValidator.cs | 53 + .../MinValuePropertyValidator.cs.meta | 11 + .../PropertyValidatorBase.cs | 38 + .../PropertyValidatorBase.cs.meta | 11 + .../RequiredPropertyValidator.cs | 31 + .../RequiredPropertyValidator.cs.meta | 11 + .../ValidateInputPropertyValidator.cs | 75 + .../ValidateInputPropertyValidator.cs.meta | 11 + .../Scripts/Editor/Utility.meta | 10 + .../Scripts/Editor/Utility/ButtonUtility.cs | 55 + .../Editor/Utility/ButtonUtility.cs.meta | 11 + .../Editor/Utility/NaughtyEditorGUI.cs | 379 + .../Editor/Utility/NaughtyEditorGUI.cs.meta | 13 + .../Scripts/Editor/Utility/PropertyUtility.cs | 374 + .../Editor/Utility/PropertyUtility.cs.meta | 11 + .../Editor/Utility/ReflectionUtility.cs | 128 + .../Editor/Utility/ReflectionUtility.cs.meta | 13 + .../Scripts/Editor/Utility/SavedBool.cs | 34 + .../Scripts/Editor/Utility/SavedBool.cs.meta | 11 + Assets/NaughtyAttributes/Scripts/Test.meta | 8 + .../Scripts/Test/AnimatorParamTest.cs | 53 + .../Scripts/Test/AnimatorParamTest.cs.meta | 11 + .../Scripts/Test/BoxGroupTest.cs | 32 + .../Scripts/Test/BoxGroupTest.cs.meta | 11 + .../Scripts/Test/ButtonTest.cs | 39 + .../Scripts/Test/ButtonTest.cs.meta | 11 + .../Scripts/Test/CurveRangeTest.cs | 32 + .../Scripts/Test/CurveRangeTest.cs.meta | 11 + .../Scripts/Test/DisableIfTest.cs | 120 + .../Scripts/Test/DisableIfTest.cs.meta | 11 + .../Scripts/Test/DropdownTest.cs | 45 + .../Scripts/Test/DropdownTest.cs.meta | 11 + .../Scripts/Test/EnableIfTest.cs | 120 + .../Scripts/Test/EnableIfTest.cs.meta | 11 + .../Scripts/Test/EnumFlagsTest.cs | 39 + .../Scripts/Test/EnumFlagsTest.cs.meta | 11 + .../Scripts/Test/ExpandableTest.cs | 28 + .../Scripts/Test/ExpandableTest.cs.meta | 11 + .../Scripts/Test/FoldoutTest.cs | 32 + .../Scripts/Test/FoldoutTest.cs.meta | 11 + .../Scripts/Test/HideIfTest.cs | 119 + .../Scripts/Test/HideIfTest.cs.meta | 11 + .../Scripts/Test/HorizontalLineTest.cs | 51 + .../Scripts/Test/HorizontalLineTest.cs.meta | 11 + .../Scripts/Test/InfoBoxTest.cs | 28 + .../Scripts/Test/InfoBoxTest.cs.meta | 11 + .../Scripts/Test/InputAxisTest.cs | 34 + .../Scripts/Test/InputAxisTest.cs.meta | 11 + .../Scripts/Test/LabelTest.cs | 30 + .../Scripts/Test/LabelTest.cs.meta | 11 + .../Scripts/Test/LayerTest.cs | 46 + .../Scripts/Test/LayerTest.cs.meta | 11 + .../Scripts/Test/MinMaxSliderTest.cs | 28 + .../Scripts/Test/MinMaxSliderTest.cs.meta | 11 + .../Scripts/Test/MinMaxValueTest.cs | 129 + .../Scripts/Test/MinMaxValueTest.cs.meta | 11 + .../Test/NaughtyAttributes.Test.asmdef | 14 + .../Test/NaughtyAttributes.Test.asmdef.meta | 7 + .../Scripts/Test/OnValueChangedTest.cs | 51 + .../Scripts/Test/OnValueChangedTest.cs.meta | 11 + .../Scripts/Test/ProgressBarTest.cs | 35 + .../Scripts/Test/ProgressBarTest.cs.meta | 11 + .../Scripts/Test/ReadOnlyTest.cs | 30 + .../Scripts/Test/ReadOnlyTest.cs.meta | 11 + .../Scripts/Test/ReorderableListTest.cs | 34 + .../Scripts/Test/ReorderableListTest.cs.meta | 11 + .../Scripts/Test/RequiredTest.cs | 30 + .../Scripts/Test/RequiredTest.cs.meta | 11 + .../Scripts/Test/ResizableTextAreaTest.cs | 28 + .../Test/ResizableTextAreaTest.cs.meta | 11 + .../Scripts/Test/SceneTest.cs | 28 + .../Scripts/Test/SceneTest.cs.meta | 11 + .../Scripts/Test/ShowAssetPreviewTest.cs | 37 + .../Scripts/Test/ShowAssetPreviewTest.cs.meta | 11 + .../Scripts/Test/ShowIfTest.cs | 119 + .../Scripts/Test/ShowIfTest.cs.meta | 11 + .../Scripts/Test/ShowNativePropertyTest.cs | 79 + .../Test/ShowNativePropertyTest.cs.meta | 11 + .../Test/ShowNonSerializedFieldTest.cs | 33 + .../Test/ShowNonSerializedFieldTest.cs.meta | 11 + .../NaughtyAttributes/Scripts/Test/TagTest.cs | 34 + .../Scripts/Test/TagTest.cs.meta | 11 + .../Scripts/Test/ValidateInputTest.cs | 52 + .../Scripts/Test/ValidateInputTest.cs.meta | 11 + .../Scripts/Test/_NaughtyComponent.cs | 19 + .../Scripts/Test/_NaughtyComponent.cs.meta | 13 + .../Scripts/Test/_NaughtyScriptableObject.cs | 12 + .../Test/_NaughtyScriptableObject.cs.meta | 13 + .../Scripts/Test/_TestScriptableObject.cs | 24 + .../Test/_TestScriptableObject.cs.meta | 11 + Assets/NaughtyAttributes/package.json | 17 + Assets/NaughtyAttributes/package.json.meta | 7 + Assets/Scenes/SampleScene.unity | 101 +- Assets/ScriptTemplates.meta | 8 + .../80-Clean Script-NewCleanScript.cs.txt | 7 + ...80-Clean Script-NewCleanScript.cs.txt.meta | 7 + ... Behaviour-NewStateMachineBehaviour.cs.txt | 34 + ...viour-NewStateMachineBehaviour.cs.txt.meta | 7 + .../80-TXT File-NewTextFile.txt.txt | 0 .../80-TXT File-NewTextFile.txt.txt.meta | 11 + ...__Console Command-NewConsoleCommand.cs.txt | 18 + ...sole Command-NewConsoleCommand.cs.txt.meta | 7 + Assets/Scripts/Dobber.cs | 13 +- Assets/Scripts/InputReferences.cs | 28 + Assets/Scripts/InputReferences.cs.meta | 11 + Assets/Scripts/Trap.cs | 156 +- .../ShaderGraphs/New Shader Graph.shadergraph | 621 ++ .../New Shader Graph.shadergraph.meta | 10 + Assets/TextMesh Pro.meta | 8 + Assets/TextMesh Pro/Documentation.meta | 8 + .../TextMesh Pro User Guide 2016.pdf | Bin 0 -> 694398 bytes .../TextMesh Pro User Guide 2016.pdf.meta | 7 + Assets/TextMesh Pro/Fonts.meta | 8 + .../Fonts/LiberationSans - OFL.txt | 46 + .../Fonts/LiberationSans - OFL.txt.meta | 8 + Assets/TextMesh Pro/Fonts/LiberationSans.ttf | Bin 0 -> 350200 bytes .../Fonts/LiberationSans.ttf.meta | 19 + Assets/TextMesh Pro/Resources.meta | 8 + .../Resources/Fonts & Materials.meta | 9 + .../LiberationSans SDF - Drop Shadow.mat | 106 + .../LiberationSans SDF - Drop Shadow.mat.meta | 8 + .../LiberationSans SDF - Fallback.asset | 343 + .../LiberationSans SDF - Fallback.asset.meta | 8 + .../LiberationSans SDF - Outline.mat | 104 + .../LiberationSans SDF - Outline.mat.meta | 8 + .../LiberationSans SDF.asset | 7821 +++++++++++++++++ .../LiberationSans SDF.asset.meta | 8 + .../LineBreaking Following Characters.txt | 1 + ...LineBreaking Following Characters.txt.meta | 8 + .../LineBreaking Leading Characters.txt | 1 + .../LineBreaking Leading Characters.txt.meta | 8 + .../TextMesh Pro/Resources/Sprite Assets.meta | 9 + .../Resources/Sprite Assets/EmojiOne.asset | 659 ++ .../Sprite Assets/EmojiOne.asset.meta | 8 + .../TextMesh Pro/Resources/Style Sheets.meta | 9 + .../Style Sheets/Default Style Sheet.asset | 68 + .../Default Style Sheet.asset.meta | 8 + .../TextMesh Pro/Resources/TMP Settings.asset | 46 + .../Resources/TMP Settings.asset.meta | 8 + Assets/TextMesh Pro/Shaders.meta | 8 + .../Shaders/TMP_Bitmap-Custom-Atlas.shader | 143 + .../TMP_Bitmap-Custom-Atlas.shader.meta | 9 + .../Shaders/TMP_Bitmap-Mobile.shader | 145 + .../Shaders/TMP_Bitmap-Mobile.shader.meta | 9 + Assets/TextMesh Pro/Shaders/TMP_Bitmap.shader | 143 + .../Shaders/TMP_Bitmap.shader.meta | 9 + .../Shaders/TMP_SDF Overlay.shader | 317 + .../Shaders/TMP_SDF Overlay.shader.meta | 9 + .../TextMesh Pro/Shaders/TMP_SDF SSD.shader | 310 + .../Shaders/TMP_SDF SSD.shader.meta | 9 + .../Shaders/TMP_SDF-Mobile Masking.shader | 247 + .../TMP_SDF-Mobile Masking.shader.meta | 9 + .../Shaders/TMP_SDF-Mobile Overlay.shader | 240 + .../TMP_SDF-Mobile Overlay.shader.meta | 9 + .../Shaders/TMP_SDF-Mobile SSD.shader | 106 + .../Shaders/TMP_SDF-Mobile SSD.shader.meta | 9 + .../Shaders/TMP_SDF-Mobile.shader | 240 + .../Shaders/TMP_SDF-Mobile.shader.meta | 9 + .../Shaders/TMP_SDF-Surface-Mobile.shader | 138 + .../TMP_SDF-Surface-Mobile.shader.meta | 9 + .../Shaders/TMP_SDF-Surface.shader | 158 + .../Shaders/TMP_SDF-Surface.shader.meta | 9 + Assets/TextMesh Pro/Shaders/TMP_SDF.shader | 317 + .../TextMesh Pro/Shaders/TMP_SDF.shader.meta | 9 + Assets/TextMesh Pro/Shaders/TMP_Sprite.shader | 116 + .../Shaders/TMP_Sprite.shader.meta | 9 + Assets/TextMesh Pro/Shaders/TMPro.cginc | 84 + Assets/TextMesh Pro/Shaders/TMPro.cginc.meta | 9 + .../TextMesh Pro/Shaders/TMPro_Mobile.cginc | 157 + .../Shaders/TMPro_Mobile.cginc.meta | 9 + .../Shaders/TMPro_Properties.cginc | 85 + .../Shaders/TMPro_Properties.cginc.meta | 9 + .../TextMesh Pro/Shaders/TMPro_Surface.cginc | 101 + .../Shaders/TMPro_Surface.cginc.meta | 9 + Assets/TextMesh Pro/Sprites.meta | 8 + .../Sprites/EmojiOne Attribution.txt | 3 + .../Sprites/EmojiOne Attribution.txt.meta | 7 + Assets/TextMesh Pro/Sprites/EmojiOne.json | 156 + .../TextMesh Pro/Sprites/EmojiOne.json.meta | 8 + Assets/TextMesh Pro/Sprites/EmojiOne.png | 3 + Assets/TextMesh Pro/Sprites/EmojiOne.png.meta | 431 + Assets/models/dobber.blend | 2 +- Assets/models/dobber.blend1 | Bin 1345288 -> 1345480 bytes ProjectSettings/EditorBuildSettings.asset | 3 +- .../com.unity.probuilder/Settings.json | 5 + ProjectSettings/ProjectSettings.asset | 3 +- ProjectSettings/QualitySettings.asset | 4 +- ProjectSettings/SceneTemplateSettings.json | 167 + ProjectSettings/TimelineSettings.asset | 15 + UserSettings/EditorUserSettings.asset | 2 +- 362 files changed, 26223 insertions(+), 36 deletions(-) create mode 100644 Assets/InputSystem.inputsettings.asset create mode 100644 Assets/InputSystem.inputsettings.asset.meta create mode 100644 Assets/NaughtyAttributes.meta create mode 100644 Assets/NaughtyAttributes/README.html create mode 100644 Assets/NaughtyAttributes/README.html.meta create mode 100644 Assets/NaughtyAttributes/Samples.meta create mode 100644 Assets/NaughtyAttributes/Samples/DemoScene.meta create mode 100644 Assets/NaughtyAttributes/Samples/DemoScene/DemoScene.unity create mode 100644 Assets/NaughtyAttributes/Samples/DemoScene/DemoScene.unity.meta create mode 100644 Assets/NaughtyAttributes/Samples/DemoScene/DemoSceneSettings.lighting create mode 100644 Assets/NaughtyAttributes/Samples/DemoScene/DemoSceneSettings.lighting.meta create mode 100644 Assets/NaughtyAttributes/Samples/DemoScene/TestAssets.meta create mode 100644 Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/Cube.prefab create mode 100644 Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/Cube.prefab.meta create mode 100644 Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimation.anim create mode 100644 Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimation.anim.meta create mode 100644 Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimatorController.controller create mode 100644 Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimatorController.controller.meta create mode 100644 Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/NaughtyScriptableObject.asset create mode 100644 Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/NaughtyScriptableObject.asset.meta create mode 100644 Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObject 0.asset create mode 100644 Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObject 0.asset.meta create mode 100644 Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObject 1.asset create mode 100644 Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObject 1.asset.meta create mode 100644 Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/icon-github.png create mode 100644 Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/icon-github.png.meta create mode 100644 Assets/NaughtyAttributes/Scripts.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/AllowNestingAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/AllowNestingAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/AnimatorParamAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/AnimatorParamAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/CurveRangeAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/CurveRangeAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/DrawerAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/DrawerAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/DropdownAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/DropdownAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/EnumFlagsAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/EnumFlagsAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/Expandable.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/Expandable.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/HorizontalLineAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/HorizontalLineAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/InfoBoxAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/InfoBoxAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/InputAxisAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/InputAxisAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/LayerAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/LayerAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/MinMaxSliderAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/MinMaxSliderAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ProgressBarAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ProgressBarAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ResizableTextAreaAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ResizableTextAreaAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/SceneAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/SceneAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ShowAssetPreviewAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ShowAssetPreviewAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/TagAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/TagAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ButtonAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ButtonAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ReorderableListAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ReorderableListAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNativePropertyAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNativePropertyAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNonSerializedFieldAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNonSerializedFieldAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/SpecialCaseDrawerAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/SpecialCaseDrawerAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/INaughtyAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/INaughtyAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/BoxGroupAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/BoxGroupAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/DisableIfAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/DisableIfAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttributeBase.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttributeBase.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/FoldoutAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/FoldoutAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/HideIfAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/HideIfAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/IGroupAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/IGroupAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/LabelAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/LabelAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/MetaAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/MetaAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/OnValueChangedAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/OnValueChangedAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ReadOnlyAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ReadOnlyAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttributeBase.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttributeBase.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/NaughtyAttributes.Core.asmdef create mode 100644 Assets/NaughtyAttributes/Scripts/Core/NaughtyAttributes.Core.asmdef.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/Utility.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/Utility/EColor.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/Utility/EColor.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/Utility/EConditionOperator.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/Utility/EConditionOperator.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MaxValueAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MaxValueAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MinValueAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MinValueAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/RequiredAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/RequiredAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidateInputAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidateInputAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidatorAttribute.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidatorAttribute.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/DecoratorDrawers.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/HorizontalLineDecoratorDrawer.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/HorizontalLineDecoratorDrawer.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/InfoBoxDecoratorDrawer.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/InfoBoxDecoratorDrawer.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/NaughtyAttributes.Editor.asmdef create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/NaughtyAttributes.Editor.asmdef.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AllowNestingPropertyDrawer.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AllowNestingPropertyDrawer.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AnimatorParamPropertyDrawer.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AnimatorParamPropertyDrawer.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/CurveRangePropertyDrawer.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/CurveRangePropertyDrawer.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/DropdownPropertyDrawer.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/DropdownPropertyDrawer.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/EnumFlagsPropertyDrawer.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/EnumFlagsPropertyDrawer.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ExpandablePropertyDrawer.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ExpandablePropertyDrawer.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/InputAxisPropertyDrawer.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/InputAxisPropertyDrawer.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/LayerPropertyDrawer.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/LayerPropertyDrawer.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/MinMaxSliderPropertyDrawer.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/MinMaxSliderPropertyDrawer.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ProgressBarPropertyDrawer.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ProgressBarPropertyDrawer.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/PropertyDrawerBase.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/PropertyDrawerBase.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ResizableTextAreaPropertyDrawer.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ResizableTextAreaPropertyDrawer.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ScenePropertyDrawer.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ScenePropertyDrawer.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ShowAssetPreviewPropertyDrawer.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ShowAssetPreviewPropertyDrawer.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/TagPropertyDrawer.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/TagPropertyDrawer.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/ReorderableListPropertyDrawer.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/ReorderableListPropertyDrawer.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/SpecialCasePropertyDrawerBase.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/SpecialCasePropertyDrawerBase.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/MaxValuePropertyValidator.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/MaxValuePropertyValidator.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/MinValuePropertyValidator.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/MinValuePropertyValidator.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/PropertyValidatorBase.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/PropertyValidatorBase.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/RequiredPropertyValidator.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/RequiredPropertyValidator.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/ValidateInputPropertyValidator.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/ValidateInputPropertyValidator.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/Utility.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/Utility/ButtonUtility.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/Utility/ButtonUtility.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/Utility/NaughtyEditorGUI.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/Utility/NaughtyEditorGUI.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/Utility/PropertyUtility.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/Utility/PropertyUtility.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/Utility/ReflectionUtility.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/Utility/ReflectionUtility.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/Utility/SavedBool.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Editor/Utility/SavedBool.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/AnimatorParamTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/AnimatorParamTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/BoxGroupTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/BoxGroupTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ButtonTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ButtonTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/CurveRangeTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/CurveRangeTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/DisableIfTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/DisableIfTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/DropdownTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/DropdownTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/EnableIfTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/EnableIfTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/EnumFlagsTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/EnumFlagsTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ExpandableTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ExpandableTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/FoldoutTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/FoldoutTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/HideIfTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/HideIfTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/HorizontalLineTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/HorizontalLineTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/InfoBoxTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/InfoBoxTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/InputAxisTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/InputAxisTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/LabelTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/LabelTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/LayerTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/LayerTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/MinMaxSliderTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/MinMaxSliderTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/MinMaxValueTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/MinMaxValueTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/NaughtyAttributes.Test.asmdef create mode 100644 Assets/NaughtyAttributes/Scripts/Test/NaughtyAttributes.Test.asmdef.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/OnValueChangedTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/OnValueChangedTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ProgressBarTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ProgressBarTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ReadOnlyTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ReadOnlyTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ReorderableListTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ReorderableListTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/RequiredTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/RequiredTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ResizableTextAreaTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ResizableTextAreaTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/SceneTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/SceneTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ShowAssetPreviewTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ShowAssetPreviewTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ShowIfTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ShowIfTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ShowNativePropertyTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ShowNativePropertyTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ShowNonSerializedFieldTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ShowNonSerializedFieldTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/TagTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/TagTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ValidateInputTest.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/ValidateInputTest.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/_NaughtyComponent.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/_NaughtyComponent.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/_NaughtyScriptableObject.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/_NaughtyScriptableObject.cs.meta create mode 100644 Assets/NaughtyAttributes/Scripts/Test/_TestScriptableObject.cs create mode 100644 Assets/NaughtyAttributes/Scripts/Test/_TestScriptableObject.cs.meta create mode 100644 Assets/NaughtyAttributes/package.json create mode 100644 Assets/NaughtyAttributes/package.json.meta create mode 100644 Assets/ScriptTemplates.meta create mode 100644 Assets/ScriptTemplates/80-Clean Script-NewCleanScript.cs.txt create mode 100644 Assets/ScriptTemplates/80-Clean Script-NewCleanScript.cs.txt.meta create mode 100644 Assets/ScriptTemplates/80-State Machine Behaviour-NewStateMachineBehaviour.cs.txt create mode 100644 Assets/ScriptTemplates/80-State Machine Behaviour-NewStateMachineBehaviour.cs.txt.meta create mode 100644 Assets/ScriptTemplates/80-TXT File-NewTextFile.txt.txt create mode 100644 Assets/ScriptTemplates/80-TXT File-NewTextFile.txt.txt.meta create mode 100644 Assets/ScriptTemplates/80-qASIC__Console Command-NewConsoleCommand.cs.txt create mode 100644 Assets/ScriptTemplates/80-qASIC__Console Command-NewConsoleCommand.cs.txt.meta create mode 100644 Assets/Scripts/InputReferences.cs create mode 100644 Assets/Scripts/InputReferences.cs.meta create mode 100644 Assets/ShaderGraphs/New Shader Graph.shadergraph create mode 100644 Assets/ShaderGraphs/New Shader Graph.shadergraph.meta create mode 100644 Assets/TextMesh Pro.meta create mode 100644 Assets/TextMesh Pro/Documentation.meta create mode 100644 Assets/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf create mode 100644 Assets/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf.meta create mode 100644 Assets/TextMesh Pro/Fonts.meta create mode 100644 Assets/TextMesh Pro/Fonts/LiberationSans - OFL.txt create mode 100644 Assets/TextMesh Pro/Fonts/LiberationSans - OFL.txt.meta create mode 100644 Assets/TextMesh Pro/Fonts/LiberationSans.ttf create mode 100644 Assets/TextMesh Pro/Fonts/LiberationSans.ttf.meta create mode 100644 Assets/TextMesh Pro/Resources.meta create mode 100644 Assets/TextMesh Pro/Resources/Fonts & Materials.meta create mode 100644 Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Drop Shadow.mat create mode 100644 Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Drop Shadow.mat.meta create mode 100644 Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset create mode 100644 Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset.meta create mode 100644 Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Outline.mat create mode 100644 Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Outline.mat.meta create mode 100644 Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF.asset create mode 100644 Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF.asset.meta create mode 100644 Assets/TextMesh Pro/Resources/LineBreaking Following Characters.txt create mode 100644 Assets/TextMesh Pro/Resources/LineBreaking Following Characters.txt.meta create mode 100644 Assets/TextMesh Pro/Resources/LineBreaking Leading Characters.txt create mode 100644 Assets/TextMesh Pro/Resources/LineBreaking Leading Characters.txt.meta create mode 100644 Assets/TextMesh Pro/Resources/Sprite Assets.meta create mode 100644 Assets/TextMesh Pro/Resources/Sprite Assets/EmojiOne.asset create mode 100644 Assets/TextMesh Pro/Resources/Sprite Assets/EmojiOne.asset.meta create mode 100644 Assets/TextMesh Pro/Resources/Style Sheets.meta create mode 100644 Assets/TextMesh Pro/Resources/Style Sheets/Default Style Sheet.asset create mode 100644 Assets/TextMesh Pro/Resources/Style Sheets/Default Style Sheet.asset.meta create mode 100644 Assets/TextMesh Pro/Resources/TMP Settings.asset create mode 100644 Assets/TextMesh Pro/Resources/TMP Settings.asset.meta create mode 100644 Assets/TextMesh Pro/Shaders.meta create mode 100644 Assets/TextMesh Pro/Shaders/TMP_Bitmap-Custom-Atlas.shader create mode 100644 Assets/TextMesh Pro/Shaders/TMP_Bitmap-Custom-Atlas.shader.meta create mode 100644 Assets/TextMesh Pro/Shaders/TMP_Bitmap-Mobile.shader create mode 100644 Assets/TextMesh Pro/Shaders/TMP_Bitmap-Mobile.shader.meta create mode 100644 Assets/TextMesh Pro/Shaders/TMP_Bitmap.shader create mode 100644 Assets/TextMesh Pro/Shaders/TMP_Bitmap.shader.meta create mode 100644 Assets/TextMesh Pro/Shaders/TMP_SDF Overlay.shader create mode 100644 Assets/TextMesh Pro/Shaders/TMP_SDF Overlay.shader.meta create mode 100644 Assets/TextMesh Pro/Shaders/TMP_SDF SSD.shader create mode 100644 Assets/TextMesh Pro/Shaders/TMP_SDF SSD.shader.meta create mode 100644 Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile Masking.shader create mode 100644 Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile Masking.shader.meta create mode 100644 Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile Overlay.shader create mode 100644 Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile Overlay.shader.meta create mode 100644 Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile SSD.shader create mode 100644 Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile SSD.shader.meta create mode 100644 Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile.shader create mode 100644 Assets/TextMesh Pro/Shaders/TMP_SDF-Mobile.shader.meta create mode 100644 Assets/TextMesh Pro/Shaders/TMP_SDF-Surface-Mobile.shader create mode 100644 Assets/TextMesh Pro/Shaders/TMP_SDF-Surface-Mobile.shader.meta create mode 100644 Assets/TextMesh Pro/Shaders/TMP_SDF-Surface.shader create mode 100644 Assets/TextMesh Pro/Shaders/TMP_SDF-Surface.shader.meta create mode 100644 Assets/TextMesh Pro/Shaders/TMP_SDF.shader create mode 100644 Assets/TextMesh Pro/Shaders/TMP_SDF.shader.meta create mode 100644 Assets/TextMesh Pro/Shaders/TMP_Sprite.shader create mode 100644 Assets/TextMesh Pro/Shaders/TMP_Sprite.shader.meta create mode 100644 Assets/TextMesh Pro/Shaders/TMPro.cginc create mode 100644 Assets/TextMesh Pro/Shaders/TMPro.cginc.meta create mode 100644 Assets/TextMesh Pro/Shaders/TMPro_Mobile.cginc create mode 100644 Assets/TextMesh Pro/Shaders/TMPro_Mobile.cginc.meta create mode 100644 Assets/TextMesh Pro/Shaders/TMPro_Properties.cginc create mode 100644 Assets/TextMesh Pro/Shaders/TMPro_Properties.cginc.meta create mode 100644 Assets/TextMesh Pro/Shaders/TMPro_Surface.cginc create mode 100644 Assets/TextMesh Pro/Shaders/TMPro_Surface.cginc.meta create mode 100644 Assets/TextMesh Pro/Sprites.meta create mode 100644 Assets/TextMesh Pro/Sprites/EmojiOne Attribution.txt create mode 100644 Assets/TextMesh Pro/Sprites/EmojiOne Attribution.txt.meta create mode 100644 Assets/TextMesh Pro/Sprites/EmojiOne.json create mode 100644 Assets/TextMesh Pro/Sprites/EmojiOne.json.meta create mode 100644 Assets/TextMesh Pro/Sprites/EmojiOne.png create mode 100644 Assets/TextMesh Pro/Sprites/EmojiOne.png.meta create mode 100644 ProjectSettings/SceneTemplateSettings.json create mode 100644 ProjectSettings/TimelineSettings.asset diff --git a/Assets/Input/PlayerControls.cs b/Assets/Input/PlayerControls.cs index 86651d1..9853779 100644 --- a/Assets/Input/PlayerControls.cs +++ b/Assets/Input/PlayerControls.cs @@ -185,6 +185,14 @@ public class @PlayerControls : IInputActionCollection, IDisposable ""expectedControlType"": ""Button"", ""processors"": """", ""interactions"": """" + }, + { + ""name"": ""ArmTrap"", + ""type"": ""Button"", + ""id"": ""fb854b7a-e668-4da2-881f-a497ea520985"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """" } ], ""bindings"": [ @@ -286,6 +294,17 @@ public class @PlayerControls : IInputActionCollection, IDisposable ""action"": ""Attack"", ""isComposite"": false, ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""9a9e47c1-be56-4466-aa0e-e22ba0fe4a4b"", + ""path"": ""/f"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""ArmTrap"", + ""isComposite"": false, + ""isPartOfComposite"": false } ] }, @@ -469,6 +488,7 @@ public class @PlayerControls : IInputActionCollection, IDisposable m_DobberControls_Sneak = m_DobberControls.FindAction("Sneak", throwIfNotFound: true); m_DobberControls_Interact = m_DobberControls.FindAction("Interact", throwIfNotFound: true); m_DobberControls_Attack = m_DobberControls.FindAction("Attack", throwIfNotFound: true); + m_DobberControls_ArmTrap = m_DobberControls.FindAction("ArmTrap", throwIfNotFound: true); // RobberControls m_RobberControls = asset.FindActionMap("RobberControls", throwIfNotFound: true); m_RobberControls_Walk = m_RobberControls.FindAction("Walk", throwIfNotFound: true); @@ -587,6 +607,7 @@ public class @PlayerControls : IInputActionCollection, IDisposable private readonly InputAction m_DobberControls_Sneak; private readonly InputAction m_DobberControls_Interact; private readonly InputAction m_DobberControls_Attack; + private readonly InputAction m_DobberControls_ArmTrap; public struct DobberControlsActions { private @PlayerControls m_Wrapper; @@ -596,6 +617,7 @@ public class @PlayerControls : IInputActionCollection, IDisposable public InputAction @Sneak => m_Wrapper.m_DobberControls_Sneak; public InputAction @Interact => m_Wrapper.m_DobberControls_Interact; public InputAction @Attack => m_Wrapper.m_DobberControls_Attack; + public InputAction @ArmTrap => m_Wrapper.m_DobberControls_ArmTrap; public InputActionMap Get() { return m_Wrapper.m_DobberControls; } public void Enable() { Get().Enable(); } public void Disable() { Get().Disable(); } @@ -620,6 +642,9 @@ public class @PlayerControls : IInputActionCollection, IDisposable @Attack.started -= m_Wrapper.m_DobberControlsActionsCallbackInterface.OnAttack; @Attack.performed -= m_Wrapper.m_DobberControlsActionsCallbackInterface.OnAttack; @Attack.canceled -= m_Wrapper.m_DobberControlsActionsCallbackInterface.OnAttack; + @ArmTrap.started -= m_Wrapper.m_DobberControlsActionsCallbackInterface.OnArmTrap; + @ArmTrap.performed -= m_Wrapper.m_DobberControlsActionsCallbackInterface.OnArmTrap; + @ArmTrap.canceled -= m_Wrapper.m_DobberControlsActionsCallbackInterface.OnArmTrap; } m_Wrapper.m_DobberControlsActionsCallbackInterface = instance; if (instance != null) @@ -639,6 +664,9 @@ public class @PlayerControls : IInputActionCollection, IDisposable @Attack.started += instance.OnAttack; @Attack.performed += instance.OnAttack; @Attack.canceled += instance.OnAttack; + @ArmTrap.started += instance.OnArmTrap; + @ArmTrap.performed += instance.OnArmTrap; + @ArmTrap.canceled += instance.OnArmTrap; } } } @@ -731,6 +759,7 @@ public class @PlayerControls : IInputActionCollection, IDisposable void OnSneak(InputAction.CallbackContext context); void OnInteract(InputAction.CallbackContext context); void OnAttack(InputAction.CallbackContext context); + void OnArmTrap(InputAction.CallbackContext context); } public interface IRobberControlsActions { diff --git a/Assets/Input/PlayerControls.inputactions b/Assets/Input/PlayerControls.inputactions index a143e4f..f294c7b 100644 --- a/Assets/Input/PlayerControls.inputactions +++ b/Assets/Input/PlayerControls.inputactions @@ -172,6 +172,14 @@ "expectedControlType": "Button", "processors": "", "interactions": "" + }, + { + "name": "ArmTrap", + "type": "Button", + "id": "fb854b7a-e668-4da2-881f-a497ea520985", + "expectedControlType": "Button", + "processors": "", + "interactions": "" } ], "bindings": [ @@ -273,6 +281,17 @@ "action": "Attack", "isComposite": false, "isPartOfComposite": false + }, + { + "name": "", + "id": "9a9e47c1-be56-4466-aa0e-e22ba0fe4a4b", + "path": "/f", + "interactions": "", + "processors": "", + "groups": "", + "action": "ArmTrap", + "isComposite": false, + "isPartOfComposite": false } ] }, diff --git a/Assets/InputSystem.inputsettings.asset b/Assets/InputSystem.inputsettings.asset new file mode 100644 index 0000000..1b236ef --- /dev/null +++ b/Assets/InputSystem.inputsettings.asset @@ -0,0 +1,26 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c46f07b5ed07e4e92aa78254188d3d10, type: 3} + m_Name: InputSystem.inputsettings + m_EditorClassIdentifier: + m_SupportedDevices: [] + m_UpdateMode: 1 + m_CompensateForScreenOrientation: 1 + m_FilterNoiseOnCurrent: 0 + m_DefaultDeadzoneMin: 0.125 + m_DefaultDeadzoneMax: 0.925 + m_DefaultButtonPressPoint: 0.5 + m_DefaultTapTime: 0.2 + m_DefaultSlowTapTime: 0.5 + m_DefaultHoldTime: 0.4 + m_TapRadius: 5 + m_MultiTapDelayTime: 0.75 diff --git a/Assets/InputSystem.inputsettings.asset.meta b/Assets/InputSystem.inputsettings.asset.meta new file mode 100644 index 0000000..946e4c0 --- /dev/null +++ b/Assets/InputSystem.inputsettings.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ad76045632be0b24da9b262655368913 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes.meta b/Assets/NaughtyAttributes.meta new file mode 100644 index 0000000..e9890f6 --- /dev/null +++ b/Assets/NaughtyAttributes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3a5091af6db0d9544b0de98e8f6100f7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/README.html b/Assets/NaughtyAttributes/README.html new file mode 100644 index 0000000..5df2d2d --- /dev/null +++ b/Assets/NaughtyAttributes/README.html @@ -0,0 +1,1648 @@ + + + + + README.md - Grip + + + + + + +
+
+ + + +
+
+
+
+ +

+ + README.md +

+ +
+

+NaughtyAttributes

+

Unity 2018.3+ +openupm +License: MIT

+

NaughtyAttributes is an extension for the Unity Inspector.

+

It expands the range of attributes that Unity provides so that you can create powerful inspectors without the need of custom editors or property drawers. It also provides attributes that can be applied to non-serialized fields or functions.

+

Most of the attributes are implemented using Unity's CustomPropertyDrawer, so they will work in your custom editors. If you want all of the attributes to work in your custom editors, however, you must inherit from NaughtyInspector and use the NaughtyEditorGUI.PropertyField_Layout function instead of EditorGUILayout.PropertyField.

+

+System Requirements

+

Unity 2018.3.0 or later versions. Feel free to try older version. Don't forget to include the NaughtyAttributes namespace.

+

+Installation

+
    +
  1. The package is available on the openupm registry. You can install it via openupm-cli.
  2. +
+
openupm add com.dbrizov.naughtyattributes
+
+
    +
  1. You can also install via git url by adding this entry in your manifest.json +
  2. +
+
"com.dbrizov.naughtyattributes": "https://github.com/dbrizov/NaughtyAttributes.git#upm"
+
+
    +
  1. You can also download it from the Asset Store +
  2. +
+

+Documentation

+ +

+Support

+

NaughtyAttributes is an open-source project that I am developing in my free time. If you like it you can support me by donating.

+ +

+Overview

+

+Drawer Attributes

+

Provide special draw options to serialized fields. +A field can have only one DrawerAttribute. If a field has more than one, only the bottom one will be used.

+

+AnimatorParam

+

Select an Animator paramater via dropdown interface.

+
public class NaughtyComponent : MonoBehaviour
+{
+	public Animator someAnimator;
+
+	[AnimatorParam("someAnimator")]
+	public int paramHash;
+
+	[AnimatorParam("someAnimator")]
+	public string paramName;
+}
+

inspector

+

+Button

+

A method can be marked as a button. A button appears in the inspector and executes the method if clicked. +Works both with instance and static methods.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[Button]
+	private void MethodOne() { }
+
+	[Button("Button Text")]
+	private void MethodTwo() { }
+}
+

inspector

+

+CurveRange

+

Set bounds and modify curve color for AnimationCurves

+
public class NaughtyComponent : MonoBehaviour
+{
+	[CurveRange(-1, -1, 1, 1)]
+	public AnimationCurve curve;
+	
+	[CurveRange(EColor.Orange)]
+	public AnimationCurve curve1;
+	
+	[CurveRange(0, 0, 5, 5, EColor.Red)]
+	public AnimationCurve curve2;
+}
+

inspector

+

+Dropdown

+

Provides an interface for dropdown value selection.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[Dropdown("intValues")]
+	public int intValue;
+
+	[Dropdown("StringValues")]
+	public string stringValue;
+
+	[Dropdown("GetVectorValues")]
+	public Vector3 vectorValue;
+
+	private int[] intValues = new int[] { 1, 2, 3, 4, 5 };
+
+	private List<string> StringValues { get { return new List<string>() { "A", "B", "C", "D", "E" }; } }
+
+	private DropdownList<Vector3> GetVectorValues()
+	{
+		return new DropdownList<Vector3>()
+		{
+			{ "Right",   Vector3.right },
+			{ "Left",    Vector3.left },
+			{ "Up",      Vector3.up },
+			{ "Down",    Vector3.down },
+			{ "Forward", Vector3.forward },
+			{ "Back",    Vector3.back }
+		};
+	}
+}
+

inspector

+

+EnumFlags

+

Provides dropdown interface for setting enum flags.

+
public enum Direction
+{
+	None = 0,
+	Right = 1 << 0,
+	Left = 1 << 1,
+	Up = 1 << 2,
+	Down = 1 << 3
+}
+
+public class NaughtyComponent : MonoBehaviour
+{
+	[EnumFlags]
+	public Direction flags;
+}
+

inspector

+

+Expandable

+

Make scriptable objects expandable.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[Expandable]
+	public ScriptableObject scriptableObject;
+}
+

inspector

+

+HorizontalLine

+
public class NaughtyComponent : MonoBehaviour
+{
+	[HorizontalLine(color: EColor.Red)]
+	public int red;
+
+	[HorizontalLine(color: EColor.Green)]
+	public int green;
+
+	[HorizontalLine(color: EColor.Blue)]
+	public int blue;
+}
+

inspector

+

+InfoBox

+

Used for providing additional information.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[InfoBox("This is my int", EInfoBoxType.Normal)]
+	public int myInt;
+
+	[InfoBox("This is my float", EInfoBoxType.Warning)]
+	public float myFloat;
+
+	[InfoBox("This is my vector", EInfoBoxType.Error)]
+	public Vector3 myVector;
+}
+

inspector

+

+InputAxis

+

Select an input axis via dropdown interface.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[InputAxis]
+	public string inputAxis;
+}
+

inspector

+

+MinMaxSlider

+

A double slider. The min value is saved to the X property, and the max value is saved to the Y property of a Vector2 field.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[MinMaxSlider(0.0f, 100.0f)]
+	public Vector2 minMaxSlider;
+}
+

inspector

+

+ProgressBar

+
public class NaughtyComponent : MonoBehaviour
+{
+	[ProgressBar("Health", 300, EColor.Red)]
+	public int health = 250;
+
+	[ProgressBar("Mana", 100, EColor.Blue)]
+	public int mana = 25;
+
+	[ProgressBar("Stamina", 200, EColor.Green)]
+	public int stamina = 150;
+}
+

inspector

+

+ReorderableList

+

Provides array type fields with an interface for easy reordering of elements.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[ReorderableList]
+	public int[] intArray;
+
+	[ReorderableList]
+	public List<float> floatArray;
+}
+

inspector

+

+ReadOnly

+

Makes a field read only.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[ReadOnly]
+	public Vector3 forwardVector = Vector3.forward;
+}
+

inspector

+

+ResizableTextArea

+

A resizable text area where you can see the whole text. +Unlike Unity's Multiline and TextArea attributes where you can see only 3 rows of a given text, and in order to see it or modify it you have to manually scroll down to the desired row.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[ResizableTextArea]
+	public string resizableTextArea;
+}
+

inspector

+

+Scene

+

Select a scene from the build settings via dropdown interface.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[Scene]
+	public string bootScene; // scene name
+
+	[Scene]
+	public int tutorialScene; // scene index
+}
+

inspector

+

+ShowAssetPreview

+

Shows the texture preview of a given asset (Sprite, Prefab...).

+
public class NaughtyComponent : MonoBehaviour
+{
+	[ShowAssetPreview]
+	public Sprite sprite;
+
+	[ShowAssetPreview(128, 128)]
+	public GameObject prefab;
+}
+

inspector

+

+ShowNativeProperty

+

Shows native C# properties in the inspector. +All native properties are displayed at the bottom of the inspector after the non-serialized fields and before the method buttons. +It supports only certain types (bool, int, long, float, double, string, Vector2, Vector3, Vector4, Color, Bounds, Rect, UnityEngine.Object).

+
public class NaughtyComponent : MonoBehaviour
+{
+	public List<Transform> transforms;
+
+	[ShowNativeProperty]
+	public int TransformsCount => transforms.Count;
+}
+

inspector

+

+ShowNonSerializedField

+

Shows non-serialized fields in the inspector. +All non-serialized fields are displayed at the bottom of the inspector before the method buttons. +Keep in mind that if you change a non-static non-serialized field in the code - the value in the inspector will be updated after you press Play in the editor. +There is no such issue with static non-serialized fields because their values are updated at compile time. +It supports only certain types (bool, int, long, float, double, string, Vector2, Vector3, Vector4, Color, Bounds, Rect, UnityEngine.Object).

+
public class NaughtyComponent : MonoBehaviour
+{
+	[ShowNonSerializedField]
+	private int myInt = 10;
+
+	[ShowNonSerializedField]
+	private const float PI = 3.14159f;
+
+	[ShowNonSerializedField]
+	private static readonly Vector3 CONST_VECTOR = Vector3.one;
+}
+

inspector

+

+Tag

+

Select a tag via dropdown interface.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[Tag]
+	public string tagField;
+}
+

inspector

+

+Meta Attributes

+

Give the fields meta data. A field can have more than one meta attributes.

+

+BoxGroup

+

Surrounds grouped fields with a box.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[BoxGroup("Integers")]
+	public int firstInt;
+	[BoxGroup("Integers")]
+	public int secondInt;
+
+	[BoxGroup("Floats")]
+	public float firstFloat;
+	[BoxGroup("Floats")]
+	public float secondFloat;
+}
+

inspector

+

+Foldout

+

Makes a foldout group.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[Foldout("Integers")]
+	public int firstInt;
+	[Foldout("Integers")]
+	public int secondInt;
+}
+

inspector

+

+EnableIf / DisableIf

+
public class NaughtyComponent : MonoBehaviour
+{
+	public bool enableMyInt;
+
+	[EnableIf("enableMyInt")]
+	public int myInt;
+
+	[EnableIf("Enabled")]
+	public float myFloat;
+
+	[EnableIf("NotEnabled")]
+	public Vector3 myVector;
+
+	public bool Enabled() { return true; }
+
+	public bool NotEnabled => false;
+}
+

inspector

+

You can have more than one condition.

+
public class NaughtyComponent : MonoBehaviour
+{
+	public bool flag0;
+	public bool flag1;
+
+	[EnableIf(EConditionOperator.And, "flag0", "flag1")]
+	public int enabledIfAll;
+
+	[EnableIf(EConditionOperator.Or, "flag0", "flag1")]
+	public int enabledIfAny;
+}
+

+ShowIf / HideIf

+
public class NaughtyComponent : MonoBehaviour
+{
+	public bool showInt;
+
+	[ShowIf("showInt")]
+	public int myInt;
+
+	[ShowIf("AlwaysShow")]
+	public float myFloat;
+
+	[ShowIf("NeverShow")]
+	public Vector3 myVector;
+
+	public bool AlwaysShow() { return true; }
+
+	public bool NeverShow => false;
+}
+

inspector

+

You can have more than one condition.

+
public class NaughtyComponent : MonoBehaviour
+{
+	public bool flag0;
+	public bool flag1;
+
+	[ShowIf(EConditionOperator.And, "flag0", "flag1")]
+	public int showIfAll;
+
+	[ShowIf(EConditionOperator.Or, "flag0", "flag1")]
+	public int showIfAny;
+}
+

+Label

+

Override default field label.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[Label("Short Name")]
+	public string veryVeryLongName;
+
+	[Label("RGB")]
+	public Vector3 vectorXYZ;
+}
+

inspector

+

+OnValueChanged

+

Detects a value change and executes a callback. +Keep in mind that the event is detected only when the value is changed from the inspector. +If you want a runtime event, you should probably use an event/delegate and subscribe to it.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[OnValueChanged("OnValueChangedCallback")]
+	public int myInt;
+
+	private void OnValueChangedCallback()
+	{
+		Debug.Log(myInt);
+	}
+}
+

+Validator Attributes

+

Used for validating the fields. A field can have infinite number of validator attributes.

+

+MinValue / MaxValue

+

Clamps integer and float fields.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[MinValue(0), MaxValue(10)]
+	public int myInt;
+
+	[MinValue(0.0f)]
+	public float myFloat;
+}
+

inspector

+

+Required

+

Used to remind the developer that a given reference type field is required.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[Required]
+	public Transform myTransform;
+
+	[Required("Custom required text")]
+	public GameObject myGameObject;
+}
+

inspector

+

+ValidateInput

+

The most powerful ValidatorAttribute.

+
public class _NaughtyComponent : MonoBehaviour
+{
+	[ValidateInput("IsNotNull")]
+	public Transform myTransform;
+
+	[ValidateInput("IsGreaterThanZero", "myInteger must be greater than zero")]
+	public int myInt;
+
+	private bool IsNotNull(Transform tr)
+	{
+		return tr != null;
+	}
+
+	private bool IsGreaterThanZero(int value)
+	{
+		return value > 0;
+	}
+}
+

inspector

+ +
+
+
+
+
+ + + +
+
 
+
+ + \ No newline at end of file diff --git a/Assets/NaughtyAttributes/README.html.meta b/Assets/NaughtyAttributes/README.html.meta new file mode 100644 index 0000000..42c42d4 --- /dev/null +++ b/Assets/NaughtyAttributes/README.html.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f1c5c604e6d27cc4d86e81f45c704e11 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Samples.meta b/Assets/NaughtyAttributes/Samples.meta new file mode 100644 index 0000000..db0978e --- /dev/null +++ b/Assets/NaughtyAttributes/Samples.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b1e9ff0668650a54da2c458e80a90032 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Samples/DemoScene.meta b/Assets/NaughtyAttributes/Samples/DemoScene.meta new file mode 100644 index 0000000..ea993c6 --- /dev/null +++ b/Assets/NaughtyAttributes/Samples/DemoScene.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: afb4c815411c28b449e61fbaa1a8bfa3 +folderAsset: yes +timeCreated: 1507995550 +licenseType: Store +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Samples/DemoScene/DemoScene.unity b/Assets/NaughtyAttributes/Samples/DemoScene/DemoScene.unity new file mode 100644 index 0000000..d4be8e1 --- /dev/null +++ b/Assets/NaughtyAttributes/Samples/DemoScene/DemoScene.unity @@ -0,0 +1,2208 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + 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_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 500 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 4890085278179872738, guid: 98ee975b74776234986f4d35f14c4ccc, + type: 2} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &106181862 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 106181863} + m_Layer: 0 + m_Name: ===== Drawer Attributes ===== + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &106181863 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 106181862} + 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: 1148579784} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &114650323 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 114650324} + - component: {fileID: 114650325} + - component: {fileID: 114650326} + m_Layer: 0 + m_Name: EnableIf_DisableIf + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &114650324 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 114650323} + 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: 1148579784} + m_RootOrder: 23 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &114650325 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 114650323} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bed506d8be3a10f45bec4bf2237bec87, type: 3} + m_Name: + m_EditorClassIdentifier: + enable1: 0 + enable2: 0 + enum1: 0 + enableIfAll: + enableIfAny: + enableIfEnum: + nest1: + enable1: 1 + enable2: 0 + enum1: 0 + enableIfAll: 1 + enableIfAny: 2 + enableIfEnum: 0 + nest2: + enable1: 1 + enable2: 1 + enum1: 0 + enableIfAll: {x: 0.25, y: 0.75} + enableIfAny: {x: 0.25, y: 0.75} + enableIfEnum: {x: 0.25, y: 0.75} +--- !u!114 &114650326 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 114650323} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0e48a088cb96287448c3be58932bfcb7, type: 3} + m_Name: + m_EditorClassIdentifier: + disable1: 0 + disable2: 0 + enum1: 0 + disableIfAll: + disableIfAny: + disableIfEnum: + nest1: + disable1: 1 + disable2: 0 + enum1: 0 + disableIfAll: 1 + disableIfAny: 2 + disableIfEnum: 3 + nest2: + disable1: 1 + disable2: 1 + enum1: 0 + enableIfAll: {x: 0.25, y: 0.75} + enableIfAny: {x: 0.25, y: 0.75} + enableIfEnum: {x: 0.25, y: 0.75} +--- !u!1 &155697335 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 155697336} + - component: {fileID: 155697337} + m_Layer: 0 + m_Name: InputAxis + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &155697336 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 155697335} + 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: 1148579784} + m_RootOrder: 9 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &155697337 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 155697335} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e0cc8a31c22090847b75538c0ed2d2fc, type: 3} + m_Name: + m_EditorClassIdentifier: + inputAxis0: + nest1: + inputAxis1: Horizontal + nest2: + inputAxis2: Vertical +--- !u!1 &237121640 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 237121641} + - component: {fileID: 237121642} + m_Layer: 0 + m_Name: ReadOnly + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &237121641 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 237121640} + 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: 1148579784} + m_RootOrder: 27 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &237121642 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 237121640} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5443d37a05e188846bda9b05b067184e, type: 3} + m_Name: + m_EditorClassIdentifier: + readOnlyInt: 5 + nest1: + readOnlyFloat: 3.14 + nest2: + readOnlyString: +--- !u!1 &369789276 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 369789277} + - component: {fileID: 369789278} + m_Layer: 0 + m_Name: Required + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &369789277 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 369789276} + 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: 1148579784} + m_RootOrder: 30 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &369789278 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 369789276} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9c8c10b2234650d42b2a8efad6b413db, type: 3} + m_Name: + m_EditorClassIdentifier: + trans0: {fileID: 0} + nest1: + trans1: {fileID: 0} + nest2: + trans2: {fileID: 0} +--- !u!1 &572382748 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 572382749} + - component: {fileID: 572382751} + m_Layer: 0 + m_Name: Foldout + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &572382749 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 572382748} + 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: 1148579784} + m_RootOrder: 22 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &572382751 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 572382748} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3b437215d92efa74ea85ff726ca0dd09, type: 3} + m_Name: + m_EditorClassIdentifier: + int0: 0 + int1: 0 + float0: 0 + float1: 0 + slider0: {x: 0.25, y: 0.75} + slider1: {x: 0.25, y: 0.75} + str0: + str1: + trans0: {fileID: 0} + trans1: {fileID: 0} +--- !u!1 &607441873 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 607441874} + - component: {fileID: 607441875} + m_Layer: 0 + m_Name: MinMaxSlider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &607441874 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 607441873} + 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: 1148579784} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &607441875 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 607441873} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fd67fbde6acdd6a44944f12e507067c5, type: 3} + m_Name: + m_EditorClassIdentifier: + minMaxSlider0: {x: 0, y: 0.5} + nest1: + minMaxSlider1: {x: 0.25, y: 0.75} + nest2: + minMaxSlider2: {x: 6, y: 11} +--- !u!1 &706445688 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 706445689} + - component: {fileID: 706445690} + m_Layer: 0 + m_Name: NaughtyComponent + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &706445689 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 706445688} + 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: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &706445690 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 706445688} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9c928ea15ae74a44089beb2e534c1a35, type: 3} + m_Name: + m_EditorClassIdentifier: + layerName: Default + layerIndex: 4 +--- !u!1 &732714203 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 732714204} + m_Layer: 0 + m_Name: ===== Meta Attributes ===== + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &732714204 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 732714203} + 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: 1148579784} + m_RootOrder: 20 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &779670086 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 779670087} + - component: {fileID: 779670088} + m_Layer: 0 + m_Name: Dropdown + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &779670087 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 779670086} + 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: 1148579784} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &779670088 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 779670086} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3855e37cd6b01194e8166573c7c4b37d, type: 3} + m_Name: + m_EditorClassIdentifier: + intValue: 1 + nest1: + stringValue: A + nest2: + vectorValue: {x: 1, y: 0, z: 0} +--- !u!1 &892661554 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 892661555} + - component: {fileID: 892661556} + m_Layer: 0 + m_Name: Scene + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &892661555 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 892661554} + 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: 1148579784} + m_RootOrder: 15 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &892661556 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 892661554} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 281a85803caf74a459439020a0840fa4, type: 3} + m_Name: + m_EditorClassIdentifier: + scene0: DemoScene + nest1: + scene1: DemoScene + nest2: + scene2: 0 +--- !u!1 &933563384 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 933563385} + - component: {fileID: 933563386} + m_Layer: 0 + m_Name: ShowAssetPreview + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &933563385 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 933563384} + 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: 1148579784} + m_RootOrder: 16 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &933563386 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 933563384} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 705c14aa9ecaa274289972381f471367, type: 3} + m_Name: + m_EditorClassIdentifier: + sprite0: {fileID: 21300000, guid: 005888ede18a58e4db8d069cfa3007cb, type: 3} + prefab0: {fileID: 1981131855061102, guid: 7ec354ef3daae7641b7a3fa5e1fe0c81, type: 3} + nest1: + sprite1: {fileID: 21300000, guid: 005888ede18a58e4db8d069cfa3007cb, type: 3} + prefab1: {fileID: 1981131855061102, guid: 7ec354ef3daae7641b7a3fa5e1fe0c81, type: 3} + nest2: + sprite2: {fileID: 21300000, guid: 005888ede18a58e4db8d069cfa3007cb, type: 3} + prefab2: {fileID: 1981131855061102, guid: 7ec354ef3daae7641b7a3fa5e1fe0c81, + type: 3} +--- !u!1 &948946033 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 948946034} + - component: {fileID: 948946035} + m_Layer: 0 + m_Name: ProgressBar + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &948946034 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 948946033} + 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: 1148579784} + m_RootOrder: 12 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &948946035 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 948946033} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 96ca4c27fc649764b9d1625f1740cb9e, type: 3} + m_Name: + m_EditorClassIdentifier: + health: 50 + nest1: + mana: 25 + nest2: + stamina: 75 + elixir: 50 + maxElixir: 100 +--- !u!1 &993534225 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 993534226} + - component: {fileID: 993534227} + m_Layer: 0 + m_Name: Layer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &993534226 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 993534225} + 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: 1148579784} + m_RootOrder: 10 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &993534227 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 993534225} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 460459d6ac76acd4d872f94cf444e6fa, type: 3} + m_Name: + m_EditorClassIdentifier: + layerNumber0: 5 + layerName0: UI + nest1: + layerNumber1: 0 + layerName1: Default + nest2: + layerNumber2: 4 + layerName2: Water +--- !u!1 &1139446979 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1139446980} + - component: {fileID: 1139446981} + m_Layer: 0 + m_Name: HorizontalLine + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1139446980 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1139446979} + 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: 1148579784} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1139446981 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1139446979} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5cc6d3f8d4a53374887b3d620a6972e3, type: 3} + m_Name: + m_EditorClassIdentifier: + line0: 0 + nest1: + line1: 0 + nest2: + line2: 0 +--- !u!1 &1148579783 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1148579784} + m_Layer: 0 + m_Name: Tests + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1148579784 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1148579783} + 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: + - {fileID: 106181863} + - {fileID: 1178133860} + - {fileID: 2043059161} + - {fileID: 2082563173} + - {fileID: 779670087} + - {fileID: 2015414598} + - {fileID: 1622801696} + - {fileID: 1139446980} + - {fileID: 1552114400} + - {fileID: 155697336} + - {fileID: 993534226} + - {fileID: 607441874} + - {fileID: 948946034} + - {fileID: 1747151588} + - {fileID: 1202167595} + - {fileID: 892661555} + - {fileID: 933563385} + - {fileID: 1989156459} + - {fileID: 1194502638} + - {fileID: 1380469385} + - {fileID: 732714204} + - {fileID: 1784643785} + - {fileID: 572382749} + - {fileID: 114650324} + - {fileID: 1524906391} + - {fileID: 1293624596} + - {fileID: 1871127830} + - {fileID: 237121641} + - {fileID: 1641427334} + - {fileID: 1706612702} + - {fileID: 369789277} + - {fileID: 1463483878} + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1178133859 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1178133860} + - component: {fileID: 1178133862} + - component: {fileID: 1178133861} + m_Layer: 0 + m_Name: AnimatorParam + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1178133860 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1178133859} + 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: 1148579784} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1178133861 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1178133859} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9bff20ccdde00fc49a62bad6a4ef9982, type: 3} + m_Name: + m_EditorClassIdentifier: + animator0: {fileID: 1178133862} + hash0: 1943738498 + name0: Float0 + nest1: + animator1: {fileID: 1178133862} + hash1: 726565755 + name1: Float0 + nest2: + animator2: {fileID: 1178133862} + hash1: -392453409 + name1: Trigger0 +--- !u!95 &1178133862 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1178133859} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 63ee86efd213bf34285c95f33e79dc6c, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!1 &1194502637 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1194502638} + - component: {fileID: 1194502639} + m_Layer: 0 + m_Name: ShowNonSerializedField + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1194502638 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194502637} + 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: 1148579784} + m_RootOrder: 18 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1194502639 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194502637} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 913d67a695253f744bdc776625b9b948, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1202167594 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1202167595} + - component: {fileID: 1202167596} + m_Layer: 0 + m_Name: ResizableTextArea + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1202167595 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1202167594} + 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: 1148579784} + m_RootOrder: 14 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1202167596 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1202167594} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fb4f4bb2e3e063340a24f4bb24528bb5, type: 3} + m_Name: + m_EditorClassIdentifier: + text0: '1 + + 2 + + 3' + nest1: + text1: '1 + + 2 + + 3 + + 4 + + 5' + nest2: + text2: '1 + + 2 + + 3 + + 4 + + 5 + + 6 + + 7' +--- !u!1 &1293624595 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1293624596} + - component: {fileID: 1293624597} + m_Layer: 0 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1293624596 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1293624595} + 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: 1148579784} + m_RootOrder: 25 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1293624597 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1293624595} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7488af014527ebf42af5c4fc4d5f4f5b, type: 3} + m_Name: + m_EditorClassIdentifier: + int0: 0 + nest1: + int1: 0 + nest2: + vector2: {x: 0.25, y: 0.75} +--- !u!1 &1380469384 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1380469385} + - component: {fileID: 1380469386} + m_Layer: 0 + m_Name: Tag + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1380469385 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380469384} + 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: 1148579784} + m_RootOrder: 19 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1380469386 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380469384} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8bcc0d5613b48fb43bd36c9d37e99900, type: 3} + m_Name: + m_EditorClassIdentifier: + tag0: + nest1: + tag1: MainCamera + nest2: + tag2: Player +--- !u!1 &1444377589 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1444377591} + - component: {fileID: 1444377590} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1444377590 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1444377589} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1444377591 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1444377589} + 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_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &1463483877 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1463483878} + - component: {fileID: 1463483879} + m_Layer: 0 + m_Name: ValidateInput + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1463483878 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1463483877} + 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: 1148579784} + m_RootOrder: 31 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1463483879 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1463483877} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 94adafcfe59aa344c9b5596b2cc6ecd0, type: 3} + m_Name: + m_EditorClassIdentifier: + int0: 0 + nest1: + int1: 0 + nest2: + int2: 0 +--- !u!1 &1524906390 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1524906391} + - component: {fileID: 1524906392} + - component: {fileID: 1524906393} + m_Layer: 0 + m_Name: ShowIf_HideIf + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1524906391 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1524906390} + 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: 1148579784} + m_RootOrder: 24 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1524906392 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1524906390} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4fdbfcfbf5b056a4bac491fe21569572, type: 3} + m_Name: + m_EditorClassIdentifier: + show1: 0 + show2: 0 + enum1: 0 + showIfAll: + showIfAny: + showIfEnum: + nest1: + show1: 1 + show2: 0 + enum1: 0 + showIfAll: 0 + showIfAny: 0 + showIfEnum: 0 + nest2: + show1: 1 + show2: 1 + enum1: 0 + showIfAll: {x: 0.25, y: 0.75} + showIfAny: {x: 0.25, y: 0.75} + showIfEnum: {x: 0.25, y: 0.75} +--- !u!114 &1524906393 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1524906390} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3cf166cb519e666419bb79b0c50c5ee1, type: 3} + m_Name: + m_EditorClassIdentifier: + hide1: 0 + hide2: 0 + enum1: 0 + hideIfAll: + hideIfAny: + hideIfEnum: + nest1: + hide1: 1 + hide2: 0 + enum1: 0 + hideIfAll: 0 + hideIfAny: 0 + hideIfEnum: 0 + nest2: + hide1: 1 + hide2: 1 + enum1: 0 + hideIfAll: {x: 0.25, y: 0.75} + hideIfAny: {x: 0.25, y: 0.75} + hideIfEnum: {x: 0.25, y: 0.75} +--- !u!1 &1552114399 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1552114400} + - component: {fileID: 1552114401} + m_Layer: 0 + m_Name: InfoBox + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1552114400 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1552114399} + 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: 1148579784} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1552114401 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1552114399} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0dcb08e489c17644e9eacaa1ec5fe781, type: 3} + m_Name: + m_EditorClassIdentifier: + normal: 0 + nest1: + warning: 0 + nest2: + error: 0 +--- !u!1 &1591883662 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1591883666} + - component: {fileID: 1591883665} + - component: {fileID: 1591883664} + - component: {fileID: 1591883663} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1591883663 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1591883662} + m_Enabled: 1 +--- !u!124 &1591883664 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1591883662} + m_Enabled: 1 +--- !u!20 &1591883665 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1591883662} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1591883666 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1591883662} + 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_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1622801695 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1622801696} + - component: {fileID: 1622801697} + m_Layer: 0 + m_Name: Expandable + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1622801696 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1622801695} + 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: 1148579784} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1622801697 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1622801695} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 64c4c9aee2b494d44be9bb0b7f12ed7c, type: 3} + m_Name: + m_EditorClassIdentifier: + obj0: {fileID: 11400000, guid: 9cf80899b80517945a2d2390fb48877f, type: 2} + nest1: + obj1: {fileID: 11400000, guid: 9cf80899b80517945a2d2390fb48877f, type: 2} + nest2: + obj2: {fileID: 11400000, guid: 9cf80899b80517945a2d2390fb48877f, type: 2} +--- !u!1 &1641427333 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1641427334} + m_Layer: 0 + m_Name: ===== Validator Attributes ===== + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1641427334 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1641427333} + 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: 1148579784} + m_RootOrder: 28 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1706612701 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1706612702} + - component: {fileID: 1706612703} + m_Layer: 0 + m_Name: MinValue_MaxValue + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1706612702 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1706612701} + 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: 1148579784} + m_RootOrder: 29 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1706612703 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1706612701} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 450a05787c54e6b4fa88ffe223bcee87, type: 3} + m_Name: + m_EditorClassIdentifier: + min0Int: 0 + max0Int: 0 + range01Float: 0 + range01Vector2: {x: 0, y: 0} + range01Vector3: {x: 0, y: 0, z: 0} + range01Vector4: {x: 0, y: 0, z: 0, w: 0} + min0Vector2Int: {x: 0, y: 0} + max100Vector2Int: {x: 0, y: 0} + min0Vector3Int: {x: 0, y: 0, z: 0} + max100Vector3Int: {x: 0, y: 0, z: 0} + nest1: + min0Int: 0 + max0Int: 0 + range01Float: 0 + range01Vector2: {x: 0, y: 0} + range01Vector3: {x: 0, y: 0, z: 0} + range01Vector4: {x: 0, y: 0, z: 0, w: 0} + min0Vector2Int: {x: 0, y: 0} + max100Vector2Int: {x: 0, y: 0} + min0Vector3Int: {x: 0, y: 0, z: 0} + max100Vector3Int: {x: 0, y: 0, z: 0} + nest2: + min0Int: 0 + max0Int: 0 + range01Float: 0 + range01Vector2: {x: 0, y: 0} + range01Vector3: {x: 0, y: 0, z: 0} + range01Vector4: {x: 0, y: 0, z: 0, w: 0} + min0Vector2Int: {x: 0, y: 0} + max100Vector2Int: {x: 0, y: 0} + min0Vector3Int: {x: 0, y: 0, z: 0} + max100Vector3Int: {x: 0, y: 0, z: 0} +--- !u!1 &1747151587 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1747151588} + - component: {fileID: 1747151589} + m_Layer: 0 + m_Name: ReorderableList + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1747151588 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1747151587} + 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: 1148579784} + m_RootOrder: 13 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1747151589 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1747151587} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c93fde7cd79390148ac576c3a159a77b, type: 3} + m_Name: + m_EditorClassIdentifier: + intArray: 020000000300000001000000 + vectorList: + - {x: 2, y: 2, z: 2} + - {x: 3, y: 3, z: 3} + - {x: 1, y: 1, z: 1} + structList: + - Int: 2 + Float: 2 + Vector: {x: 2, y: 2, z: 2} + - Int: 3 + Float: 3 + Vector: {x: 3, y: 3, z: 3} + - Int: 1 + Float: 1 + Vector: {x: 1, y: 1, z: 1} + gameObjectsList: [] + transformsList: [] + monoBehavioursList: [] +--- !u!1 &1784643784 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1784643785} + - component: {fileID: 1784643786} + m_Layer: 0 + m_Name: BoxGroup + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1784643785 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1784643784} + 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: 1148579784} + m_RootOrder: 21 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1784643786 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1784643784} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3920f5ea384951b4990e4d9e8032d12e, type: 3} + m_Name: + m_EditorClassIdentifier: + int0: 0 + int1: 0 + float0: 0 + float1: 0 + slider0: {x: 0.25, y: 0.75} + slider1: {x: 0.25, y: 0.75} + str0: + str1: + trans0: {fileID: 0} + trans1: {fileID: 0} +--- !u!1 &1871127829 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1871127830} + - component: {fileID: 1871127831} + m_Layer: 0 + m_Name: OnValueChanged + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1871127830 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1871127829} + 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: 1148579784} + m_RootOrder: 26 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1871127831 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1871127829} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ff1df679e5b32f64bb106752c63933fa, type: 3} + m_Name: + m_EditorClassIdentifier: + int0: 0 + nest1: + int1: 0 + nest2: + int2: 0 +--- !u!1 &1989156458 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1989156459} + - component: {fileID: 1989156460} + m_Layer: 0 + m_Name: ShowNativeProperty + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1989156459 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1989156458} + 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: 1148579784} + m_RootOrder: 17 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1989156460 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1989156458} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b5a73795d25dd334e90a5a347c6079d9, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &2015414597 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2015414598} + - component: {fileID: 2015414599} + m_Layer: 0 + m_Name: EnumFlags + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2015414598 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2015414597} + 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: 1148579784} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2015414599 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2015414597} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7b7f6b84ce0d7674d8a386fde729279c, type: 3} + m_Name: + m_EditorClassIdentifier: + flags0: 0 + nest1: + flags1: 6 + nest2: + flags2: -1 +--- !u!1 &2043059160 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2043059161} + - component: {fileID: 2043059162} + m_Layer: 0 + m_Name: Button + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2043059161 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2043059160} + 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: 1148579784} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2043059162 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2043059160} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b592f12a9f69ac3408f6f870762232c7, type: 3} + m_Name: + m_EditorClassIdentifier: + myInt: 0 +--- !u!1 &2082563172 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2082563173} + - component: {fileID: 2082563174} + m_Layer: 0 + m_Name: CurveRange + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2082563173 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2082563172} + 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: 1148579784} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2082563174 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2082563172} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6587b100d001e7e46b9aaae7f1180b40, type: 3} + m_Name: + m_EditorClassIdentifier: + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: -1 + value: -1 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curve1: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curve2: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 10 + value: 10 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + nest1: + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + nest2: + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 5 + value: 5 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 diff --git a/Assets/NaughtyAttributes/Samples/DemoScene/DemoScene.unity.meta b/Assets/NaughtyAttributes/Samples/DemoScene/DemoScene.unity.meta new file mode 100644 index 0000000..e76127e --- /dev/null +++ b/Assets/NaughtyAttributes/Samples/DemoScene/DemoScene.unity.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 07845a5477be2b149a6f1cb32b5a3a5b +timeCreated: 1507998788 +licenseType: Store +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Samples/DemoScene/DemoSceneSettings.lighting b/Assets/NaughtyAttributes/Samples/DemoScene/DemoSceneSettings.lighting new file mode 100644 index 0000000..a88ae38 --- /dev/null +++ b/Assets/NaughtyAttributes/Samples/DemoScene/DemoSceneSettings.lighting @@ -0,0 +1,63 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!850595691 &4890085278179872738 +LightingSettings: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: DemoSceneSettings + serializedVersion: 2 + m_GIWorkflowMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_RealtimeEnvironmentLighting: 1 + m_BounceScale: 1 + m_AlbedoBoost: 1 + m_IndirectOutputScale: 1 + m_UsingShadowmask: 1 + m_BakeBackend: 0 + m_LightmapMaxSize: 1024 + m_BakeResolution: 40 + m_Padding: 2 + m_TextureCompression: 1 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAO: 0 + m_MixedBakeMode: 2 + m_LightmapsBakeMode: 1 + m_FilterMode: 1 + m_LightmapParameters: {fileID: 0} + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_RealtimeResolution: 2 + m_ForceWhiteAlbedo: 0 + m_ForceUpdates: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 256 + m_FinalGatherFiltering: 1 + m_PVRCulling: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVREnvironmentSampleCount: 500 + m_PVREnvironmentReferencePointCount: 2048 + m_LightProbeSampleCountMultiplier: 4 + m_PVRBounces: 2 + m_PVRRussianRouletteStartBounce: 2 + m_PVREnvironmentMIS: 0 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 diff --git a/Assets/NaughtyAttributes/Samples/DemoScene/DemoSceneSettings.lighting.meta b/Assets/NaughtyAttributes/Samples/DemoScene/DemoSceneSettings.lighting.meta new file mode 100644 index 0000000..3af7b5e --- /dev/null +++ b/Assets/NaughtyAttributes/Samples/DemoScene/DemoSceneSettings.lighting.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 98ee975b74776234986f4d35f14c4ccc +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets.meta b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets.meta new file mode 100644 index 0000000..d4b6a19 --- /dev/null +++ b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 53a462744f22ca549927c5e6ea797362 +folderAsset: yes +timeCreated: 1509089305 +licenseType: Store +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/Cube.prefab b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/Cube.prefab new file mode 100644 index 0000000..64055f6 --- /dev/null +++ b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/Cube.prefab @@ -0,0 +1,93 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1981131855061102 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4344736110947706} + - component: {fileID: 33062901823624450} + - component: {fileID: 65233182844289960} + - component: {fileID: 23099360439063292} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4344736110947706 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1981131855061102} + 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!33 &33062901823624450 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1981131855061102} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!65 &65233182844289960 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1981131855061102} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &23099360439063292 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1981131855061102} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 diff --git a/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/Cube.prefab.meta b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/Cube.prefab.meta new file mode 100644 index 0000000..5f6520a --- /dev/null +++ b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/Cube.prefab.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 7ec354ef3daae7641b7a3fa5e1fe0c81 +timeCreated: 1509089337 +licenseType: Store +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimation.anim b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimation.anim new file mode 100644 index 0000000..9536161 --- /dev/null +++ b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimation.anim @@ -0,0 +1,169 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: DummyAnimation + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: {x: 0, y: 0, z: 0} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 1 + value: {x: 0, y: 0, z: 0} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: + m_ScaleCurves: [] + m_FloatCurves: [] + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.x + path: + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.y + path: + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.z + path: + classID: 4 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 1 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimation.anim.meta b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimation.anim.meta new file mode 100644 index 0000000..d66e3b6 --- /dev/null +++ b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimation.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 31fbd6c92d19aaa48910857627a54a25 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimatorController.controller b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimatorController.controller new file mode 100644 index 0000000..bb64cae --- /dev/null +++ b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimatorController.controller @@ -0,0 +1,120 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-1567792821050049497 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: DummyAnimation + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 31fbd6c92d19aaa48910857627a54a25, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: DummyAnimatorController + serializedVersion: 5 + m_AnimatorParameters: + - m_Name: Float0 + m_Type: 1 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 9100000} + - m_Name: Float1 + m_Type: 1 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 9100000} + - m_Name: Int0 + m_Type: 3 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 9100000} + - m_Name: Int1 + m_Type: 3 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 9100000} + - m_Name: Bool0 + m_Type: 4 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 9100000} + - m_Name: Bool1 + m_Type: 4 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 9100000} + - m_Name: Trigger0 + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 9100000} + - m_Name: Trigger1 + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 9100000} + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 945276690032550857} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &945276690032550857 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -1567792821050049497} + m_Position: {x: 390, y: 80, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -1567792821050049497} diff --git a/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimatorController.controller.meta b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimatorController.controller.meta new file mode 100644 index 0000000..2ce8a9c --- /dev/null +++ b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimatorController.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 63ee86efd213bf34285c95f33e79dc6c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/NaughtyScriptableObject.asset b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/NaughtyScriptableObject.asset new file mode 100644 index 0000000..ce97939 --- /dev/null +++ b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/NaughtyScriptableObject.asset @@ -0,0 +1,18 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 753bdb918c6038142acddbd7aae6958f, type: 3} + m_Name: NaughtyScriptableObject + m_EditorClassIdentifier: + list: + - {fileID: 11400000, guid: 149474eb879a6a641b560ca17d48712f, type: 2} + - {fileID: 11400000, guid: ca97c330d5c96794aa4df848d63f836b, type: 2} + - {fileID: 0} diff --git a/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/NaughtyScriptableObject.asset.meta b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/NaughtyScriptableObject.asset.meta new file mode 100644 index 0000000..0734977 --- /dev/null +++ b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/NaughtyScriptableObject.asset.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 9cf80899b80517945a2d2390fb48877f +timeCreated: 1518639643 +licenseType: Store +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObject 0.asset b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObject 0.asset new file mode 100644 index 0000000..caf7890 --- /dev/null +++ b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObject 0.asset @@ -0,0 +1,17 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 19472ac11eae27a4b804f354ca7d9c00, type: 3} + m_Name: TestScriptableObject 0 + m_EditorClassIdentifier: + integer: 0 + minMaxSlider: {x: 0, y: 0.5} + vectorValue: {x: 1, y: 0, z: 0} diff --git a/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObject 0.asset.meta b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObject 0.asset.meta new file mode 100644 index 0000000..3143872 --- /dev/null +++ b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObject 0.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 149474eb879a6a641b560ca17d48712f +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObject 1.asset b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObject 1.asset new file mode 100644 index 0000000..291108d --- /dev/null +++ b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObject 1.asset @@ -0,0 +1,16 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 19472ac11eae27a4b804f354ca7d9c00, type: 3} + m_Name: TestScriptableObject 1 + m_EditorClassIdentifier: + minMaxSlider: {x: 0.5, y: 1} + vectorValue: {x: 0, y: 1, z: 0} diff --git a/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObject 1.asset.meta b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObject 1.asset.meta new file mode 100644 index 0000000..19861d0 --- /dev/null +++ b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObject 1.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ca97c330d5c96794aa4df848d63f836b +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/icon-github.png b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/icon-github.png new file mode 100644 index 0000000..ca69437 --- /dev/null +++ b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/icon-github.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:da92c69e117a161424b18ed019084fcb5fcfe7e282517036e000dac05cd1a29a +size 29968 diff --git a/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/icon-github.png.meta b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/icon-github.png.meta new file mode 100644 index 0000000..c92bc5d --- /dev/null +++ b/Assets/NaughtyAttributes/Samples/DemoScene/TestAssets/icon-github.png.meta @@ -0,0 +1,127 @@ +fileFormatVersion: 2 +guid: 005888ede18a58e4db8d069cfa3007cb +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts.meta b/Assets/NaughtyAttributes/Scripts.meta new file mode 100644 index 0000000..30b4bb8 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 66686847ee1fa044bb15dfe473666178 +folderAsset: yes +timeCreated: 1507995546 +licenseType: Store +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core.meta b/Assets/NaughtyAttributes/Scripts/Core.meta new file mode 100644 index 0000000..f1fc782 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 1f67e408a6d0adf4ab29d095ccd8b116 +folderAsset: yes +timeCreated: 1507998942 +licenseType: Store +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes.meta new file mode 100644 index 0000000..132a3c2 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c76425e719cd4424d868674bcfb233f2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/AllowNestingAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/AllowNestingAttribute.cs new file mode 100644 index 0000000..b7abb8c --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/AllowNestingAttribute.cs @@ -0,0 +1,9 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class AllowNestingAttribute : DrawerAttribute + { + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/AllowNestingAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/AllowNestingAttribute.cs.meta new file mode 100644 index 0000000..343dfec --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/AllowNestingAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 95b49d3abe880c044adbe7faf6b7b4ec +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/AnimatorParamAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/AnimatorParamAttribute.cs new file mode 100644 index 0000000..e8d9c2a --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/AnimatorParamAttribute.cs @@ -0,0 +1,24 @@ +using System; +using UnityEngine; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class AnimatorParamAttribute : DrawerAttribute + { + public string AnimatorName { get; private set; } + public AnimatorControllerParameterType? AnimatorParamType { get; private set; } + + public AnimatorParamAttribute(string animatorName) + { + AnimatorName = animatorName; + AnimatorParamType = null; + } + + public AnimatorParamAttribute(string animatorName, AnimatorControllerParameterType animatorParamType) + { + AnimatorName = animatorName; + AnimatorParamType = animatorParamType; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/AnimatorParamAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/AnimatorParamAttribute.cs.meta new file mode 100644 index 0000000..db61add --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/AnimatorParamAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7373332cb77b42744a415d6b4add445d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/CurveRangeAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/CurveRangeAttribute.cs new file mode 100644 index 0000000..3e48717 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/CurveRangeAttribute.cs @@ -0,0 +1,30 @@ +using System; +using UnityEngine; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class CurveRangeAttribute : DrawerAttribute + { + public Vector2 Min { get; private set; } + public Vector2 Max { get; private set; } + public EColor Color { get; private set; } + + public CurveRangeAttribute(Vector2 min, Vector2 max, EColor color = EColor.Clear) + { + Min = min; + Max = max; + Color = color; + } + + public CurveRangeAttribute(EColor color) + : this(Vector2.zero, Vector2.one, color) + { + } + + public CurveRangeAttribute(float minX, float minY, float maxX, float maxY, EColor color = EColor.Clear) + : this(new Vector2(minX, minY), new Vector2(maxX, maxY), color) + { + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/CurveRangeAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/CurveRangeAttribute.cs.meta new file mode 100644 index 0000000..93b60ab --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/CurveRangeAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bbdf3fb8882c7514c9a01108122cda7e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/DrawerAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/DrawerAttribute.cs new file mode 100644 index 0000000..92e28d5 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/DrawerAttribute.cs @@ -0,0 +1,11 @@ +using UnityEngine; + +namespace NaughtyAttributes +{ + /// + /// Base class for all drawer attributes + /// + public class DrawerAttribute : PropertyAttribute, INaughtyAttribute + { + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/DrawerAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/DrawerAttribute.cs.meta new file mode 100644 index 0000000..aa54215 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/DrawerAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9df37fdebccf65c4da5b0a14f6dad5f5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/DropdownAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/DropdownAttribute.cs new file mode 100644 index 0000000..2bf4702 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/DropdownAttribute.cs @@ -0,0 +1,57 @@ +using System.Collections; +using System; +using System.Collections.Generic; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class DropdownAttribute : DrawerAttribute + { + public string ValuesName { get; private set; } + + public DropdownAttribute(string valuesName) + { + ValuesName = valuesName; + } + } + + public interface IDropdownList : IEnumerable> + { + } + + public class DropdownList : IDropdownList + { + private List> _values; + + public DropdownList() + { + _values = new List>(); + } + + public void Add(string displayName, T value) + { + _values.Add(new KeyValuePair(displayName, value)); + } + + public IEnumerator> GetEnumerator() + { + return _values.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public static explicit operator DropdownList(DropdownList target) + { + DropdownList result = new DropdownList(); + foreach (var kvp in target) + { + result.Add(kvp.Key, kvp.Value); + } + + return result; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/DropdownAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/DropdownAttribute.cs.meta new file mode 100644 index 0000000..b25926d --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/DropdownAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2cb864a1092cec04f8a4dbb556e8ed31 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/EnumFlagsAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/EnumFlagsAttribute.cs new file mode 100644 index 0000000..81aab8e --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/EnumFlagsAttribute.cs @@ -0,0 +1,9 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class EnumFlagsAttribute : DrawerAttribute + { + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/EnumFlagsAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/EnumFlagsAttribute.cs.meta new file mode 100644 index 0000000..25a52af --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/EnumFlagsAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e8b31eb6d7299e54d89dcabc4cad0e6a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/Expandable.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/Expandable.cs new file mode 100644 index 0000000..83d522e --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/Expandable.cs @@ -0,0 +1,9 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class ExpandableAttribute : DrawerAttribute + { + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/Expandable.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/Expandable.cs.meta new file mode 100644 index 0000000..8fa04e4 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/Expandable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 60926d6ca7f9ced469e9248ff1192da6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/HorizontalLineAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/HorizontalLineAttribute.cs new file mode 100644 index 0000000..a3681bb --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/HorizontalLineAttribute.cs @@ -0,0 +1,20 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)] + public class HorizontalLineAttribute : DrawerAttribute + { + public const float DefaultHeight = 2.0f; + public const EColor DefaultColor = EColor.Gray; + + public float Height { get; private set; } + public EColor Color { get; private set; } + + public HorizontalLineAttribute(float height = DefaultHeight, EColor color = DefaultColor) + { + Height = height; + Color = color; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/HorizontalLineAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/HorizontalLineAttribute.cs.meta new file mode 100644 index 0000000..ecfd258 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/HorizontalLineAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2fdd6f99acca2fd42a4f3162d585ce95 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/InfoBoxAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/InfoBoxAttribute.cs new file mode 100644 index 0000000..cd66aab --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/InfoBoxAttribute.cs @@ -0,0 +1,24 @@ +using System; + +namespace NaughtyAttributes +{ + public enum EInfoBoxType + { + Normal, + Warning, + Error + } + + [AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)] + public class InfoBoxAttribute : DrawerAttribute + { + public string Text { get; private set; } + public EInfoBoxType Type { get; private set; } + + public InfoBoxAttribute(string text, EInfoBoxType type = EInfoBoxType.Normal) + { + Text = text; + Type = type; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/InfoBoxAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/InfoBoxAttribute.cs.meta new file mode 100644 index 0000000..8748a6e --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/InfoBoxAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: afd1d6323740c734893fa8397c53113b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/InputAxisAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/InputAxisAttribute.cs new file mode 100644 index 0000000..db74147 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/InputAxisAttribute.cs @@ -0,0 +1,9 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class InputAxisAttribute : DrawerAttribute + { + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/InputAxisAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/InputAxisAttribute.cs.meta new file mode 100644 index 0000000..da3b2c4 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/InputAxisAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 85033978c18810f46af271bbe94cf4aa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/LayerAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/LayerAttribute.cs new file mode 100644 index 0000000..6f56200 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/LayerAttribute.cs @@ -0,0 +1,9 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class LayerAttribute : DrawerAttribute + { + } +} \ No newline at end of file diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/LayerAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/LayerAttribute.cs.meta new file mode 100644 index 0000000..93d97f7 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/LayerAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 668d19ebe071176448d1af816a9a0ce0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/MinMaxSliderAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/MinMaxSliderAttribute.cs new file mode 100644 index 0000000..4f93921 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/MinMaxSliderAttribute.cs @@ -0,0 +1,17 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class MinMaxSliderAttribute : DrawerAttribute + { + public float MinValue { get; private set; } + public float MaxValue { get; private set; } + + public MinMaxSliderAttribute(float minValue, float maxValue) + { + MinValue = minValue; + MaxValue = maxValue; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/MinMaxSliderAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/MinMaxSliderAttribute.cs.meta new file mode 100644 index 0000000..03e5dcf --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/MinMaxSliderAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4aaa73f574deaa54187cb54aae571b24 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ProgressBarAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ProgressBarAttribute.cs new file mode 100644 index 0000000..39344a0 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ProgressBarAttribute.cs @@ -0,0 +1,37 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class ProgressBarAttribute : DrawerAttribute + { + public string Name { get; private set; } + public float MaxValue { get; set; } + public string MaxValueName { get; private set; } + public EColor Color { get; private set; } + + public ProgressBarAttribute(string name, float maxValue, EColor color = EColor.Blue) + { + Name = name; + MaxValue = maxValue; + Color = color; + } + + public ProgressBarAttribute(string name, string maxValueName, EColor color = EColor.Blue) + { + Name = name; + MaxValueName = maxValueName; + Color = color; + } + + public ProgressBarAttribute(float maxValue, EColor color = EColor.Blue) + : this("", maxValue, color) + { + } + + public ProgressBarAttribute(string maxValueName, EColor color = EColor.Blue) + : this("", maxValueName, color) + { + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ProgressBarAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ProgressBarAttribute.cs.meta new file mode 100644 index 0000000..11029f0 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ProgressBarAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e19e4db6f4d08f849aa8ea8155cd2760 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ResizableTextAreaAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ResizableTextAreaAttribute.cs new file mode 100644 index 0000000..1c5eddc --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ResizableTextAreaAttribute.cs @@ -0,0 +1,9 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class ResizableTextAreaAttribute : DrawerAttribute + { + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ResizableTextAreaAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ResizableTextAreaAttribute.cs.meta new file mode 100644 index 0000000..cc11d00 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ResizableTextAreaAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 56d9a4b795ef4a94d86b94e55fb81240 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/SceneAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/SceneAttribute.cs new file mode 100644 index 0000000..215ba6c --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/SceneAttribute.cs @@ -0,0 +1,9 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class SceneAttribute : DrawerAttribute + { + } +} \ No newline at end of file diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/SceneAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/SceneAttribute.cs.meta new file mode 100644 index 0000000..f22649b --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/SceneAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e054de18423364f4688b72a0f2a472b6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ShowAssetPreviewAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ShowAssetPreviewAttribute.cs new file mode 100644 index 0000000..75654b0 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ShowAssetPreviewAttribute.cs @@ -0,0 +1,20 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class ShowAssetPreviewAttribute : DrawerAttribute + { + public const int DefaultWidth = 64; + public const int DefaultHeight = 64; + + public int Width { get; private set; } + public int Height { get; private set; } + + public ShowAssetPreviewAttribute(int width = DefaultWidth, int height = DefaultHeight) + { + Width = width; + Height = height; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ShowAssetPreviewAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ShowAssetPreviewAttribute.cs.meta new file mode 100644 index 0000000..4893b92 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/ShowAssetPreviewAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4b7dd9b44abc0054cb5cd68d74be2c1a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/TagAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/TagAttribute.cs new file mode 100644 index 0000000..200374e --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/TagAttribute.cs @@ -0,0 +1,9 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class TagAttribute : DrawerAttribute + { + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/TagAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/TagAttribute.cs.meta new file mode 100644 index 0000000..618033c --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes/TagAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8903399bbd7c9d745a7b9188ab6c8320 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase.meta new file mode 100644 index 0000000..3096ac4 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5cf879ed72221e740a7aa02ef9c366a7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ButtonAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ButtonAttribute.cs new file mode 100644 index 0000000..1488d63 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ButtonAttribute.cs @@ -0,0 +1,33 @@ +using System; + +namespace NaughtyAttributes +{ + public enum EButtonEnableMode + { + /// + /// Button should be active always + /// + Always, + /// + /// Button should be active only in editor + /// + Editor, + /// + /// Button should be active only in playmode + /// + Playmode + } + + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)] + public class ButtonAttribute : SpecialCaseDrawerAttribute + { + public string Text { get; private set; } + public EButtonEnableMode SelectedEnableMode { get; private set; } + + public ButtonAttribute(string text = null, EButtonEnableMode enabledMode = EButtonEnableMode.Always) + { + this.Text = text; + this.SelectedEnableMode = enabledMode; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ButtonAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ButtonAttribute.cs.meta new file mode 100644 index 0000000..cc7be5c --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ButtonAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e8fe363a25ec5e24a9dd510bb0b4a0d4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ReorderableListAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ReorderableListAttribute.cs new file mode 100644 index 0000000..43ae334 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ReorderableListAttribute.cs @@ -0,0 +1,9 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class ReorderableListAttribute : SpecialCaseDrawerAttribute + { + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ReorderableListAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ReorderableListAttribute.cs.meta new file mode 100644 index 0000000..add3c4a --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ReorderableListAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6189b48f4055e6c47aa132632d898fa6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNativePropertyAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNativePropertyAttribute.cs new file mode 100644 index 0000000..e3b9376 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNativePropertyAttribute.cs @@ -0,0 +1,9 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] + public class ShowNativePropertyAttribute : SpecialCaseDrawerAttribute + { + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNativePropertyAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNativePropertyAttribute.cs.meta new file mode 100644 index 0000000..5aed9a2 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNativePropertyAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a8e9b7b71c94a1f459336a24cfe04b1b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNonSerializedFieldAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNonSerializedFieldAttribute.cs new file mode 100644 index 0000000..9bf0609 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNonSerializedFieldAttribute.cs @@ -0,0 +1,9 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class ShowNonSerializedFieldAttribute : SpecialCaseDrawerAttribute + { + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNonSerializedFieldAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNonSerializedFieldAttribute.cs.meta new file mode 100644 index 0000000..84d5624 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNonSerializedFieldAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8ea09f60df536734184a8920ff8bda6f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/SpecialCaseDrawerAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/SpecialCaseDrawerAttribute.cs new file mode 100644 index 0000000..e71be81 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/SpecialCaseDrawerAttribute.cs @@ -0,0 +1,8 @@ +using System; + +namespace NaughtyAttributes +{ + public class SpecialCaseDrawerAttribute : Attribute, INaughtyAttribute + { + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/SpecialCaseDrawerAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/SpecialCaseDrawerAttribute.cs.meta new file mode 100644 index 0000000..3b4bd25 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/SpecialCaseDrawerAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 95a59093f8ed1af48a8be75fa3050a3c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/INaughtyAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/INaughtyAttribute.cs new file mode 100644 index 0000000..b67ba03 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/INaughtyAttribute.cs @@ -0,0 +1,8 @@ +using System; + +namespace NaughtyAttributes +{ + public interface INaughtyAttribute + { + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/INaughtyAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/INaughtyAttribute.cs.meta new file mode 100644 index 0000000..e2dd9d9 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/INaughtyAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: edda855906d15e541b46efd812fd70f3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes.meta b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes.meta new file mode 100644 index 0000000..547f24d --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 64c95d02a2004854585e8d923d6680d0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/BoxGroupAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/BoxGroupAttribute.cs new file mode 100644 index 0000000..23d7e00 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/BoxGroupAttribute.cs @@ -0,0 +1,15 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class BoxGroupAttribute : MetaAttribute, IGroupAttribute + { + public string Name { get; private set; } + + public BoxGroupAttribute(string name = "") + { + Name = name; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/BoxGroupAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/BoxGroupAttribute.cs.meta new file mode 100644 index 0000000..d68d8de --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/BoxGroupAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 07da8af1e3be52c4789678bf4138ae11 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/DisableIfAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/DisableIfAttribute.cs new file mode 100644 index 0000000..68c92b4 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/DisableIfAttribute.cs @@ -0,0 +1,26 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] + public class DisableIfAttribute : EnableIfAttributeBase + { + public DisableIfAttribute(string condition) + : base(condition) + { + Inverted = true; + } + + public DisableIfAttribute(EConditionOperator conditionOperator, params string[] conditions) + : base(conditionOperator, conditions) + { + Inverted = true; + } + + public DisableIfAttribute(string enumName, object enumValue) + : base(enumName, enumValue as Enum) + { + Inverted = true; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/DisableIfAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/DisableIfAttribute.cs.meta new file mode 100644 index 0000000..b91dc52 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/DisableIfAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 52a0d5c249ac8fd42a4fb4d61bc2f797 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttribute.cs new file mode 100644 index 0000000..e22afdf --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttribute.cs @@ -0,0 +1,26 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] + public class EnableIfAttribute : EnableIfAttributeBase + { + public EnableIfAttribute(string condition) + : base(condition) + { + Inverted = false; + } + + public EnableIfAttribute(EConditionOperator conditionOperator, params string[] conditions) + : base(conditionOperator, conditions) + { + Inverted = false; + } + + public EnableIfAttribute(string enumName, object enumValue) + : base(enumName, enumValue as Enum) + { + Inverted = false; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttribute.cs.meta new file mode 100644 index 0000000..f3a696c --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a616ae826c8ebae45a89d6a8cb68a843 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttributeBase.cs b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttributeBase.cs new file mode 100644 index 0000000..3e6d667 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttributeBase.cs @@ -0,0 +1,39 @@ +using System; + +namespace NaughtyAttributes +{ + public abstract class EnableIfAttributeBase : MetaAttribute + { + public string[] Conditions { get; private set; } + public EConditionOperator ConditionOperator { get; private set; } + public bool Inverted { get; protected set; } + + /// + /// If this not null, [0] is name of an enum variable. + /// + public Enum EnumValue { get; private set; } + + public EnableIfAttributeBase(string condition) + { + ConditionOperator = EConditionOperator.And; + Conditions = new string[1] { condition }; + } + + public EnableIfAttributeBase(EConditionOperator conditionOperator, params string[] conditions) + { + ConditionOperator = conditionOperator; + Conditions = conditions; + } + + public EnableIfAttributeBase(string enumName, Enum enumValue) + : this(enumName) + { + if (enumValue == null) + { + throw new ArgumentNullException(nameof(enumValue), "This parameter must be an enum value."); + } + + EnumValue = enumValue; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttributeBase.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttributeBase.cs.meta new file mode 100644 index 0000000..45fd5eb --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttributeBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8ba6385cd022e164b89ead1937173ddc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/FoldoutAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/FoldoutAttribute.cs new file mode 100644 index 0000000..cf20f17 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/FoldoutAttribute.cs @@ -0,0 +1,15 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class FoldoutAttribute : MetaAttribute, IGroupAttribute + { + public string Name { get; private set; } + + public FoldoutAttribute(string name) + { + Name = name; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/FoldoutAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/FoldoutAttribute.cs.meta new file mode 100644 index 0000000..e39736b --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/FoldoutAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 95f184555d5079243b2d25b35a641a74 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/HideIfAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/HideIfAttribute.cs new file mode 100644 index 0000000..0f8533e --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/HideIfAttribute.cs @@ -0,0 +1,26 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] + public class HideIfAttribute : ShowIfAttributeBase + { + public HideIfAttribute(string condition) + : base(condition) + { + Inverted = true; + } + + public HideIfAttribute(EConditionOperator conditionOperator, params string[] conditions) + : base(conditionOperator, conditions) + { + Inverted = true; + } + + public HideIfAttribute(string enumName, object enumValue) + : base(enumName, enumValue as Enum) + { + Inverted = true; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/HideIfAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/HideIfAttribute.cs.meta new file mode 100644 index 0000000..888cf89 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/HideIfAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9ab2d0fcfb13a214ea6ef7629c96a761 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/IGroupAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/IGroupAttribute.cs new file mode 100644 index 0000000..7c1ea76 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/IGroupAttribute.cs @@ -0,0 +1,8 @@ +using UnityEngine; + +namespace NaughtyAttributes +{ + public interface IGroupAttribute + { + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/IGroupAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/IGroupAttribute.cs.meta new file mode 100644 index 0000000..47db85d --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/IGroupAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7c437b9ac50575347a7b12520f37f9a2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/LabelAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/LabelAttribute.cs new file mode 100644 index 0000000..45e5d19 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/LabelAttribute.cs @@ -0,0 +1,15 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class LabelAttribute : MetaAttribute + { + public string Label { get; private set; } + + public LabelAttribute(string label) + { + Label = label; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/LabelAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/LabelAttribute.cs.meta new file mode 100644 index 0000000..9488d54 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/LabelAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 79e0e0c0a7c25ea4fbe8eecaa4d559a0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/MetaAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/MetaAttribute.cs new file mode 100644 index 0000000..b63026a --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/MetaAttribute.cs @@ -0,0 +1,8 @@ +using System; + +namespace NaughtyAttributes +{ + public class MetaAttribute : Attribute, INaughtyAttribute + { + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/MetaAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/MetaAttribute.cs.meta new file mode 100644 index 0000000..a7be132 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/MetaAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a482b4e0fbf0f4547a5d522182a68d24 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/OnValueChangedAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/OnValueChangedAttribute.cs new file mode 100644 index 0000000..fcbb187 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/OnValueChangedAttribute.cs @@ -0,0 +1,15 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)] + public class OnValueChangedAttribute : MetaAttribute + { + public string CallbackName { get; private set; } + + public OnValueChangedAttribute(string callbackName) + { + CallbackName = callbackName; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/OnValueChangedAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/OnValueChangedAttribute.cs.meta new file mode 100644 index 0000000..4a92c4b --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/OnValueChangedAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e16a27c5576022b4bbe997c7db9051f0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ReadOnlyAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ReadOnlyAttribute.cs new file mode 100644 index 0000000..78a4705 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ReadOnlyAttribute.cs @@ -0,0 +1,10 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class ReadOnlyAttribute : MetaAttribute + { + + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ReadOnlyAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ReadOnlyAttribute.cs.meta new file mode 100644 index 0000000..24ec846 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ReadOnlyAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e57264747ba93b94fbff12733de29499 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttribute.cs new file mode 100644 index 0000000..3d721da --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttribute.cs @@ -0,0 +1,26 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] + public class ShowIfAttribute : ShowIfAttributeBase + { + public ShowIfAttribute(string condition) + : base(condition) + { + Inverted = false; + } + + public ShowIfAttribute(EConditionOperator conditionOperator, params string[] conditions) + : base(conditionOperator, conditions) + { + Inverted = false; + } + + public ShowIfAttribute(string enumName, object enumValue) + : base(enumName, enumValue as Enum) + { + Inverted = false; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttribute.cs.meta new file mode 100644 index 0000000..4556ac2 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1ada427cfd2c9b04989d6d18dea27985 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttributeBase.cs b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttributeBase.cs new file mode 100644 index 0000000..8f76ed4 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttributeBase.cs @@ -0,0 +1,39 @@ +using System; + +namespace NaughtyAttributes +{ + public class ShowIfAttributeBase : MetaAttribute + { + public string[] Conditions { get; private set; } + public EConditionOperator ConditionOperator { get; private set; } + public bool Inverted { get; protected set; } + + /// + /// If this not null, [0] is name of an enum variable. + /// + public Enum EnumValue { get; private set; } + + public ShowIfAttributeBase(string condition) + { + ConditionOperator = EConditionOperator.And; + Conditions = new string[1] { condition }; + } + + public ShowIfAttributeBase(EConditionOperator conditionOperator, params string[] conditions) + { + ConditionOperator = conditionOperator; + Conditions = conditions; + } + + public ShowIfAttributeBase(string enumName, Enum enumValue) + : this(enumName) + { + if (enumValue == null) + { + throw new ArgumentNullException(nameof(enumValue), "This parameter must be an enum value."); + } + + EnumValue = enumValue; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttributeBase.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttributeBase.cs.meta new file mode 100644 index 0000000..e82a9ad --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttributeBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0532b1c4d8a9ccf4b9f98f0bbe4a6747 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/NaughtyAttributes.Core.asmdef b/Assets/NaughtyAttributes/Scripts/Core/NaughtyAttributes.Core.asmdef new file mode 100644 index 0000000..569e4e6 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/NaughtyAttributes.Core.asmdef @@ -0,0 +1,12 @@ +{ + "name": "NaughtyAttributes.Core", + "references": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [] +} \ No newline at end of file diff --git a/Assets/NaughtyAttributes/Scripts/Core/NaughtyAttributes.Core.asmdef.meta b/Assets/NaughtyAttributes/Scripts/Core/NaughtyAttributes.Core.asmdef.meta new file mode 100644 index 0000000..731749c --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/NaughtyAttributes.Core.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 776d03a35f1b52c4a9aed9f56d7b4229 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/Utility.meta b/Assets/NaughtyAttributes/Scripts/Core/Utility.meta new file mode 100644 index 0000000..80be476 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/Utility.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6d61a3a977073c740ae13a3683ed22a1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/Utility/EColor.cs b/Assets/NaughtyAttributes/Scripts/Core/Utility/EColor.cs new file mode 100644 index 0000000..f938b93 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/Utility/EColor.cs @@ -0,0 +1,56 @@ +using UnityEngine; + +namespace NaughtyAttributes +{ + public enum EColor + { + Clear, + White, + Black, + Gray, + Red, + Pink, + Orange, + Yellow, + Green, + Blue, + Indigo, + Violet + } + + public static class EColorExtensions + { + public static Color GetColor(this EColor color) + { + switch (color) + { + case EColor.Clear: + return new Color32(0, 0, 0, 0); + case EColor.White: + return new Color32(255, 255, 255, 255); + case EColor.Black: + return new Color32(0, 0, 0, 255); + case EColor.Gray: + return new Color32(128, 128, 128, 255); + case EColor.Red: + return new Color32(255, 0, 63, 255); + case EColor.Pink: + return new Color32(255, 152, 203, 255); + case EColor.Orange: + return new Color32(255, 128, 0, 255); + case EColor.Yellow: + return new Color32(255, 211, 0, 255); + case EColor.Green: + return new Color32(98, 200, 79, 255); + case EColor.Blue: + return new Color32(0, 135, 189, 255); + case EColor.Indigo: + return new Color32(75, 0, 130, 255); + case EColor.Violet: + return new Color32(128, 0, 255, 255); + default: + return new Color32(0, 0, 0, 255); + } + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/Utility/EColor.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/Utility/EColor.cs.meta new file mode 100644 index 0000000..0f32c5e --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/Utility/EColor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 059f8674a8065924ea9c678298b5cd63 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/Utility/EConditionOperator.cs b/Assets/NaughtyAttributes/Scripts/Core/Utility/EConditionOperator.cs new file mode 100644 index 0000000..9ff8c0a --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/Utility/EConditionOperator.cs @@ -0,0 +1,10 @@ +using System; + +namespace NaughtyAttributes +{ + public enum EConditionOperator + { + And, + Or + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/Utility/EConditionOperator.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/Utility/EConditionOperator.cs.meta new file mode 100644 index 0000000..60e3264 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/Utility/EConditionOperator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3c227b6c19fc67b46ad294d95818f85a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes.meta b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes.meta new file mode 100644 index 0000000..d5aba48 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bf91d63e37bed3e4cbf75d576fc03a21 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MaxValueAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MaxValueAttribute.cs new file mode 100644 index 0000000..62c1dc3 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MaxValueAttribute.cs @@ -0,0 +1,20 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class MaxValueAttribute : ValidatorAttribute + { + public float MaxValue { get; private set; } + + public MaxValueAttribute(float maxValue) + { + MaxValue = maxValue; + } + + public MaxValueAttribute(int maxValue) + { + MaxValue = maxValue; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MaxValueAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MaxValueAttribute.cs.meta new file mode 100644 index 0000000..b02fdbc --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MaxValueAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a748250af5ccfd7499cfb444aafb8a03 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MinValueAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MinValueAttribute.cs new file mode 100644 index 0000000..507c034 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MinValueAttribute.cs @@ -0,0 +1,20 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class MinValueAttribute : ValidatorAttribute + { + public float MinValue { get; private set; } + + public MinValueAttribute(float minValue) + { + MinValue = minValue; + } + + public MinValueAttribute(int minValue) + { + MinValue = minValue; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MinValueAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MinValueAttribute.cs.meta new file mode 100644 index 0000000..9d90191 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MinValueAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 40133bac7c8d42b4d837138430a503e0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/RequiredAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/RequiredAttribute.cs new file mode 100644 index 0000000..b1161a5 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/RequiredAttribute.cs @@ -0,0 +1,15 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class RequiredAttribute : ValidatorAttribute + { + public string Message { get; private set; } + + public RequiredAttribute(string message = null) + { + Message = message; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/RequiredAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/RequiredAttribute.cs.meta new file mode 100644 index 0000000..7f87cfc --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/RequiredAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b0cdf49d1687849458b1a8d4786553d4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidateInputAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidateInputAttribute.cs new file mode 100644 index 0000000..6a353c2 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidateInputAttribute.cs @@ -0,0 +1,17 @@ +using System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class ValidateInputAttribute : ValidatorAttribute + { + public string CallbackName { get; private set; } + public string Message { get; private set; } + + public ValidateInputAttribute(string callbackName, string message = null) + { + CallbackName = callbackName; + Message = message; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidateInputAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidateInputAttribute.cs.meta new file mode 100644 index 0000000..0addd1a --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidateInputAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6c4171d68fb5bc0448d3ac298973e82c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidatorAttribute.cs b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidatorAttribute.cs new file mode 100644 index 0000000..3b1201d --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidatorAttribute.cs @@ -0,0 +1,8 @@ +using System; + +namespace NaughtyAttributes +{ + public class ValidatorAttribute : Attribute, INaughtyAttribute + { + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidatorAttribute.cs.meta b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidatorAttribute.cs.meta new file mode 100644 index 0000000..f5daea8 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidatorAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0f3c43bed2dbc5249b6c6ec7859c2020 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor.meta b/Assets/NaughtyAttributes/Scripts/Editor.meta new file mode 100644 index 0000000..8dd7e3e --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: b76068e69df25a94ab378b0b6829c4f0 +folderAsset: yes +timeCreated: 1507995613 +licenseType: Store +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/DecoratorDrawers.meta b/Assets/NaughtyAttributes/Scripts/Editor/DecoratorDrawers.meta new file mode 100644 index 0000000..79b2c37 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/DecoratorDrawers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d3041a2296f3b1749b3ef18e695adee4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/HorizontalLineDecoratorDrawer.cs b/Assets/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/HorizontalLineDecoratorDrawer.cs new file mode 100644 index 0000000..dae6544 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/HorizontalLineDecoratorDrawer.cs @@ -0,0 +1,23 @@ +using UnityEngine; +using UnityEditor; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(HorizontalLineAttribute))] + public class HorizontalLineDecoratorDrawer : DecoratorDrawer + { + public override float GetHeight() + { + HorizontalLineAttribute lineAttr = (HorizontalLineAttribute)attribute; + return EditorGUIUtility.singleLineHeight + lineAttr.Height; + } + + public override void OnGUI(Rect position) + { + Rect rect = EditorGUI.IndentedRect(position); + rect.y += EditorGUIUtility.singleLineHeight / 3.0f; + HorizontalLineAttribute lineAttr = (HorizontalLineAttribute)attribute; + NaughtyEditorGUI.HorizontalLine(rect, lineAttr.Height, lineAttr.Color.GetColor()); + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/HorizontalLineDecoratorDrawer.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/HorizontalLineDecoratorDrawer.cs.meta new file mode 100644 index 0000000..719f6d8 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/HorizontalLineDecoratorDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3ec99f3a124f20e40b8f5edfeb1ecced +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/InfoBoxDecoratorDrawer.cs b/Assets/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/InfoBoxDecoratorDrawer.cs new file mode 100644 index 0000000..89249ae --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/InfoBoxDecoratorDrawer.cs @@ -0,0 +1,59 @@ +using UnityEditor; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(InfoBoxAttribute))] + public class InfoBoxDecoratorDrawer : DecoratorDrawer + { + public override float GetHeight() + { + return GetHelpBoxHeight(); + } + + public override void OnGUI(Rect rect) + { + InfoBoxAttribute infoBoxAttribute = (InfoBoxAttribute)attribute; + + float indentLength = NaughtyEditorGUI.GetIndentLength(rect); + Rect infoBoxRect = new Rect( + rect.x + indentLength, + rect.y, + rect.width - indentLength, + GetHelpBoxHeight()); + + DrawInfoBox(infoBoxRect, infoBoxAttribute.Text, infoBoxAttribute.Type); + } + + private float GetHelpBoxHeight() + { + InfoBoxAttribute infoBoxAttribute = (InfoBoxAttribute)attribute; + float minHeight = EditorGUIUtility.singleLineHeight * 2.0f; + float desiredHeight = GUI.skin.box.CalcHeight(new GUIContent(infoBoxAttribute.Text), EditorGUIUtility.currentViewWidth); + float height = Mathf.Max(minHeight, desiredHeight); + + return height; + } + + private void DrawInfoBox(Rect rect, string infoText, EInfoBoxType infoBoxType) + { + MessageType messageType = MessageType.None; + switch (infoBoxType) + { + case EInfoBoxType.Normal: + messageType = MessageType.Info; + break; + + case EInfoBoxType.Warning: + messageType = MessageType.Warning; + break; + + case EInfoBoxType.Error: + messageType = MessageType.Error; + break; + } + + NaughtyEditorGUI.HelpBox(rect, infoText, messageType); + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/InfoBoxDecoratorDrawer.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/InfoBoxDecoratorDrawer.cs.meta new file mode 100644 index 0000000..5f50ace --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/InfoBoxDecoratorDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e9c18b0e698717442b7631c5066d667f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/NaughtyAttributes.Editor.asmdef b/Assets/NaughtyAttributes/Scripts/Editor/NaughtyAttributes.Editor.asmdef new file mode 100644 index 0000000..e1aafc2 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/NaughtyAttributes.Editor.asmdef @@ -0,0 +1,16 @@ +{ + "name": "NaughtyAttributes.Editor", + "references": [ + "NaughtyAttributes.Core" + ], + "optionalUnityReferences": [], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [] +} \ No newline at end of file diff --git a/Assets/NaughtyAttributes/Scripts/Editor/NaughtyAttributes.Editor.asmdef.meta b/Assets/NaughtyAttributes/Scripts/Editor/NaughtyAttributes.Editor.asmdef.meta new file mode 100644 index 0000000..70dc9f2 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/NaughtyAttributes.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f88fb04354076c646a4107a491394033 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs b/Assets/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs new file mode 100644 index 0000000..5e69231 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs @@ -0,0 +1,221 @@ +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using UnityEditor; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + [CanEditMultipleObjects] + [CustomEditor(typeof(UnityEngine.Object), true)] + public class NaughtyInspector : UnityEditor.Editor + { + private List _serializedProperties = new List(); + private IEnumerable _nonSerializedFields; + private IEnumerable _nativeProperties; + private IEnumerable _methods; + private Dictionary _foldouts = new Dictionary(); + + protected virtual void OnEnable() + { + _nonSerializedFields = ReflectionUtility.GetAllFields( + target, f => f.GetCustomAttributes(typeof(ShowNonSerializedFieldAttribute), true).Length > 0); + + _nativeProperties = ReflectionUtility.GetAllProperties( + target, p => p.GetCustomAttributes(typeof(ShowNativePropertyAttribute), true).Length > 0); + + _methods = ReflectionUtility.GetAllMethods( + target, m => m.GetCustomAttributes(typeof(ButtonAttribute), true).Length > 0); + } + + protected virtual void OnDisable() + { + ReorderableListPropertyDrawer.Instance.ClearCache(); + } + + public override void OnInspectorGUI() + { + GetSerializedProperties(ref _serializedProperties); + + bool anyNaughtyAttribute = _serializedProperties.Any(p => PropertyUtility.GetAttribute(p) != null); + if (!anyNaughtyAttribute) + { + DrawDefaultInspector(); + } + else + { + DrawSerializedProperties(); + } + + DrawNonSerializedFields(); + DrawNativeProperties(); + DrawButtons(); + } + + protected void GetSerializedProperties(ref List outSerializedProperties) + { + outSerializedProperties.Clear(); + using (var iterator = serializedObject.GetIterator()) + { + if (iterator.NextVisible(true)) + { + do + { + outSerializedProperties.Add(serializedObject.FindProperty(iterator.name)); + } + while (iterator.NextVisible(false)); + } + } + } + + protected void DrawSerializedProperties() + { + serializedObject.Update(); + + // Draw non-grouped serialized properties + foreach (var property in GetNonGroupedProperties(_serializedProperties)) + { + if (property.name.Equals("m_Script", System.StringComparison.Ordinal)) + { + using (new EditorGUI.DisabledScope(disabled: true)) + { + EditorGUILayout.PropertyField(property); + } + } + else + { + NaughtyEditorGUI.PropertyField_Layout(property, includeChildren: true); + } + } + + // Draw grouped serialized properties + foreach (var group in GetGroupedProperties(_serializedProperties)) + { + IEnumerable visibleProperties = group.Where(p => PropertyUtility.IsVisible(p)); + if (!visibleProperties.Any()) + { + continue; + } + + NaughtyEditorGUI.BeginBoxGroup_Layout(group.Key); + foreach (var property in visibleProperties) + { + NaughtyEditorGUI.PropertyField_Layout(property, includeChildren: true); + } + + NaughtyEditorGUI.EndBoxGroup_Layout(); + } + + // Draw foldout serialized properties + foreach (var group in GetFoldoutProperties(_serializedProperties)) + { + IEnumerable visibleProperties = group.Where(p => PropertyUtility.IsVisible(p)); + if (!visibleProperties.Any()) + { + continue; + } + + if (!_foldouts.ContainsKey(group.Key)) + { + _foldouts[group.Key] = new SavedBool($"{target.GetInstanceID()}.{group.Key}", false); + } + + _foldouts[group.Key].Value = EditorGUILayout.Foldout(_foldouts[group.Key].Value, group.Key, true); + if (_foldouts[group.Key].Value) + { + foreach (var property in visibleProperties) + { + NaughtyEditorGUI.PropertyField_Layout(property, true); + } + } + } + + serializedObject.ApplyModifiedProperties(); + } + + protected void DrawNonSerializedFields(bool drawHeader = false) + { + if (_nonSerializedFields.Any()) + { + if (drawHeader) + { + EditorGUILayout.Space(); + EditorGUILayout.LabelField("Non-Serialized Fields", GetHeaderGUIStyle()); + NaughtyEditorGUI.HorizontalLine( + EditorGUILayout.GetControlRect(false), HorizontalLineAttribute.DefaultHeight, HorizontalLineAttribute.DefaultColor.GetColor()); + } + + foreach (var field in _nonSerializedFields) + { + NaughtyEditorGUI.NonSerializedField_Layout(serializedObject.targetObject, field); + } + } + } + + protected void DrawNativeProperties(bool drawHeader = false) + { + if (_nativeProperties.Any()) + { + if (drawHeader) + { + EditorGUILayout.Space(); + EditorGUILayout.LabelField("Native Properties", GetHeaderGUIStyle()); + NaughtyEditorGUI.HorizontalLine( + EditorGUILayout.GetControlRect(false), HorizontalLineAttribute.DefaultHeight, HorizontalLineAttribute.DefaultColor.GetColor()); + } + + foreach (var property in _nativeProperties) + { + NaughtyEditorGUI.NativeProperty_Layout(serializedObject.targetObject, property); + } + } + } + + protected void DrawButtons(bool drawHeader = false) + { + if (_methods.Any()) + { + if (drawHeader) + { + EditorGUILayout.Space(); + EditorGUILayout.LabelField("Buttons", GetHeaderGUIStyle()); + NaughtyEditorGUI.HorizontalLine( + EditorGUILayout.GetControlRect(false), HorizontalLineAttribute.DefaultHeight, HorizontalLineAttribute.DefaultColor.GetColor()); + } + + foreach (var method in _methods) + { + NaughtyEditorGUI.Button(serializedObject.targetObject, method); + } + } + } + + private static IEnumerable GetNonGroupedProperties(IEnumerable properties) + { + return properties.Where(p => PropertyUtility.GetAttribute(p) == null); + } + + private static IEnumerable> GetGroupedProperties(IEnumerable properties) + { + return properties + .Where(p => PropertyUtility.GetAttribute(p) != null) + .GroupBy(p => PropertyUtility.GetAttribute(p).Name); + } + + private static IEnumerable> GetFoldoutProperties(IEnumerable properties) + { + return properties + .Where(p => PropertyUtility.GetAttribute(p) != null) + .GroupBy(p => PropertyUtility.GetAttribute(p).Name); + } + + private static GUIStyle GetHeaderGUIStyle() + { + GUIStyle style = new GUIStyle(EditorStyles.centeredGreyMiniLabel); + style.fontStyle = FontStyle.Bold; + style.alignment = TextAnchor.UpperCenter; + + return style; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs.meta new file mode 100644 index 0000000..b63e99f --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1b9b53879f7c93b42835c3ad9e0d0a66 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers.meta new file mode 100644 index 0000000..7d7dbed --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4327d74fca5deaa4c83c483fe468d274 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AllowNestingPropertyDrawer.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AllowNestingPropertyDrawer.cs new file mode 100644 index 0000000..7e81b12 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AllowNestingPropertyDrawer.cs @@ -0,0 +1,16 @@ +using UnityEngine; +using UnityEditor; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(AllowNestingAttribute))] + public class AllowNestingPropertyDrawer : PropertyDrawerBase + { + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + EditorGUI.PropertyField(rect, property, label, true); + EditorGUI.EndProperty(); + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AllowNestingPropertyDrawer.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AllowNestingPropertyDrawer.cs.meta new file mode 100644 index 0000000..f2f2145 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AllowNestingPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a3175e7041b8f4348bd652485a78e7b1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AnimatorParamPropertyDrawer.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AnimatorParamPropertyDrawer.cs new file mode 100644 index 0000000..1450839 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AnimatorParamPropertyDrawer.cs @@ -0,0 +1,173 @@ +using System.Collections.Generic; +using System.Reflection; +using UnityEditor; +using UnityEditor.Animations; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(AnimatorParamAttribute))] + public class AnimatorParamPropertyDrawer : PropertyDrawerBase + { + private const string InvalidAnimatorControllerWarningMessage = "Target animator controller is null"; + private const string InvalidTypeWarningMessage = "{0} must be an int or a string"; + + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + AnimatorParamAttribute animatorParamAttribute = PropertyUtility.GetAttribute(property); + bool validAnimatorController = GetAnimatorController(property, animatorParamAttribute.AnimatorName) != null; + bool validPropertyType = property.propertyType == SerializedPropertyType.Integer || property.propertyType == SerializedPropertyType.String; + + return (validAnimatorController && validPropertyType) + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + AnimatorParamAttribute animatorParamAttribute = PropertyUtility.GetAttribute(property); + + AnimatorController animatorController = GetAnimatorController(property, animatorParamAttribute.AnimatorName); + if (animatorController == null) + { + DrawDefaultPropertyAndHelpBox(rect, property, InvalidAnimatorControllerWarningMessage, MessageType.Warning); + return; + } + + int parametersCount = animatorController.parameters.Length; + List animatorParameters = new List(parametersCount); + for (int i = 0; i < parametersCount; i++) + { + AnimatorControllerParameter parameter = animatorController.parameters[i]; + if (animatorParamAttribute.AnimatorParamType == null || parameter.type == animatorParamAttribute.AnimatorParamType) + { + animatorParameters.Add(parameter); + } + } + + switch (property.propertyType) + { + case SerializedPropertyType.Integer: + DrawPropertyForInt(rect, property, label, animatorParameters); + break; + case SerializedPropertyType.String: + DrawPropertyForString(rect, property, label, animatorParameters); + break; + default: + DrawDefaultPropertyAndHelpBox(rect, property, string.Format(InvalidTypeWarningMessage, property.name), MessageType.Warning); + break; + } + + EditorGUI.EndProperty(); + } + + private static void DrawPropertyForInt(Rect rect, SerializedProperty property, GUIContent label, List animatorParameters) + { + int paramNameHash = property.intValue; + int index = 0; + + for (int i = 0; i < animatorParameters.Count; i++) + { + if (paramNameHash == animatorParameters[i].nameHash) + { + index = i + 1; // +1 because the first option is reserved for (None) + break; + } + } + + string[] displayOptions = GetDisplayOptions(animatorParameters); + + int newIndex = EditorGUI.Popup(rect, label.text, index, displayOptions); + int newValue = newIndex == 0 ? 0 : animatorParameters[newIndex - 1].nameHash; + + if (property.intValue != newValue) + { + property.intValue = newValue; + } + } + + private static void DrawPropertyForString(Rect rect, SerializedProperty property, GUIContent label, List animatorParameters) + { + string paramName = property.stringValue; + int index = 0; + + for (int i = 0; i < animatorParameters.Count; i++) + { + if (paramName.Equals(animatorParameters[i].name, System.StringComparison.Ordinal)) + { + index = i + 1; // +1 because the first option is reserved for (None) + break; + } + } + + string[] displayOptions = GetDisplayOptions(animatorParameters); + + int newIndex = EditorGUI.Popup(rect, label.text, index, displayOptions); + string newValue = newIndex == 0 ? null : animatorParameters[newIndex - 1].name; + + if (!property.stringValue.Equals(newValue, System.StringComparison.Ordinal)) + { + property.stringValue = newValue; + } + } + + private static string[] GetDisplayOptions(List animatorParams) + { + string[] displayOptions = new string[animatorParams.Count + 1]; + displayOptions[0] = "(None)"; + + for (int i = 0; i < animatorParams.Count; i++) + { + displayOptions[i + 1] = animatorParams[i].name; + } + + return displayOptions; + } + + private static AnimatorController GetAnimatorController(SerializedProperty property, string animatorName) + { + object target = PropertyUtility.GetTargetObjectWithProperty(property); + + FieldInfo animatorFieldInfo = ReflectionUtility.GetField(target, animatorName); + if (animatorFieldInfo != null && + animatorFieldInfo.FieldType == typeof(Animator)) + { + Animator animator = animatorFieldInfo.GetValue(target) as Animator; + if (animator != null) + { + AnimatorController animatorController = animator.runtimeAnimatorController as AnimatorController; + return animatorController; + } + } + + PropertyInfo animatorPropertyInfo = ReflectionUtility.GetProperty(target, animatorName); + if (animatorPropertyInfo != null && + animatorPropertyInfo.PropertyType == typeof(Animator)) + { + Animator animator = animatorPropertyInfo.GetValue(target) as Animator; + if (animator != null) + { + AnimatorController animatorController = animator.runtimeAnimatorController as AnimatorController; + return animatorController; + } + } + + MethodInfo animatorGetterMethodInfo = ReflectionUtility.GetMethod(target, animatorName); + if (animatorGetterMethodInfo != null && + animatorGetterMethodInfo.ReturnType == typeof(Animator) && + animatorGetterMethodInfo.GetParameters().Length == 0) + { + Animator animator = animatorGetterMethodInfo.Invoke(target, null) as Animator; + if (animator != null) + { + AnimatorController animatorController = animator.runtimeAnimatorController as AnimatorController; + return animatorController; + } + } + + return null; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AnimatorParamPropertyDrawer.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AnimatorParamPropertyDrawer.cs.meta new file mode 100644 index 0000000..4c3a7e6 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AnimatorParamPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 98ff8cb1bcefae740a68d9a5c5ee3563 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/CurveRangePropertyDrawer.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/CurveRangePropertyDrawer.cs new file mode 100644 index 0000000..eaf4724 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/CurveRangePropertyDrawer.cs @@ -0,0 +1,42 @@ +using UnityEngine; +using UnityEditor; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(CurveRangeAttribute))] + public class CurveRangePropertyDrawer : PropertyDrawerBase + { + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + float propertyHeight = property.propertyType == SerializedPropertyType.AnimationCurve + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + + return propertyHeight; + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + // Check user error + if (property.propertyType != SerializedPropertyType.AnimationCurve) + { + string message = string.Format("Field {0} is not an AnimationCurve", property.name); + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + return; + } + + var attribute = PropertyUtility.GetAttribute(property); + + EditorGUI.CurveField( + rect, + property, + attribute.Color == EColor.Clear ? Color.green : attribute.Color.GetColor(), + new Rect(attribute.Min.x, attribute.Min.y, attribute.Max.x - attribute.Min.x, attribute.Max.y - attribute.Min.y), + label); + + EditorGUI.EndProperty(); + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/CurveRangePropertyDrawer.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/CurveRangePropertyDrawer.cs.meta new file mode 100644 index 0000000..adea11e --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/CurveRangePropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 798b8c99fbc072a4b83ee387e472a2bd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/DropdownPropertyDrawer.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/DropdownPropertyDrawer.cs new file mode 100644 index 0000000..88d64de --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/DropdownPropertyDrawer.cs @@ -0,0 +1,177 @@ +using UnityEngine; +using UnityEditor; +using System.Collections; +using System.Reflection; +using System; +using System.Collections.Generic; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(DropdownAttribute))] + public class DropdownPropertyDrawer : PropertyDrawerBase + { + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + DropdownAttribute dropdownAttribute = (DropdownAttribute)attribute; + object values = GetValues(property, dropdownAttribute.ValuesName); + FieldInfo fieldInfo = ReflectionUtility.GetField(PropertyUtility.GetTargetObjectWithProperty(property), property.name); + + float propertyHeight = AreValuesValid(values, fieldInfo) + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + + return propertyHeight; + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + DropdownAttribute dropdownAttribute = (DropdownAttribute)attribute; + object target = PropertyUtility.GetTargetObjectWithProperty(property); + + object valuesObject = GetValues(property, dropdownAttribute.ValuesName); + FieldInfo dropdownField = ReflectionUtility.GetField(target, property.name); + + if (AreValuesValid(valuesObject, dropdownField)) + { + if (valuesObject is IList && dropdownField.FieldType == GetElementType(valuesObject)) + { + // Selected value + object selectedValue = dropdownField.GetValue(target); + + // Values and display options + IList valuesList = (IList)valuesObject; + object[] values = new object[valuesList.Count]; + string[] displayOptions = new string[valuesList.Count]; + + for (int i = 0; i < values.Length; i++) + { + object value = valuesList[i]; + values[i] = value; + displayOptions[i] = value == null ? "" : value.ToString(); + } + + // Selected value index + int selectedValueIndex = Array.IndexOf(values, selectedValue); + if (selectedValueIndex < 0) + { + selectedValueIndex = 0; + } + + NaughtyEditorGUI.Dropdown( + rect, property.serializedObject, target, dropdownField, label.text, selectedValueIndex, values, displayOptions); + } + else if (valuesObject is IDropdownList) + { + // Current value + object selectedValue = dropdownField.GetValue(target); + + // Current value index, values and display options + int index = -1; + int selectedValueIndex = -1; + List values = new List(); + List displayOptions = new List(); + IDropdownList dropdown = (IDropdownList)valuesObject; + + using (IEnumerator> dropdownEnumerator = dropdown.GetEnumerator()) + { + while (dropdownEnumerator.MoveNext()) + { + index++; + + KeyValuePair current = dropdownEnumerator.Current; + if (current.Value?.Equals(selectedValue) == true) + { + selectedValueIndex = index; + } + + values.Add(current.Value); + + if (current.Key == null) + { + displayOptions.Add(""); + } + else if (string.IsNullOrWhiteSpace(current.Key)) + { + displayOptions.Add(""); + } + else + { + displayOptions.Add(current.Key); + } + } + } + + if (selectedValueIndex < 0) + { + selectedValueIndex = 0; + } + + NaughtyEditorGUI.Dropdown( + rect, property.serializedObject, target, dropdownField, label.text, selectedValueIndex, values.ToArray(), displayOptions.ToArray()); + } + } + else + { + string message = string.Format("Invalid values with name '{0}' provided to '{1}'. Either the values name is incorrect or the types of the target field and the values field/property/method don't match", + dropdownAttribute.ValuesName, dropdownAttribute.GetType().Name); + + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + } + + EditorGUI.EndProperty(); + } + + private object GetValues(SerializedProperty property, string valuesName) + { + object target = PropertyUtility.GetTargetObjectWithProperty(property); + + FieldInfo valuesFieldInfo = ReflectionUtility.GetField(target, valuesName); + if (valuesFieldInfo != null) + { + return valuesFieldInfo.GetValue(target); + } + + PropertyInfo valuesPropertyInfo = ReflectionUtility.GetProperty(target, valuesName); + if (valuesPropertyInfo != null) + { + return valuesPropertyInfo.GetValue(target); + } + + MethodInfo methodValuesInfo = ReflectionUtility.GetMethod(target, valuesName); + if (methodValuesInfo != null && + methodValuesInfo.ReturnType != typeof(void) && + methodValuesInfo.GetParameters().Length == 0) + { + return methodValuesInfo.Invoke(target, null); + } + + return null; + } + + private bool AreValuesValid(object values, FieldInfo dropdownField) + { + if (values == null || dropdownField == null) + { + return false; + } + + if ((values is IList && dropdownField.FieldType == GetElementType(values)) || + (values is IDropdownList)) + { + return true; + } + + return false; + } + + private Type GetElementType(object values) + { + Type valuesType = values.GetType(); + Type elementType = ReflectionUtility.GetListElementType(valuesType); + + return elementType; + } + } +} \ No newline at end of file diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/DropdownPropertyDrawer.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/DropdownPropertyDrawer.cs.meta new file mode 100644 index 0000000..fecae2c --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/DropdownPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dd080b36769bcd94d909fc0431cf25e0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/EnumFlagsPropertyDrawer.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/EnumFlagsPropertyDrawer.cs new file mode 100644 index 0000000..63236a1 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/EnumFlagsPropertyDrawer.cs @@ -0,0 +1,38 @@ +using UnityEngine; +using UnityEditor; +using System; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(EnumFlagsAttribute))] + public class EnumFlagsPropertyDrawer : PropertyDrawerBase + { + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + Enum targetEnum = PropertyUtility.GetTargetObjectOfProperty(property) as Enum; + + return (targetEnum != null) + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + Enum targetEnum = PropertyUtility.GetTargetObjectOfProperty(property) as Enum; + if (targetEnum != null) + { + Enum enumNew = EditorGUI.EnumFlagsField(rect, label.text, targetEnum); + property.intValue = (int)Convert.ChangeType(enumNew, targetEnum.GetType()); + } + else + { + string message = attribute.GetType().Name + " can be used only on enums"; + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + } + + EditorGUI.EndProperty(); + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/EnumFlagsPropertyDrawer.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/EnumFlagsPropertyDrawer.cs.meta new file mode 100644 index 0000000..c0081d2 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/EnumFlagsPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b750e1461c1126d4399459b90b31e75e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ExpandablePropertyDrawer.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ExpandablePropertyDrawer.cs new file mode 100644 index 0000000..cc73a6f --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ExpandablePropertyDrawer.cs @@ -0,0 +1,195 @@ +using UnityEngine; +using UnityEditor; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(ExpandableAttribute))] + public class ExpandablePropertyDrawer : PropertyDrawerBase + { + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + if (property.objectReferenceValue == null) + { + return GetPropertyHeight(property); + } + + System.Type propertyType = PropertyUtility.GetPropertyType(property); + if (typeof(ScriptableObject).IsAssignableFrom(propertyType)) + { + ScriptableObject scriptableObject = property.objectReferenceValue as ScriptableObject; + if (scriptableObject == null) + { + return GetPropertyHeight(property); + } + + if (property.isExpanded) + { + using (SerializedObject serializedObject = new SerializedObject(scriptableObject)) + { + float totalHeight = EditorGUIUtility.singleLineHeight; + + using (var iterator = serializedObject.GetIterator()) + { + if (iterator.NextVisible(true)) + { + do + { + SerializedProperty childProperty = serializedObject.FindProperty(iterator.name); + if (childProperty.name.Equals("m_Script", System.StringComparison.Ordinal)) + { + continue; + } + + bool visible = PropertyUtility.IsVisible(childProperty); + if (!visible) + { + continue; + } + + float height = GetPropertyHeight(childProperty); + totalHeight += height; + } + while (iterator.NextVisible(false)); + } + } + + totalHeight += EditorGUIUtility.standardVerticalSpacing; + return totalHeight; + } + } + else + { + return GetPropertyHeight(property); + } + } + else + { + return GetPropertyHeight(property) + GetHelpBoxHeight(); + } + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + if (property.objectReferenceValue == null) + { + EditorGUI.PropertyField(rect, property, label, false); + } + else + { + System.Type propertyType = PropertyUtility.GetPropertyType(property); + if (typeof(ScriptableObject).IsAssignableFrom(propertyType)) + { + ScriptableObject scriptableObject = property.objectReferenceValue as ScriptableObject; + if (scriptableObject == null) + { + EditorGUI.PropertyField(rect, property, label, false); + } + else + { + // Draw a foldout + Rect foldoutRect = new Rect() + { + x = rect.x, + y = rect.y, + width = EditorGUIUtility.labelWidth, + height = EditorGUIUtility.singleLineHeight + }; + + property.isExpanded = EditorGUI.Foldout(foldoutRect, property.isExpanded, label, toggleOnLabelClick: true); + + // Draw the scriptable object field + Rect propertyRect = new Rect() + { + x = rect.x, + y = rect.y, + width = rect.width, + height = EditorGUIUtility.singleLineHeight + }; + + EditorGUI.PropertyField(propertyRect, property, label, false); + + property.serializedObject.ApplyModifiedProperties(); + + // Draw the child properties + if (property.isExpanded) + { + DrawChildProperties(rect, property); + } + } + } + else + { + string message = $"{typeof(ExpandableAttribute).Name} can only be used on scriptable objects"; + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + } + } + + EditorGUI.EndProperty(); + } + + private void DrawChildProperties(Rect rect, SerializedProperty property) + { + ScriptableObject scriptableObject = property.objectReferenceValue as ScriptableObject; + if (scriptableObject == null) + { + return; + } + + Rect boxRect = new Rect() + { + x = 0.0f, + y = rect.y + EditorGUIUtility.singleLineHeight, + width = rect.width * 2.0f, + height = rect.height - EditorGUIUtility.singleLineHeight + }; + + GUI.Box(boxRect, GUIContent.none); + + using (new EditorGUI.IndentLevelScope()) + { + SerializedObject serializedObject = new SerializedObject(scriptableObject); + + using (var iterator = serializedObject.GetIterator()) + { + float yOffset = EditorGUIUtility.singleLineHeight; + + if (iterator.NextVisible(true)) + { + do + { + SerializedProperty childProperty = serializedObject.FindProperty(iterator.name); + if (childProperty.name.Equals("m_Script", System.StringComparison.Ordinal)) + { + continue; + } + + bool visible = PropertyUtility.IsVisible(childProperty); + if (!visible) + { + continue; + } + + float childHeight = GetPropertyHeight(childProperty); + Rect childRect = new Rect() + { + x = rect.x, + y = rect.y + yOffset, + width = rect.width, + height = childHeight + }; + + NaughtyEditorGUI.PropertyField(childRect, childProperty, true); + + yOffset += childHeight; + } + while (iterator.NextVisible(false)); + } + } + + serializedObject.ApplyModifiedProperties(); + } + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ExpandablePropertyDrawer.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ExpandablePropertyDrawer.cs.meta new file mode 100644 index 0000000..d5925fe --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ExpandablePropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d1ddb7194615bdc4e8b2088c8d165d8b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/InputAxisPropertyDrawer.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/InputAxisPropertyDrawer.cs new file mode 100644 index 0000000..e42e97c --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/InputAxisPropertyDrawer.cs @@ -0,0 +1,77 @@ +using System.Collections.Generic; +using System.IO; +using System.Linq; +using UnityEditor; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(InputAxisAttribute))] + public class InputAxisPropertyDrawer : PropertyDrawerBase + { + private static readonly string AssetPath = Path.Combine("ProjectSettings", "InputManager.asset"); + private const string AxesPropertyPath = "m_Axes"; + private const string NamePropertyPath = "m_Name"; + + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + return (property.propertyType == SerializedPropertyType.String) + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + if (property.propertyType == SerializedPropertyType.String) + { + var inputManagerAsset = AssetDatabase.LoadAssetAtPath(AssetPath, typeof(object)); + var inputManager = new SerializedObject(inputManagerAsset); + + var axesProperty = inputManager.FindProperty(AxesPropertyPath); + var axesSet = new HashSet(); + axesSet.Add("(None)"); + + for (var i = 0; i < axesProperty.arraySize; i++) + { + var axis = axesProperty.GetArrayElementAtIndex(i).FindPropertyRelative(NamePropertyPath).stringValue; + axesSet.Add(axis); + } + + var axes = axesSet.ToArray(); + + string propertyString = property.stringValue; + int index = 0; + // check if there is an entry that matches the entry and get the index + // we skip index 0 as that is a special custom case + for (int i = 1; i < axes.Length; i++) + { + if (axes[i].Equals(propertyString, System.StringComparison.Ordinal)) + { + index = i; + break; + } + } + + // Draw the popup box with the current selected index + int newIndex = EditorGUI.Popup(rect, label.text, index, axes); + + // Adjust the actual string value of the property based on the selection + string newValue = newIndex > 0 ? axes[newIndex] : string.Empty; + + if (!property.stringValue.Equals(newValue, System.StringComparison.Ordinal)) + { + property.stringValue = newValue; + } + } + else + { + string message = string.Format("{0} supports only string fields", typeof(InputAxisAttribute).Name); + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + } + + EditorGUI.EndProperty(); + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/InputAxisPropertyDrawer.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/InputAxisPropertyDrawer.cs.meta new file mode 100644 index 0000000..08f8f46 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/InputAxisPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0de9d3dfe2d466a458be838edf361645 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/LayerPropertyDrawer.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/LayerPropertyDrawer.cs new file mode 100644 index 0000000..8637717 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/LayerPropertyDrawer.cs @@ -0,0 +1,88 @@ +using UnityEngine; +using UnityEditor; +using System; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(LayerAttribute))] + public class LayerPropertyDrawer : PropertyDrawerBase + { + private const string TypeWarningMessage = "{0} must be an int or a string"; + + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + bool validPropertyType = property.propertyType == SerializedPropertyType.String || property.propertyType == SerializedPropertyType.Integer; + + return validPropertyType + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + switch (property.propertyType) + { + case SerializedPropertyType.String: + DrawPropertyForString(rect, property, label, GetLayers()); + break; + case SerializedPropertyType.Integer: + DrawPropertyForInt(rect, property, label, GetLayers()); + break; + default: + string message = string.Format(TypeWarningMessage, property.name); + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + break; + } + + EditorGUI.EndProperty(); + } + + private string[] GetLayers() + { + return UnityEditorInternal.InternalEditorUtility.layers; + } + + private static void DrawPropertyForString(Rect rect, SerializedProperty property, GUIContent label, string[] layers) + { + int index = IndexOf(layers, property.stringValue); + int newIndex = EditorGUI.Popup(rect, label.text, index, layers); + string newLayer = layers[newIndex]; + + if (!property.stringValue.Equals(newLayer, StringComparison.Ordinal)) + { + property.stringValue = layers[newIndex]; + } + } + + private static void DrawPropertyForInt(Rect rect, SerializedProperty property, GUIContent label, string[] layers) + { + int index = 0; + string layerName = LayerMask.LayerToName(property.intValue); + for (int i = 0; i < layers.Length; i++) + { + if (layerName.Equals(layers[i], StringComparison.Ordinal)) + { + index = i; + break; + } + } + + int newIndex = EditorGUI.Popup(rect, label.text, index, layers); + string newLayerName = layers[newIndex]; + int newLayerNumber = LayerMask.NameToLayer(newLayerName); + + if (property.intValue != newLayerNumber) + { + property.intValue = newLayerNumber; + } + } + + private static int IndexOf(string[] layers, string layer) + { + var index = Array.IndexOf(layers, layer); + return Mathf.Clamp(index, 0, layers.Length - 1); + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/LayerPropertyDrawer.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/LayerPropertyDrawer.cs.meta new file mode 100644 index 0000000..4b2ac86 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/LayerPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7278ba0893ab7d940b5f944e5b1cf1a7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/MinMaxSliderPropertyDrawer.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/MinMaxSliderPropertyDrawer.cs new file mode 100644 index 0000000..91d6a3e --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/MinMaxSliderPropertyDrawer.cs @@ -0,0 +1,108 @@ +using UnityEditor; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(MinMaxSliderAttribute))] + public class MinMaxSliderPropertyDrawer : PropertyDrawerBase + { + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + return (property.propertyType == SerializedPropertyType.Vector2 || property.propertyType == SerializedPropertyType.Vector2Int) + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + MinMaxSliderAttribute minMaxSliderAttribute = (MinMaxSliderAttribute)attribute; + + if (property.propertyType == SerializedPropertyType.Vector2 || property.propertyType == SerializedPropertyType.Vector2Int) + { + EditorGUI.BeginProperty(rect, label, property); + + float indentLength = NaughtyEditorGUI.GetIndentLength(rect); + float labelWidth = EditorGUIUtility.labelWidth + NaughtyEditorGUI.HorizontalSpacing; + float floatFieldWidth = EditorGUIUtility.fieldWidth; + float sliderWidth = rect.width - labelWidth - 2.0f * floatFieldWidth; + float sliderPadding = 5.0f; + + Rect labelRect = new Rect( + rect.x, + rect.y, + labelWidth, + rect.height); + + Rect sliderRect = new Rect( + rect.x + labelWidth + floatFieldWidth + sliderPadding - indentLength, + rect.y, + sliderWidth - 2.0f * sliderPadding + indentLength, + rect.height); + + Rect minFloatFieldRect = new Rect( + rect.x + labelWidth - indentLength, + rect.y, + floatFieldWidth + indentLength, + rect.height); + + Rect maxFloatFieldRect = new Rect( + rect.x + labelWidth + floatFieldWidth + sliderWidth - indentLength, + rect.y, + floatFieldWidth + indentLength, + rect.height); + + // Draw the label + EditorGUI.LabelField(labelRect, label.text); + + // Draw the slider + EditorGUI.BeginChangeCheck(); + + if (property.propertyType == SerializedPropertyType.Vector2) + { + Vector2 sliderValue = property.vector2Value; + EditorGUI.MinMaxSlider(sliderRect, ref sliderValue.x, ref sliderValue.y, minMaxSliderAttribute.MinValue, minMaxSliderAttribute.MaxValue); + + sliderValue.x = EditorGUI.FloatField(minFloatFieldRect, sliderValue.x); + sliderValue.x = Mathf.Clamp(sliderValue.x, minMaxSliderAttribute.MinValue, Mathf.Min(minMaxSliderAttribute.MaxValue, sliderValue.y)); + + sliderValue.y = EditorGUI.FloatField(maxFloatFieldRect, sliderValue.y); + sliderValue.y = Mathf.Clamp(sliderValue.y, Mathf.Max(minMaxSliderAttribute.MinValue, sliderValue.x), minMaxSliderAttribute.MaxValue); + + if (EditorGUI.EndChangeCheck()) + { + property.vector2Value = sliderValue; + } + } + else if (property.propertyType == SerializedPropertyType.Vector2Int) + { + Vector2Int sliderValue = property.vector2IntValue; + float xValue = sliderValue.x; + float yValue = sliderValue.y; + EditorGUI.MinMaxSlider(sliderRect, ref xValue, ref yValue, minMaxSliderAttribute.MinValue, minMaxSliderAttribute.MaxValue); + + sliderValue.x = EditorGUI.IntField(minFloatFieldRect, (int)xValue); + sliderValue.x = (int)Mathf.Clamp(sliderValue.x, minMaxSliderAttribute.MinValue, Mathf.Min(minMaxSliderAttribute.MaxValue, sliderValue.y)); + + sliderValue.y = EditorGUI.IntField(maxFloatFieldRect, (int)yValue); + sliderValue.y = (int)Mathf.Clamp(sliderValue.y, Mathf.Max(minMaxSliderAttribute.MinValue, sliderValue.x), minMaxSliderAttribute.MaxValue); + + if (EditorGUI.EndChangeCheck()) + { + property.vector2IntValue = sliderValue; + } + } + + EditorGUI.EndProperty(); + } + else + { + string message = minMaxSliderAttribute.GetType().Name + " can be used only on Vector2 or Vector2Int fields"; + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + } + + EditorGUI.EndProperty(); + } + } +} \ No newline at end of file diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/MinMaxSliderPropertyDrawer.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/MinMaxSliderPropertyDrawer.cs.meta new file mode 100644 index 0000000..4613ffe --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/MinMaxSliderPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 27011af81554b5b4489b155f09275475 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ProgressBarPropertyDrawer.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ProgressBarPropertyDrawer.cs new file mode 100644 index 0000000..39800ca --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ProgressBarPropertyDrawer.cs @@ -0,0 +1,154 @@ +using UnityEngine; +using UnityEditor; +using System.Reflection; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(ProgressBarAttribute))] + public class ProgressBarPropertyDrawer : PropertyDrawerBase + { + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + ProgressBarAttribute progressBarAttribute = PropertyUtility.GetAttribute(property); + var maxValue = GetMaxValue(property, progressBarAttribute); + + return IsNumber(property) && IsNumber(maxValue) + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + if (!IsNumber(property)) + { + string message = string.Format("Field {0} is not a number", property.name); + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + return; + } + + ProgressBarAttribute progressBarAttribute = PropertyUtility.GetAttribute(property); + var value = property.propertyType == SerializedPropertyType.Integer ? property.intValue : property.floatValue; + var valueFormatted = property.propertyType == SerializedPropertyType.Integer ? value.ToString() : string.Format("{0:0.00}", value); + var maxValue = GetMaxValue(property, progressBarAttribute); + + if (maxValue != null && IsNumber(maxValue)) + { + var fillPercentage = value / CastToFloat(maxValue); + var barLabel = (!string.IsNullOrEmpty(progressBarAttribute.Name) ? "[" + progressBarAttribute.Name + "] " : "") + valueFormatted + "/" + maxValue; + var barColor = progressBarAttribute.Color.GetColor(); + var labelColor = Color.white; + + var indentLength = NaughtyEditorGUI.GetIndentLength(rect); + Rect barRect = new Rect() + { + x = rect.x + indentLength, + y = rect.y, + width = rect.width - indentLength, + height = EditorGUIUtility.singleLineHeight + }; + + DrawBar(barRect, Mathf.Clamp01(fillPercentage), barLabel, barColor, labelColor); + } + else + { + string message = string.Format( + "The provided dynamic max value for the progress bar is not correct. Please check if the '{0}' is correct, or the return type is float/int", + nameof(progressBarAttribute.MaxValueName)); + + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + } + + EditorGUI.EndProperty(); + } + + private object GetMaxValue(SerializedProperty property, ProgressBarAttribute progressBarAttribute) + { + if (string.IsNullOrEmpty(progressBarAttribute.MaxValueName)) + { + return progressBarAttribute.MaxValue; + } + else + { + object target = PropertyUtility.GetTargetObjectWithProperty(property); + + FieldInfo valuesFieldInfo = ReflectionUtility.GetField(target, progressBarAttribute.MaxValueName); + if (valuesFieldInfo != null) + { + return valuesFieldInfo.GetValue(target); + } + + PropertyInfo valuesPropertyInfo = ReflectionUtility.GetProperty(target, progressBarAttribute.MaxValueName); + if (valuesPropertyInfo != null) + { + return valuesPropertyInfo.GetValue(target); + } + + MethodInfo methodValuesInfo = ReflectionUtility.GetMethod(target, progressBarAttribute.MaxValueName); + if (methodValuesInfo != null && + (methodValuesInfo.ReturnType == typeof(float) || methodValuesInfo.ReturnType == typeof(int)) && + methodValuesInfo.GetParameters().Length == 0) + { + return methodValuesInfo.Invoke(target, null); + } + + return null; + } + } + + private void DrawBar(Rect rect, float fillPercent, string label, Color barColor, Color labelColor) + { + if (Event.current.type != EventType.Repaint) + { + return; + } + + var fillRect = new Rect(rect.x, rect.y, rect.width * fillPercent, rect.height); + + EditorGUI.DrawRect(rect, new Color(0.13f, 0.13f, 0.13f)); + EditorGUI.DrawRect(fillRect, barColor); + + // set alignment and cache the default + var align = GUI.skin.label.alignment; + GUI.skin.label.alignment = TextAnchor.UpperCenter; + + // set the color and cache the default + var c = GUI.contentColor; + GUI.contentColor = labelColor; + + // calculate the position + var labelRect = new Rect(rect.x, rect.y - 2, rect.width, rect.height); + + // draw~ + EditorGUI.DropShadowLabel(labelRect, label); + + // reset color and alignment + GUI.contentColor = c; + GUI.skin.label.alignment = align; + } + + private bool IsNumber(SerializedProperty property) + { + bool isNumber = property.propertyType == SerializedPropertyType.Float || property.propertyType == SerializedPropertyType.Integer; + return isNumber; + } + + private bool IsNumber(object obj) + { + return (obj is float) || (obj is int); + } + + private float CastToFloat(object obj) + { + if (obj is int) + { + return (int)obj; + } + else + { + return (float)obj; + } + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ProgressBarPropertyDrawer.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ProgressBarPropertyDrawer.cs.meta new file mode 100644 index 0000000..dfb90f1 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ProgressBarPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0bcbc424b10864b4eb6e3bcfb276cdf9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/PropertyDrawerBase.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/PropertyDrawerBase.cs new file mode 100644 index 0000000..1f36dca --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/PropertyDrawerBase.cs @@ -0,0 +1,94 @@ +using UnityEditor; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + public abstract class PropertyDrawerBase : PropertyDrawer + { + public sealed override void OnGUI(Rect rect, SerializedProperty property, GUIContent label) + { + // Check if visible + bool visible = PropertyUtility.IsVisible(property); + if (!visible) + { + return; + } + + // Validate + ValidatorAttribute[] validatorAttributes = PropertyUtility.GetAttributes(property); + foreach (var validatorAttribute in validatorAttributes) + { + validatorAttribute.GetValidator().ValidateProperty(property); + } + + // Check if enabled and draw + EditorGUI.BeginChangeCheck(); + bool enabled = PropertyUtility.IsEnabled(property); + + using (new EditorGUI.DisabledScope(disabled: !enabled)) + { + OnGUI_Internal(rect, property, PropertyUtility.GetLabel(property)); + } + + // Call OnValueChanged callbacks + if (EditorGUI.EndChangeCheck()) + { + PropertyUtility.CallOnValueChangedCallbacks(property); + } + } + + protected abstract void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label); + + sealed override public float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + bool visible = PropertyUtility.IsVisible(property); + if (!visible) + { + return 0.0f; + } + + return GetPropertyHeight_Internal(property, label); + } + + protected virtual float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + return EditorGUI.GetPropertyHeight(property, includeChildren: true); + } + + protected float GetPropertyHeight(SerializedProperty property) + { + SpecialCaseDrawerAttribute specialCaseAttribute = PropertyUtility.GetAttribute(property); + if (specialCaseAttribute != null) + { + return specialCaseAttribute.GetDrawer().GetPropertyHeight(property); + } + + return EditorGUI.GetPropertyHeight(property, includeChildren: true); + } + + public virtual float GetHelpBoxHeight() + { + return EditorGUIUtility.singleLineHeight * 2.0f; + } + + public void DrawDefaultPropertyAndHelpBox(Rect rect, SerializedProperty property, string message, MessageType messageType) + { + float indentLength = NaughtyEditorGUI.GetIndentLength(rect); + Rect helpBoxRect = new Rect( + rect.x + indentLength, + rect.y, + rect.width - indentLength, + GetHelpBoxHeight()); + + NaughtyEditorGUI.HelpBox(helpBoxRect, message, MessageType.Warning, context: property.serializedObject.targetObject); + + Rect propertyRect = new Rect( + rect.x, + rect.y + GetHelpBoxHeight(), + rect.width, + GetPropertyHeight(property)); + + EditorGUI.PropertyField(propertyRect, property, true); + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/PropertyDrawerBase.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/PropertyDrawerBase.cs.meta new file mode 100644 index 0000000..71a80b6 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/PropertyDrawerBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 574f5fa6033f26342816a8a5f39749e5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ResizableTextAreaPropertyDrawer.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ResizableTextAreaPropertyDrawer.cs new file mode 100644 index 0000000..57c3def --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ResizableTextAreaPropertyDrawer.cs @@ -0,0 +1,80 @@ +using UnityEngine; +using UnityEditor; +using System.Text.RegularExpressions; +using System; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(ResizableTextAreaAttribute))] + public class ResizableTextAreaPropertyDrawer : PropertyDrawerBase + { + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + if (property.propertyType == SerializedPropertyType.String) + { + float labelHeight = EditorGUIUtility.singleLineHeight; + float textAreaHeight = GetTextAreaHeight(property.stringValue); + return labelHeight + textAreaHeight; + } + else + { + return GetPropertyHeight(property) + GetHelpBoxHeight(); + } + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + if (property.propertyType == SerializedPropertyType.String) + { + Rect labelRect = new Rect() + { + x = rect.x, + y = rect.y, + width = rect.width, + height = EditorGUIUtility.singleLineHeight + }; + + EditorGUI.LabelField(labelRect, label.text); + + EditorGUI.BeginChangeCheck(); + + Rect textAreaRect = new Rect() + { + x = labelRect.x, + y = labelRect.y + EditorGUIUtility.singleLineHeight, + width = labelRect.width, + height = GetTextAreaHeight(property.stringValue) + }; + + string textAreaValue = EditorGUI.TextArea(textAreaRect, property.stringValue); + + if (EditorGUI.EndChangeCheck()) + { + property.stringValue = textAreaValue; + } + } + else + { + string message = typeof(ResizableTextAreaAttribute).Name + " can only be used on string fields"; + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + } + + EditorGUI.EndProperty(); + } + + private int GetNumberOfLines(string text) + { + string content = Regex.Replace(text, @"\r\n|\n\r|\r|\n", Environment.NewLine); + string[] lines = content.Split(new string[] { Environment.NewLine }, StringSplitOptions.None); + return lines.Length; + } + + private float GetTextAreaHeight(string text) + { + float height = (EditorGUIUtility.singleLineHeight - 3.0f) * GetNumberOfLines(text) + 3.0f; + return height; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ResizableTextAreaPropertyDrawer.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ResizableTextAreaPropertyDrawer.cs.meta new file mode 100644 index 0000000..4b1e4a5 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ResizableTextAreaPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6e27ffd9a96b58c46bb74cc93de3e06f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ScenePropertyDrawer.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ScenePropertyDrawer.cs new file mode 100644 index 0000000..d87c508 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ScenePropertyDrawer.cs @@ -0,0 +1,99 @@ +using UnityEngine; +using UnityEditor; +using System.Linq; +using System.Text.RegularExpressions; +using System; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(SceneAttribute))] + public class ScenePropertyDrawer : PropertyDrawerBase + { + private const string SceneListItem = "{0} ({1})"; + private const string ScenePattern = @".+\/(.+)\.unity"; + private const string TypeWarningMessage = "{0} must be an int or a string"; + private const string BuildSettingsWarningMessage = "No scenes in the build settings"; + + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + bool validPropertyType = property.propertyType == SerializedPropertyType.String || property.propertyType == SerializedPropertyType.Integer; + bool anySceneInBuildSettings = GetScenes().Length > 0; + + return (validPropertyType && anySceneInBuildSettings) + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + string[] scenes = GetScenes(); + bool anySceneInBuildSettings = scenes.Length > 0; + if (!anySceneInBuildSettings) + { + DrawDefaultPropertyAndHelpBox(rect, property, BuildSettingsWarningMessage, MessageType.Warning); + return; + } + + string[] sceneOptions = GetSceneOptions(scenes); + switch (property.propertyType) + { + case SerializedPropertyType.String: + DrawPropertyForString(rect, property, label, scenes, sceneOptions); + break; + case SerializedPropertyType.Integer: + DrawPropertyForInt(rect, property, label, sceneOptions); + break; + default: + string message = string.Format(TypeWarningMessage, property.name); + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + break; + } + + EditorGUI.EndProperty(); + } + + private string[] GetScenes() + { + return EditorBuildSettings.scenes + .Where(scene => scene.enabled) + .Select(scene => Regex.Match(scene.path, ScenePattern).Groups[1].Value) + .ToArray(); + } + + private string[] GetSceneOptions(string[] scenes) + { + return scenes.Select((s, i) => string.Format(SceneListItem, s, i)).ToArray(); + } + + private static void DrawPropertyForString(Rect rect, SerializedProperty property, GUIContent label, string[] scenes, string[] sceneOptions) + { + int index = IndexOf(scenes, property.stringValue); + int newIndex = EditorGUI.Popup(rect, label.text, index, sceneOptions); + string newScene = scenes[newIndex]; + + if (!property.stringValue.Equals(newScene, StringComparison.Ordinal)) + { + property.stringValue = scenes[newIndex]; + } + } + + private static void DrawPropertyForInt(Rect rect, SerializedProperty property, GUIContent label, string[] sceneOptions) + { + int index = property.intValue; + int newIndex = EditorGUI.Popup(rect, label.text, index, sceneOptions); + + if (property.intValue != newIndex) + { + property.intValue = newIndex; + } + } + + private static int IndexOf(string[] scenes, string scene) + { + var index = Array.IndexOf(scenes, scene); + return Mathf.Clamp(index, 0, scenes.Length - 1); + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ScenePropertyDrawer.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ScenePropertyDrawer.cs.meta new file mode 100644 index 0000000..a416544 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ScenePropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7f5ed440d4f429e42a5da7bc5df48fd8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ShowAssetPreviewPropertyDrawer.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ShowAssetPreviewPropertyDrawer.cs new file mode 100644 index 0000000..812d732 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ShowAssetPreviewPropertyDrawer.cs @@ -0,0 +1,110 @@ +using UnityEngine; +using UnityEditor; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(ShowAssetPreviewAttribute))] + public class ShowAssetPreviewPropertyDrawer : PropertyDrawerBase + { + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + if (property.propertyType == SerializedPropertyType.ObjectReference) + { + Texture2D previewTexture = GetAssetPreview(property); + if (previewTexture != null) + { + return GetPropertyHeight(property) + GetAssetPreviewSize(property).y; + } + else + { + return GetPropertyHeight(property); + } + } + else + { + return GetPropertyHeight(property) + GetHelpBoxHeight(); + } + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + if (property.propertyType == SerializedPropertyType.ObjectReference) + { + Rect propertyRect = new Rect() + { + x = rect.x, + y = rect.y, + width = rect.width, + height = EditorGUIUtility.singleLineHeight + }; + + EditorGUI.PropertyField(propertyRect, property, label); + + Texture2D previewTexture = GetAssetPreview(property); + if (previewTexture != null) + { + Rect previewRect = new Rect() + { + x = rect.x + NaughtyEditorGUI.GetIndentLength(rect), + y = rect.y + EditorGUIUtility.singleLineHeight, + width = rect.width, + height = GetAssetPreviewSize(property).y + }; + + GUI.Label(previewRect, previewTexture); + } + } + else + { + string message = property.name + " doesn't have an asset preview"; + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + } + + EditorGUI.EndProperty(); + } + + private Texture2D GetAssetPreview(SerializedProperty property) + { + if (property.propertyType == SerializedPropertyType.ObjectReference) + { + if (property.objectReferenceValue != null) + { + Texture2D previewTexture = AssetPreview.GetAssetPreview(property.objectReferenceValue); + return previewTexture; + } + + return null; + } + + return null; + } + + private Vector2 GetAssetPreviewSize(SerializedProperty property) + { + Texture2D previewTexture = GetAssetPreview(property); + if (previewTexture == null) + { + return Vector2.zero; + } + else + { + int targetWidth = ShowAssetPreviewAttribute.DefaultWidth; + int targetHeight = ShowAssetPreviewAttribute.DefaultHeight; + + ShowAssetPreviewAttribute showAssetPreviewAttribute = PropertyUtility.GetAttribute(property); + if (showAssetPreviewAttribute != null) + { + targetWidth = showAssetPreviewAttribute.Width; + targetHeight = showAssetPreviewAttribute.Height; + } + + int width = Mathf.Clamp(targetWidth, 0, previewTexture.width); + int height = Mathf.Clamp(targetHeight, 0, previewTexture.height); + + return new Vector2(width, height); + } + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ShowAssetPreviewPropertyDrawer.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ShowAssetPreviewPropertyDrawer.cs.meta new file mode 100644 index 0000000..5a4d16d --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ShowAssetPreviewPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 24dee3fc91cfe94438de1e3c158f187f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/TagPropertyDrawer.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/TagPropertyDrawer.cs new file mode 100644 index 0000000..b91efb2 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/TagPropertyDrawer.cs @@ -0,0 +1,62 @@ +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(TagAttribute))] + public class TagPropertyDrawer : PropertyDrawerBase + { + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + return (property.propertyType == SerializedPropertyType.String) + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + if (property.propertyType == SerializedPropertyType.String) + { + // generate the taglist + custom tags + List tagList = new List(); + tagList.Add("(None)"); + tagList.Add("Untagged"); + tagList.AddRange(UnityEditorInternal.InternalEditorUtility.tags); + + string propertyString = property.stringValue; + int index = 0; + // check if there is an entry that matches the entry and get the index + // we skip index 0 as that is a special custom case + for (int i = 1; i < tagList.Count; i++) + { + if (tagList[i].Equals(propertyString, System.StringComparison.Ordinal)) + { + index = i; + break; + } + } + + // Draw the popup box with the current selected index + int newIndex = EditorGUI.Popup(rect, label.text, index, tagList.ToArray()); + + // Adjust the actual string value of the property based on the selection + string newValue = newIndex > 0 ? tagList[newIndex] : string.Empty; + + if (!property.stringValue.Equals(newValue, System.StringComparison.Ordinal)) + { + property.stringValue = newValue; + } + } + else + { + string message = string.Format("{0} supports only string fields", typeof(TagAttribute).Name); + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + } + + EditorGUI.EndProperty(); + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/TagPropertyDrawer.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/TagPropertyDrawer.cs.meta new file mode 100644 index 0000000..75f76c5 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/TagPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3df4c068c970ab6498df7a60efbde311 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase.meta new file mode 100644 index 0000000..88cd458 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 750a102004a7e4f46a2046a3d74cae19 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/ReorderableListPropertyDrawer.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/ReorderableListPropertyDrawer.cs new file mode 100644 index 0000000..2411f50 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/ReorderableListPropertyDrawer.cs @@ -0,0 +1,205 @@ +using UnityEngine; +using UnityEditor; +using UnityEditorInternal; +using System.Collections.Generic; + +namespace NaughtyAttributes.Editor +{ + public class ReorderableListPropertyDrawer : SpecialCasePropertyDrawerBase + { + public static readonly ReorderableListPropertyDrawer Instance = new ReorderableListPropertyDrawer(); + + private readonly Dictionary _reorderableListsByPropertyName = new Dictionary(); + + private GUIStyle _labelStyle; + + private GUIStyle GetLabelStyle() + { + if (_labelStyle == null) + { + _labelStyle = new GUIStyle(EditorStyles.boldLabel); + _labelStyle.richText = true; + } + + return _labelStyle; + } + + private string GetPropertyKeyName(SerializedProperty property) + { + return property.serializedObject.targetObject.GetInstanceID() + "." + property.name; + } + + protected override float GetPropertyHeight_Internal(SerializedProperty property) + { + if (property.isArray) + { + string key = GetPropertyKeyName(property); + + if (_reorderableListsByPropertyName.TryGetValue(key, out ReorderableList reorderableList) == false) + { + return 0; + } + + return reorderableList.GetHeight(); + } + + return EditorGUI.GetPropertyHeight(property, true); + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + if (property.isArray) + { + string key = GetPropertyKeyName(property); + + ReorderableList reorderableList = null; + if (!_reorderableListsByPropertyName.ContainsKey(key)) + { + reorderableList = new ReorderableList(property.serializedObject, property, true, true, true, true) + { + drawHeaderCallback = (Rect r) => + { + EditorGUI.LabelField(r, string.Format("{0}: {1}", label.text, property.arraySize), GetLabelStyle()); + HandleDragAndDrop(r, reorderableList); + }, + + drawElementCallback = (Rect r, int index, bool isActive, bool isFocused) => + { + SerializedProperty element = property.GetArrayElementAtIndex(index); + r.y += 1.0f; + r.x += 10.0f; + r.width -= 10.0f; + + EditorGUI.PropertyField(new Rect(r.x, r.y, r.width, EditorGUIUtility.singleLineHeight), element, true); + }, + + elementHeightCallback = (int index) => + { + return EditorGUI.GetPropertyHeight(property.GetArrayElementAtIndex(index)) + 4.0f; + } + }; + + _reorderableListsByPropertyName[key] = reorderableList; + } + + reorderableList = _reorderableListsByPropertyName[key]; + + if (rect == default) + { + reorderableList.DoLayoutList(); + } + else + { + reorderableList.DoList(rect); + } + } + else + { + string message = typeof(ReorderableListAttribute).Name + " can be used only on arrays or lists"; + NaughtyEditorGUI.HelpBox_Layout(message, MessageType.Warning, context: property.serializedObject.targetObject); + EditorGUILayout.PropertyField(property, true); + } + } + + public void ClearCache() + { + _reorderableListsByPropertyName.Clear(); + } + + private Object GetAssignableObject(Object obj, ReorderableList list) + { + System.Type listType = PropertyUtility.GetPropertyType(list.serializedProperty); + System.Type elementType = ReflectionUtility.GetListElementType(listType); + + if (elementType == null) + { + return null; + } + + System.Type objType = obj.GetType(); + + if (elementType.IsAssignableFrom(objType)) + { + return obj; + } + + if (objType == typeof(GameObject)) + { + if (typeof(Transform).IsAssignableFrom(elementType)) + { + Transform transform = ((GameObject)obj).transform; + if (elementType == typeof(RectTransform)) + { + RectTransform rectTransform = transform as RectTransform; + return rectTransform; + } + else + { + return transform; + } + } + else if (typeof(MonoBehaviour).IsAssignableFrom(elementType)) + { + return ((GameObject)obj).GetComponent(elementType); + } + } + + return null; + } + + private void HandleDragAndDrop(Rect rect, ReorderableList list) + { + var currentEvent = Event.current; + var usedEvent = false; + + switch (currentEvent.type) + { + case EventType.DragExited: + if (GUI.enabled) + { + HandleUtility.Repaint(); + } + + break; + + case EventType.DragUpdated: + case EventType.DragPerform: + if (rect.Contains(currentEvent.mousePosition) && GUI.enabled) + { + // Check each single object, so we can add multiple objects in a single drag. + bool didAcceptDrag = false; + Object[] references = DragAndDrop.objectReferences; + foreach (Object obj in references) + { + Object assignableObject = GetAssignableObject(obj, list); + if (assignableObject != null) + { + DragAndDrop.visualMode = DragAndDropVisualMode.Copy; + if (currentEvent.type == EventType.DragPerform) + { + list.serializedProperty.arraySize++; + int arrayEnd = list.serializedProperty.arraySize - 1; + list.serializedProperty.GetArrayElementAtIndex(arrayEnd).objectReferenceValue = assignableObject; + didAcceptDrag = true; + } + } + } + + if (didAcceptDrag) + { + GUI.changed = true; + DragAndDrop.AcceptDrag(); + usedEvent = true; + } + } + + break; + } + + if (usedEvent) + { + currentEvent.Use(); + } + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/ReorderableListPropertyDrawer.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/ReorderableListPropertyDrawer.cs.meta new file mode 100644 index 0000000..4ff1a66 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/ReorderableListPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bf36691a6d456564db2fcbfa8726b3f3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/SpecialCasePropertyDrawerBase.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/SpecialCasePropertyDrawerBase.cs new file mode 100644 index 0000000..dd47ad2 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/SpecialCasePropertyDrawerBase.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + public abstract class SpecialCasePropertyDrawerBase + { + public void OnGUI(Rect rect, SerializedProperty property) + { + // Check if visible + bool visible = PropertyUtility.IsVisible(property); + if (!visible) + { + return; + } + + // Validate + ValidatorAttribute[] validatorAttributes = PropertyUtility.GetAttributes(property); + foreach (var validatorAttribute in validatorAttributes) + { + validatorAttribute.GetValidator().ValidateProperty(property); + } + + // Check if enabled and draw + EditorGUI.BeginChangeCheck(); + bool enabled = PropertyUtility.IsEnabled(property); + + using (new EditorGUI.DisabledScope(disabled: !enabled)) + { + OnGUI_Internal(rect, property, PropertyUtility.GetLabel(property)); + } + + // Call OnValueChanged callbacks + if (EditorGUI.EndChangeCheck()) + { + PropertyUtility.CallOnValueChangedCallbacks(property); + } + } + + public float GetPropertyHeight(SerializedProperty property) + { + return GetPropertyHeight_Internal(property); + } + + protected abstract void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label); + protected abstract float GetPropertyHeight_Internal(SerializedProperty property); + } + + public static class SpecialCaseDrawerAttributeExtensions + { + private static Dictionary _drawersByAttributeType; + + static SpecialCaseDrawerAttributeExtensions() + { + _drawersByAttributeType = new Dictionary(); + _drawersByAttributeType[typeof(ReorderableListAttribute)] = ReorderableListPropertyDrawer.Instance; + } + + public static SpecialCasePropertyDrawerBase GetDrawer(this SpecialCaseDrawerAttribute attr) + { + SpecialCasePropertyDrawerBase drawer; + if (_drawersByAttributeType.TryGetValue(attr.GetType(), out drawer)) + { + return drawer; + } + else + { + return null; + } + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/SpecialCasePropertyDrawerBase.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/SpecialCasePropertyDrawerBase.cs.meta new file mode 100644 index 0000000..c60287c --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/SpecialCasePropertyDrawerBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 771776453ad34b045a41dea54856fa12 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators.meta new file mode 100644 index 0000000..949d96d --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 41caedece93df91439d624dc9d124424 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/MaxValuePropertyValidator.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/MaxValuePropertyValidator.cs new file mode 100644 index 0000000..809803e --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/MaxValuePropertyValidator.cs @@ -0,0 +1,53 @@ +using UnityEngine; +using UnityEditor; + +namespace NaughtyAttributes.Editor +{ + public class MaxValuePropertyValidator : PropertyValidatorBase + { + public override void ValidateProperty(SerializedProperty property) + { + MaxValueAttribute maxValueAttribute = PropertyUtility.GetAttribute(property); + + if (property.propertyType == SerializedPropertyType.Integer) + { + if (property.intValue > maxValueAttribute.MaxValue) + { + property.intValue = (int)maxValueAttribute.MaxValue; + } + } + else if (property.propertyType == SerializedPropertyType.Float) + { + if (property.floatValue > maxValueAttribute.MaxValue) + { + property.floatValue = maxValueAttribute.MaxValue; + } + } + else if (property.propertyType == SerializedPropertyType.Vector2) + { + property.vector2Value = Vector2.Min(property.vector2Value, new Vector2(maxValueAttribute.MaxValue, maxValueAttribute.MaxValue)); + } + else if (property.propertyType == SerializedPropertyType.Vector3) + { + property.vector3Value = Vector3.Min(property.vector3Value, new Vector3(maxValueAttribute.MaxValue, maxValueAttribute.MaxValue, maxValueAttribute.MaxValue)); + } + else if (property.propertyType == SerializedPropertyType.Vector4) + { + property.vector4Value = Vector4.Min(property.vector4Value, new Vector4(maxValueAttribute.MaxValue, maxValueAttribute.MaxValue, maxValueAttribute.MaxValue, maxValueAttribute.MaxValue)); + } + else if (property.propertyType == SerializedPropertyType.Vector2Int) + { + property.vector2IntValue = Vector2Int.Min(property.vector2IntValue, new Vector2Int((int)maxValueAttribute.MaxValue, (int)maxValueAttribute.MaxValue)); + } + else if (property.propertyType == SerializedPropertyType.Vector3Int) + { + property.vector3IntValue = Vector3Int.Min(property.vector3IntValue, new Vector3Int((int)maxValueAttribute.MaxValue, (int)maxValueAttribute.MaxValue, (int)maxValueAttribute.MaxValue)); + } + else + { + string warning = maxValueAttribute.GetType().Name + " can be used only on int, float, Vector or VectorInt fields"; + Debug.LogWarning(warning, property.serializedObject.targetObject); + } + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/MaxValuePropertyValidator.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/MaxValuePropertyValidator.cs.meta new file mode 100644 index 0000000..3e809ac --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/MaxValuePropertyValidator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 627b8e9e7bda6fa408c6f47fb8285665 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/MinValuePropertyValidator.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/MinValuePropertyValidator.cs new file mode 100644 index 0000000..f63088d --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/MinValuePropertyValidator.cs @@ -0,0 +1,53 @@ +using UnityEngine; +using UnityEditor; + +namespace NaughtyAttributes.Editor +{ + public class MinValuePropertyValidator : PropertyValidatorBase + { + public override void ValidateProperty(SerializedProperty property) + { + MinValueAttribute minValueAttribute = PropertyUtility.GetAttribute(property); + + if (property.propertyType == SerializedPropertyType.Integer) + { + if (property.intValue < minValueAttribute.MinValue) + { + property.intValue = (int)minValueAttribute.MinValue; + } + } + else if (property.propertyType == SerializedPropertyType.Float) + { + if (property.floatValue < minValueAttribute.MinValue) + { + property.floatValue = minValueAttribute.MinValue; + } + } + else if (property.propertyType == SerializedPropertyType.Vector2) + { + property.vector2Value = Vector2.Max(property.vector2Value, new Vector2(minValueAttribute.MinValue, minValueAttribute.MinValue)); + } + else if (property.propertyType == SerializedPropertyType.Vector3) + { + property.vector3Value = Vector3.Max(property.vector3Value, new Vector3(minValueAttribute.MinValue, minValueAttribute.MinValue, minValueAttribute.MinValue)); + } + else if (property.propertyType == SerializedPropertyType.Vector4) + { + property.vector4Value = Vector4.Max(property.vector4Value, new Vector4(minValueAttribute.MinValue, minValueAttribute.MinValue, minValueAttribute.MinValue, minValueAttribute.MinValue)); + } + else if (property.propertyType == SerializedPropertyType.Vector2Int) + { + property.vector2IntValue = Vector2Int.Max(property.vector2IntValue, new Vector2Int((int)minValueAttribute.MinValue, (int)minValueAttribute.MinValue)); + } + else if (property.propertyType == SerializedPropertyType.Vector3Int) + { + property.vector3IntValue = Vector3Int.Max(property.vector3IntValue, new Vector3Int((int)minValueAttribute.MinValue, (int)minValueAttribute.MinValue, (int)minValueAttribute.MinValue)); + } + else + { + string warning = minValueAttribute.GetType().Name + " can be used only on int, float, Vector or VectorInt fields"; + Debug.LogWarning(warning, property.serializedObject.targetObject); + } + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/MinValuePropertyValidator.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/MinValuePropertyValidator.cs.meta new file mode 100644 index 0000000..b3bb871 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/MinValuePropertyValidator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 03dd23f6c0598074fb1b721dcd8fe023 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/PropertyValidatorBase.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/PropertyValidatorBase.cs new file mode 100644 index 0000000..fed61af --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/PropertyValidatorBase.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using UnityEditor; + +namespace NaughtyAttributes.Editor +{ + public abstract class PropertyValidatorBase + { + public abstract void ValidateProperty(SerializedProperty property); + } + + public static class ValidatorAttributeExtensions + { + private static Dictionary _validatorsByAttributeType; + + static ValidatorAttributeExtensions() + { + _validatorsByAttributeType = new Dictionary(); + _validatorsByAttributeType[typeof(MinValueAttribute)] = new MinValuePropertyValidator(); + _validatorsByAttributeType[typeof(MaxValueAttribute)] = new MaxValuePropertyValidator(); + _validatorsByAttributeType[typeof(RequiredAttribute)] = new RequiredPropertyValidator(); + _validatorsByAttributeType[typeof(ValidateInputAttribute)] = new ValidateInputPropertyValidator(); + } + + public static PropertyValidatorBase GetValidator(this ValidatorAttribute attr) + { + PropertyValidatorBase validator; + if (_validatorsByAttributeType.TryGetValue(attr.GetType(), out validator)) + { + return validator; + } + else + { + return null; + } + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/PropertyValidatorBase.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/PropertyValidatorBase.cs.meta new file mode 100644 index 0000000..97fe581 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/PropertyValidatorBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f332c8e1c3627d742aa9158af7b02ccc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/RequiredPropertyValidator.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/RequiredPropertyValidator.cs new file mode 100644 index 0000000..6ad8090 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/RequiredPropertyValidator.cs @@ -0,0 +1,31 @@ +using UnityEditor; + +namespace NaughtyAttributes.Editor +{ + public class RequiredPropertyValidator : PropertyValidatorBase + { + public override void ValidateProperty(SerializedProperty property) + { + RequiredAttribute requiredAttribute = PropertyUtility.GetAttribute(property); + + if (property.propertyType == SerializedPropertyType.ObjectReference) + { + if (property.objectReferenceValue == null) + { + string errorMessage = property.name + " is required"; + if (!string.IsNullOrEmpty(requiredAttribute.Message)) + { + errorMessage = requiredAttribute.Message; + } + + NaughtyEditorGUI.HelpBox_Layout(errorMessage, MessageType.Error, context: property.serializedObject.targetObject); + } + } + else + { + string warning = requiredAttribute.GetType().Name + " works only on reference types"; + NaughtyEditorGUI.HelpBox_Layout(warning, MessageType.Warning, context: property.serializedObject.targetObject); + } + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/RequiredPropertyValidator.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/RequiredPropertyValidator.cs.meta new file mode 100644 index 0000000..d24143a --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/RequiredPropertyValidator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3a7e657ea45f6414682b5f41be9541b4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/ValidateInputPropertyValidator.cs b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/ValidateInputPropertyValidator.cs new file mode 100644 index 0000000..f7cca86 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/ValidateInputPropertyValidator.cs @@ -0,0 +1,75 @@ +using UnityEditor; +using System.Reflection; +using System; + +namespace NaughtyAttributes.Editor +{ + public class ValidateInputPropertyValidator : PropertyValidatorBase + { + public override void ValidateProperty(SerializedProperty property) + { + ValidateInputAttribute validateInputAttribute = PropertyUtility.GetAttribute(property); + object target = PropertyUtility.GetTargetObjectWithProperty(property); + + MethodInfo validationCallback = ReflectionUtility.GetMethod(target, validateInputAttribute.CallbackName); + + if (validationCallback != null && + validationCallback.ReturnType == typeof(bool)) + { + ParameterInfo[] callbackParameters = validationCallback.GetParameters(); + + if (callbackParameters.Length == 0) { + if (!(bool)validationCallback.Invoke(target, null)) + { + if (string.IsNullOrEmpty(validateInputAttribute.Message)) + { + NaughtyEditorGUI.HelpBox_Layout( + property.name + " is not valid", MessageType.Error, context: property.serializedObject.targetObject); + } + else + { + NaughtyEditorGUI.HelpBox_Layout( + validateInputAttribute.Message, MessageType.Error, context: property.serializedObject.targetObject); + } + } + } + else if (callbackParameters.Length == 1) + { + FieldInfo fieldInfo = ReflectionUtility.GetField(target, property.name); + Type fieldType = fieldInfo.FieldType; + Type parameterType = callbackParameters[0].ParameterType; + + if (fieldType == parameterType) + { + if (!(bool)validationCallback.Invoke(target, new object[] { fieldInfo.GetValue(target) })) + { + if (string.IsNullOrEmpty(validateInputAttribute.Message)) + { + NaughtyEditorGUI.HelpBox_Layout( + property.name + " is not valid", MessageType.Error, context: property.serializedObject.targetObject); + } + else + { + NaughtyEditorGUI.HelpBox_Layout( + validateInputAttribute.Message, MessageType.Error, context: property.serializedObject.targetObject); + } + } + } + else + { + string warning = "The field type is not the same as the callback's parameter type"; + NaughtyEditorGUI.HelpBox_Layout(warning, MessageType.Warning, context: property.serializedObject.targetObject); + } + } + else + { + string warning = + validateInputAttribute.GetType().Name + + " needs a callback with boolean return type and an optional single parameter of the same type as the field"; + + NaughtyEditorGUI.HelpBox_Layout(warning, MessageType.Warning, context: property.serializedObject.targetObject); + } + } + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/ValidateInputPropertyValidator.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/ValidateInputPropertyValidator.cs.meta new file mode 100644 index 0000000..3f6e539 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/PropertyValidators/ValidateInputPropertyValidator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5f6adf84ed53a7840a456e8b4dce38d9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/Utility.meta b/Assets/NaughtyAttributes/Scripts/Editor/Utility.meta new file mode 100644 index 0000000..40e857c --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/Utility.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: acb4475c71a3fe947a81ced84ab89c6d +folderAsset: yes +timeCreated: 1508062761 +licenseType: Store +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/Utility/ButtonUtility.cs b/Assets/NaughtyAttributes/Scripts/Editor/Utility/ButtonUtility.cs new file mode 100644 index 0000000..0934a23 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/Utility/ButtonUtility.cs @@ -0,0 +1,55 @@ +using UnityEngine; +using System.Reflection; +using System.Collections.Generic; + +namespace NaughtyAttributes.Editor +{ + public static class ButtonUtility + { + public static bool IsEnabled(Object target, MethodInfo method) + { + EnableIfAttributeBase enableIfAttribute = method.GetCustomAttribute(); + if (enableIfAttribute == null) + { + return true; + } + + List conditionValues = PropertyUtility.GetConditionValues(target, enableIfAttribute.Conditions); + if (conditionValues.Count > 0) + { + bool enabled = PropertyUtility.GetConditionsFlag(conditionValues, enableIfAttribute.ConditionOperator, enableIfAttribute.Inverted); + return enabled; + } + else + { + string message = enableIfAttribute.GetType().Name + " needs a valid boolean condition field, property or method name to work"; + Debug.LogWarning(message, target); + + return false; + } + } + + public static bool IsVisible(Object target, MethodInfo method) + { + ShowIfAttributeBase showIfAttribute = method.GetCustomAttribute(); + if (showIfAttribute == null) + { + return true; + } + + List conditionValues = PropertyUtility.GetConditionValues(target, showIfAttribute.Conditions); + if (conditionValues.Count > 0) + { + bool enabled = PropertyUtility.GetConditionsFlag(conditionValues, showIfAttribute.ConditionOperator, showIfAttribute.Inverted); + return enabled; + } + else + { + string message = showIfAttribute.GetType().Name + " needs a valid boolean condition field, property or method name to work"; + Debug.LogWarning(message, target); + + return false; + } + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/Utility/ButtonUtility.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/Utility/ButtonUtility.cs.meta new file mode 100644 index 0000000..cf4dace --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/Utility/ButtonUtility.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a273f81125ec52d4cb5dec2228afda0e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/Utility/NaughtyEditorGUI.cs b/Assets/NaughtyAttributes/Scripts/Editor/Utility/NaughtyEditorGUI.cs new file mode 100644 index 0000000..e7cce29 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/Utility/NaughtyEditorGUI.cs @@ -0,0 +1,379 @@ +using System; +using System.Collections; +using System.Linq; +using System.Reflection; +using UnityEditor; +using UnityEditor.Experimental.SceneManagement; +using UnityEditor.SceneManagement; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + public static class NaughtyEditorGUI + { + public const float IndentLength = 15.0f; + public const float HorizontalSpacing = 2.0f; + + private static GUIStyle _buttonStyle = new GUIStyle(GUI.skin.button) { richText = true }; + + private delegate void PropertyFieldFunction(Rect rect, SerializedProperty property, GUIContent label, bool includeChildren); + + public static void PropertyField(Rect rect, SerializedProperty property, bool includeChildren) + { + PropertyField_Implementation(rect, property, includeChildren, DrawPropertyField); + } + + public static void PropertyField_Layout(SerializedProperty property, bool includeChildren) + { + Rect dummyRect = new Rect(); + PropertyField_Implementation(dummyRect, property, includeChildren, DrawPropertyField_Layout); + } + + private static void DrawPropertyField(Rect rect, SerializedProperty property, GUIContent label, bool includeChildren) + { + EditorGUI.PropertyField(rect, property, label, includeChildren); + } + + private static void DrawPropertyField_Layout(Rect rect, SerializedProperty property, GUIContent label, bool includeChildren) + { + EditorGUILayout.PropertyField(property, label, includeChildren); + } + + private static void PropertyField_Implementation(Rect rect, SerializedProperty property, bool includeChildren, PropertyFieldFunction propertyFieldFunction) + { + SpecialCaseDrawerAttribute specialCaseAttribute = PropertyUtility.GetAttribute(property); + if (specialCaseAttribute != null) + { + specialCaseAttribute.GetDrawer().OnGUI(rect, property); + } + else + { + // Check if visible + bool visible = PropertyUtility.IsVisible(property); + if (!visible) + { + return; + } + + // Validate + ValidatorAttribute[] validatorAttributes = PropertyUtility.GetAttributes(property); + foreach (var validatorAttribute in validatorAttributes) + { + validatorAttribute.GetValidator().ValidateProperty(property); + } + + // Check if enabled and draw + EditorGUI.BeginChangeCheck(); + bool enabled = PropertyUtility.IsEnabled(property); + + using (new EditorGUI.DisabledScope(disabled: !enabled)) + { + propertyFieldFunction.Invoke(rect, property, PropertyUtility.GetLabel(property), includeChildren); + } + + // Call OnValueChanged callbacks + if (EditorGUI.EndChangeCheck()) + { + PropertyUtility.CallOnValueChangedCallbacks(property); + } + } + } + + public static float GetIndentLength(Rect sourceRect) + { + Rect indentRect = EditorGUI.IndentedRect(sourceRect); + float indentLength = indentRect.x - sourceRect.x; + + return indentLength; + } + + public static void BeginBoxGroup_Layout(string label = "") + { + EditorGUILayout.BeginVertical(GUI.skin.box); + if (!string.IsNullOrEmpty(label)) + { + EditorGUILayout.LabelField(label, EditorStyles.boldLabel); + } + } + + public static void EndBoxGroup_Layout() + { + EditorGUILayout.EndVertical(); + } + + /// + /// Creates a dropdown + /// + /// The rect the defines the position and size of the dropdown in the inspector + /// The serialized object that is being updated + /// The target object that contains the dropdown + /// The field of the target object that holds the currently selected dropdown value + /// The label of the dropdown + /// The index of the value from the values array + /// The values of the dropdown + /// The display options for the values + public static void Dropdown( + Rect rect, SerializedObject serializedObject, object target, FieldInfo dropdownField, + string label, int selectedValueIndex, object[] values, string[] displayOptions) + { + EditorGUI.BeginChangeCheck(); + + int newIndex = EditorGUI.Popup(rect, label, selectedValueIndex, displayOptions); + object newValue = values[newIndex]; + + if (!dropdownField.GetValue(target).Equals(newValue)) + { + Undo.RecordObject(serializedObject.targetObject, "Dropdown"); + + // TODO: Problem with structs, because they are value type. + // The solution is to make boxing/unboxing but unfortunately I don't know the compile time type of the target object + dropdownField.SetValue(target, newValue); + } + } + + public static void Button(UnityEngine.Object target, MethodInfo methodInfo) + { + bool visible = ButtonUtility.IsVisible(target, methodInfo); + if (!visible) + { + return; + } + + if (methodInfo.GetParameters().All(p => p.IsOptional)) + { + ButtonAttribute buttonAttribute = (ButtonAttribute)methodInfo.GetCustomAttributes(typeof(ButtonAttribute), true)[0]; + string buttonText = string.IsNullOrEmpty(buttonAttribute.Text) ? ObjectNames.NicifyVariableName(methodInfo.Name) : buttonAttribute.Text; + + bool buttonEnabled = ButtonUtility.IsEnabled(target, methodInfo); + + EButtonEnableMode mode = buttonAttribute.SelectedEnableMode; + buttonEnabled &= + mode == EButtonEnableMode.Always || + mode == EButtonEnableMode.Editor && !Application.isPlaying || + mode == EButtonEnableMode.Playmode && Application.isPlaying; + + bool methodIsCoroutine = methodInfo.ReturnType == typeof(IEnumerator); + if (methodIsCoroutine) + { + buttonEnabled &= (Application.isPlaying ? true : false); + } + + EditorGUI.BeginDisabledGroup(!buttonEnabled); + + if (GUILayout.Button(buttonText, _buttonStyle)) + { + object[] defaultParams = methodInfo.GetParameters().Select(p => p.DefaultValue).ToArray(); + IEnumerator methodResult = methodInfo.Invoke(target, defaultParams) as IEnumerator; + + if (!Application.isPlaying) + { + // Set target object and scene dirty to serialize changes to disk + EditorUtility.SetDirty(target); + + PrefabStage stage = PrefabStageUtility.GetCurrentPrefabStage(); + if (stage != null) + { + // Prefab mode + EditorSceneManager.MarkSceneDirty(stage.scene); + } + else + { + // Normal scene + EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); + } + } + else if (methodResult != null && target is MonoBehaviour behaviour) + { + behaviour.StartCoroutine(methodResult); + } + } + + EditorGUI.EndDisabledGroup(); + } + else + { + string warning = typeof(ButtonAttribute).Name + " works only on methods with no parameters"; + HelpBox_Layout(warning, MessageType.Warning, context: target, logToConsole: true); + } + } + + public static void NativeProperty_Layout(UnityEngine.Object target, PropertyInfo property) + { + object value = property.GetValue(target, null); + + if (value == null) + { + string warning = string.Format("{0} is null. {1} doesn't support reference types with null value", property.Name, typeof(ShowNativePropertyAttribute).Name); + HelpBox_Layout(warning, MessageType.Warning, context: target); + } + else if (!Field_Layout(value, property.Name)) + { + string warning = string.Format("{0} doesn't support {1} types", typeof(ShowNativePropertyAttribute).Name, property.PropertyType.Name); + HelpBox_Layout(warning, MessageType.Warning, context: target); + } + } + + public static void NonSerializedField_Layout(UnityEngine.Object target, FieldInfo field) + { + object value = field.GetValue(target); + + if (value == null) + { + string warning = string.Format("{0} is null. {1} doesn't support reference types with null value", field.Name, typeof(ShowNonSerializedFieldAttribute).Name); + HelpBox_Layout(warning, MessageType.Warning, context: target); + } + else if (!Field_Layout(value, field.Name)) + { + string warning = string.Format("{0} doesn't support {1} types", typeof(ShowNonSerializedFieldAttribute).Name, field.FieldType.Name); + HelpBox_Layout(warning, MessageType.Warning, context: target); + } + } + + public static void HorizontalLine(Rect rect, float height, Color color) + { + rect.height = height; + EditorGUI.DrawRect(rect, color); + } + + public static void HelpBox(Rect rect, string message, MessageType type, UnityEngine.Object context = null, bool logToConsole = false) + { + EditorGUI.HelpBox(rect, message, type); + + if (logToConsole) + { + DebugLogMessage(message, type, context); + } + } + + public static void HelpBox_Layout(string message, MessageType type, UnityEngine.Object context = null, bool logToConsole = false) + { + EditorGUILayout.HelpBox(message, type); + + if (logToConsole) + { + DebugLogMessage(message, type, context); + } + } + + public static bool Field_Layout(object value, string label) + { + using (new EditorGUI.DisabledScope(disabled: true)) + { + bool isDrawn = true; + Type valueType = value.GetType(); + + if (valueType == typeof(bool)) + { + EditorGUILayout.Toggle(label, (bool)value); + } + else if (valueType == typeof(short)) + { + EditorGUILayout.IntField(label, (short)value); + } + else if (valueType == typeof(ushort)) + { + EditorGUILayout.IntField(label, (ushort)value); + } + else if (valueType == typeof(int)) + { + EditorGUILayout.IntField(label, (int)value); + } + else if (valueType == typeof(uint)) + { + EditorGUILayout.LongField(label, (uint)value); + } + else if (valueType == typeof(long)) + { + EditorGUILayout.LongField(label, (long)value); + } + else if (valueType == typeof(ulong)) + { + EditorGUILayout.TextField(label, ((ulong)value).ToString()); + } + else if (valueType == typeof(float)) + { + EditorGUILayout.FloatField(label, (float)value); + } + else if (valueType == typeof(double)) + { + EditorGUILayout.DoubleField(label, (double)value); + } + else if (valueType == typeof(string)) + { + EditorGUILayout.TextField(label, (string)value); + } + else if (valueType == typeof(Vector2)) + { + EditorGUILayout.Vector2Field(label, (Vector2)value); + } + else if (valueType == typeof(Vector3)) + { + EditorGUILayout.Vector3Field(label, (Vector3)value); + } + else if (valueType == typeof(Vector4)) + { + EditorGUILayout.Vector4Field(label, (Vector4)value); + } + else if (valueType == typeof(Vector2Int)) + { + EditorGUILayout.Vector2IntField(label, (Vector2Int)value); + } + else if (valueType == typeof(Vector3Int)) + { + EditorGUILayout.Vector3IntField(label, (Vector3Int)value); + } + else if (valueType == typeof(Color)) + { + EditorGUILayout.ColorField(label, (Color)value); + } + else if (valueType == typeof(Bounds)) + { + EditorGUILayout.BoundsField(label, (Bounds)value); + } + else if (valueType == typeof(Rect)) + { + EditorGUILayout.RectField(label, (Rect)value); + } + else if (valueType == typeof(RectInt)) + { + EditorGUILayout.RectIntField(label, (RectInt)value); + } + else if (typeof(UnityEngine.Object).IsAssignableFrom(valueType)) + { + EditorGUILayout.ObjectField(label, (UnityEngine.Object)value, valueType, true); + } + else if (valueType.BaseType == typeof(Enum)) + { + EditorGUILayout.EnumPopup(label, (Enum)value); + } + else if (valueType.BaseType == typeof(System.Reflection.TypeInfo)) + { + EditorGUILayout.TextField(label, value.ToString()); + } + else + { + isDrawn = false; + } + + return isDrawn; + } + } + + private static void DebugLogMessage(string message, MessageType type, UnityEngine.Object context) + { + switch (type) + { + case MessageType.None: + case MessageType.Info: + Debug.Log(message, context); + break; + case MessageType.Warning: + Debug.LogWarning(message, context); + break; + case MessageType.Error: + Debug.LogError(message, context); + break; + } + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/Utility/NaughtyEditorGUI.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/Utility/NaughtyEditorGUI.cs.meta new file mode 100644 index 0000000..782824e --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/Utility/NaughtyEditorGUI.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 6ff27ff7705d6064e935bb2159a1b453 +timeCreated: 1510926159 +licenseType: Store +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/Utility/PropertyUtility.cs b/Assets/NaughtyAttributes/Scripts/Editor/Utility/PropertyUtility.cs new file mode 100644 index 0000000..f30651d --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/Utility/PropertyUtility.cs @@ -0,0 +1,374 @@ +using UnityEditor; +using System.Reflection; +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + public static class PropertyUtility + { + public static T GetAttribute(SerializedProperty property) where T : class + { + T[] attributes = GetAttributes(property); + return (attributes.Length > 0) ? attributes[0] : null; + } + + public static T[] GetAttributes(SerializedProperty property) where T : class + { + FieldInfo fieldInfo = ReflectionUtility.GetField(GetTargetObjectWithProperty(property), property.name); + if (fieldInfo == null) + { + return new T[] { }; + } + + return (T[])fieldInfo.GetCustomAttributes(typeof(T), true); + } + + public static GUIContent GetLabel(SerializedProperty property) + { + LabelAttribute labelAttribute = GetAttribute(property); + string labelText = (labelAttribute == null) + ? property.displayName + : labelAttribute.Label; + + GUIContent label = new GUIContent(labelText); + return label; + } + + public static void CallOnValueChangedCallbacks(SerializedProperty property) + { + OnValueChangedAttribute[] onValueChangedAttributes = GetAttributes(property); + if (onValueChangedAttributes.Length == 0) + { + return; + } + + object target = GetTargetObjectWithProperty(property); + property.serializedObject.ApplyModifiedProperties(); // We must apply modifications so that the new value is updated in the serialized object + + foreach (var onValueChangedAttribute in onValueChangedAttributes) + { + MethodInfo callbackMethod = ReflectionUtility.GetMethod(target, onValueChangedAttribute.CallbackName); + if (callbackMethod != null && + callbackMethod.ReturnType == typeof(void) && + callbackMethod.GetParameters().Length == 0) + { + callbackMethod.Invoke(target, new object[] { }); + } + else + { + string warning = string.Format( + "{0} can invoke only methods with 'void' return type and 0 parameters", + onValueChangedAttribute.GetType().Name); + + Debug.LogWarning(warning, property.serializedObject.targetObject); + } + } + } + + public static bool IsEnabled(SerializedProperty property) + { + ReadOnlyAttribute readOnlyAttribute = GetAttribute(property); + if (readOnlyAttribute != null) + { + return false; + } + + EnableIfAttributeBase enableIfAttribute = GetAttribute(property); + if (enableIfAttribute == null) + { + return true; + } + + object target = GetTargetObjectWithProperty(property); + + // deal with enum conditions + if (enableIfAttribute.EnumValue != null) + { + Enum value = GetEnumValue(target, enableIfAttribute.Conditions[0]); + if (value != null) + { + bool matched = value.GetType().GetCustomAttribute() == null + ? enableIfAttribute.EnumValue.Equals(value) + : value.HasFlag(enableIfAttribute.EnumValue); + + return matched != enableIfAttribute.Inverted; + } + + string message = enableIfAttribute.GetType().Name + " needs a valid enum field, property or method name to work"; + Debug.LogWarning(message, property.serializedObject.targetObject); + + return false; + } + + // deal with normal conditions + List conditionValues = GetConditionValues(target, enableIfAttribute.Conditions); + if (conditionValues.Count > 0) + { + bool enabled = GetConditionsFlag(conditionValues, enableIfAttribute.ConditionOperator, enableIfAttribute.Inverted); + return enabled; + } + else + { + string message = enableIfAttribute.GetType().Name + " needs a valid boolean condition field, property or method name to work"; + Debug.LogWarning(message, property.serializedObject.targetObject); + + return false; + } + } + + public static bool IsVisible(SerializedProperty property) + { + ShowIfAttributeBase showIfAttribute = GetAttribute(property); + if (showIfAttribute == null) + { + return true; + } + + object target = GetTargetObjectWithProperty(property); + + // deal with enum conditions + if (showIfAttribute.EnumValue != null) + { + Enum value = GetEnumValue(target, showIfAttribute.Conditions[0]); + if (value != null) + { + bool matched = value.GetType().GetCustomAttribute() == null + ? showIfAttribute.EnumValue.Equals(value) + : value.HasFlag(showIfAttribute.EnumValue); + + return matched != showIfAttribute.Inverted; + } + + string message = showIfAttribute.GetType().Name + " needs a valid enum field, property or method name to work"; + Debug.LogWarning(message, property.serializedObject.targetObject); + + return false; + } + + // deal with normal conditions + List conditionValues = GetConditionValues(target, showIfAttribute.Conditions); + if (conditionValues.Count > 0) + { + bool enabled = GetConditionsFlag(conditionValues, showIfAttribute.ConditionOperator, showIfAttribute.Inverted); + return enabled; + } + else + { + string message = showIfAttribute.GetType().Name + " needs a valid boolean condition field, property or method name to work"; + Debug.LogWarning(message, property.serializedObject.targetObject); + + return false; + } + } + + /// + /// Gets an enum value from reflection. + /// + /// The target object. + /// Name of a field, property, or method that returns an enum. + /// Null if can't find an enum value. + internal static Enum GetEnumValue(object target, string enumName) + { + FieldInfo enumField = ReflectionUtility.GetField(target, enumName); + if (enumField != null && enumField.FieldType.IsSubclassOf(typeof(Enum))) + { + return (Enum)enumField.GetValue(target); + } + + PropertyInfo enumProperty = ReflectionUtility.GetProperty(target, enumName); + if (enumProperty != null && enumProperty.PropertyType.IsSubclassOf(typeof(Enum))) + { + return (Enum)enumProperty.GetValue(target); + } + + MethodInfo enumMethod = ReflectionUtility.GetMethod(target, enumName); + if (enumMethod != null && enumMethod.ReturnType.IsSubclassOf(typeof(Enum))) + { + return (Enum)enumMethod.Invoke(target, null); + } + + return null; + } + + internal static List GetConditionValues(object target, string[] conditions) + { + List conditionValues = new List(); + foreach (var condition in conditions) + { + FieldInfo conditionField = ReflectionUtility.GetField(target, condition); + if (conditionField != null && + conditionField.FieldType == typeof(bool)) + { + conditionValues.Add((bool)conditionField.GetValue(target)); + } + + PropertyInfo conditionProperty = ReflectionUtility.GetProperty(target, condition); + if (conditionProperty != null && + conditionProperty.PropertyType == typeof(bool)) + { + conditionValues.Add((bool)conditionProperty.GetValue(target)); + } + + MethodInfo conditionMethod = ReflectionUtility.GetMethod(target, condition); + if (conditionMethod != null && + conditionMethod.ReturnType == typeof(bool) && + conditionMethod.GetParameters().Length == 0) + { + conditionValues.Add((bool)conditionMethod.Invoke(target, null)); + } + } + + return conditionValues; + } + + internal static bool GetConditionsFlag(List conditionValues, EConditionOperator conditionOperator, bool invert) + { + bool flag; + if (conditionOperator == EConditionOperator.And) + { + flag = true; + foreach (var value in conditionValues) + { + flag = flag && value; + } + } + else + { + flag = false; + foreach (var value in conditionValues) + { + flag = flag || value; + } + } + + if (invert) + { + flag = !flag; + } + + return flag; + } + + public static Type GetPropertyType(SerializedProperty property) + { + object obj = GetTargetObjectOfProperty(property); + Type objType = obj.GetType(); + + return objType; + } + + /// + /// Gets the object the property represents. + /// + /// + /// + public static object GetTargetObjectOfProperty(SerializedProperty property) + { + if (property == null) + { + return null; + } + + string path = property.propertyPath.Replace(".Array.data[", "["); + object obj = property.serializedObject.targetObject; + string[] elements = path.Split('.'); + + foreach (var element in elements) + { + if (element.Contains("[")) + { + string elementName = element.Substring(0, element.IndexOf("[")); + int index = Convert.ToInt32(element.Substring(element.IndexOf("[")).Replace("[", "").Replace("]", "")); + obj = GetValue_Imp(obj, elementName, index); + } + else + { + obj = GetValue_Imp(obj, element); + } + } + + return obj; + } + + /// + /// Gets the object that the property is a member of + /// + /// + /// + public static object GetTargetObjectWithProperty(SerializedProperty property) + { + string path = property.propertyPath.Replace(".Array.data[", "["); + object obj = property.serializedObject.targetObject; + string[] elements = path.Split('.'); + + for (int i = 0; i < elements.Length - 1; i++) + { + string element = elements[i]; + if (element.Contains("[")) + { + string elementName = element.Substring(0, element.IndexOf("[")); + int index = Convert.ToInt32(element.Substring(element.IndexOf("[")).Replace("[", "").Replace("]", "")); + obj = GetValue_Imp(obj, elementName, index); + } + else + { + obj = GetValue_Imp(obj, element); + } + } + + return obj; + } + + private static object GetValue_Imp(object source, string name) + { + if (source == null) + { + return null; + } + + Type type = source.GetType(); + + while (type != null) + { + FieldInfo field = type.GetField(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); + if (field != null) + { + return field.GetValue(source); + } + + PropertyInfo property = type.GetProperty(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase); + if (property != null) + { + return property.GetValue(source, null); + } + + type = type.BaseType; + } + + return null; + } + + private static object GetValue_Imp(object source, string name, int index) + { + IEnumerable enumerable = GetValue_Imp(source, name) as IEnumerable; + if (enumerable == null) + { + return null; + } + + IEnumerator enumerator = enumerable.GetEnumerator(); + for (int i = 0; i <= index; i++) + { + if (!enumerator.MoveNext()) + { + return null; + } + } + + return enumerator.Current; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/Utility/PropertyUtility.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/Utility/PropertyUtility.cs.meta new file mode 100644 index 0000000..dce67c6 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/Utility/PropertyUtility.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 312eedcb79c7a5542b87c0b848e3e2fa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/Utility/ReflectionUtility.cs b/Assets/NaughtyAttributes/Scripts/Editor/Utility/ReflectionUtility.cs new file mode 100644 index 0000000..4f9f544 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/Utility/ReflectionUtility.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + public static class ReflectionUtility + { + public static IEnumerable GetAllFields(object target, Func predicate) + { + if (target == null) + { + Debug.LogError("The target object is null. Check for missing scripts."); + yield break; + } + + List types = GetSelfAndBaseTypes(target); + + for (int i = types.Count - 1; i >= 0; i--) + { + IEnumerable fieldInfos = types[i] + .GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.DeclaredOnly) + .Where(predicate); + + foreach (var fieldInfo in fieldInfos) + { + yield return fieldInfo; + } + } + } + + public static IEnumerable GetAllProperties(object target, Func predicate) + { + if (target == null) + { + Debug.LogError("The target object is null. Check for missing scripts."); + yield break; + } + + List types = GetSelfAndBaseTypes(target); + + for (int i = types.Count - 1; i >= 0; i--) + { + IEnumerable propertyInfos = types[i] + .GetProperties(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.DeclaredOnly) + .Where(predicate); + + foreach (var propertyInfo in propertyInfos) + { + yield return propertyInfo; + } + } + } + + public static IEnumerable GetAllMethods(object target, Func predicate) + { + if (target == null) + { + Debug.LogError("The target object is null. Check for missing scripts."); + yield break; + } + + List types = GetSelfAndBaseTypes(target); + + for (int i = types.Count - 1; i >= 0; i--) + { + IEnumerable methodInfos = types[i] + .GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.DeclaredOnly) + .Where(predicate); + + foreach (var methodInfo in methodInfos) + { + yield return methodInfo; + } + } + } + + public static FieldInfo GetField(object target, string fieldName) + { + return GetAllFields(target, f => f.Name.Equals(fieldName, StringComparison.Ordinal)).FirstOrDefault(); + } + + public static PropertyInfo GetProperty(object target, string propertyName) + { + return GetAllProperties(target, p => p.Name.Equals(propertyName, StringComparison.Ordinal)).FirstOrDefault(); + } + + public static MethodInfo GetMethod(object target, string methodName) + { + return GetAllMethods(target, m => m.Name.Equals(methodName, StringComparison.Ordinal)).FirstOrDefault(); + } + + public static Type GetListElementType(Type listType) + { + if (listType.IsGenericType) + { + return listType.GetGenericArguments()[0]; + } + else + { + return listType.GetElementType(); + } + } + + /// + /// Get type and all base types of target, sorted as following: + /// [target's type, base type, base's base type, ...] + /// + /// + /// + private static List GetSelfAndBaseTypes(object target) + { + List types = new List() + { + target.GetType() + }; + + while (types.Last().BaseType != null) + { + types.Add(types.Last().BaseType); + } + + return types; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Editor/Utility/ReflectionUtility.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/Utility/ReflectionUtility.cs.meta new file mode 100644 index 0000000..fc01215 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/Utility/ReflectionUtility.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 1d86c581f02a55f458e36bf7e81e3084 +timeCreated: 1520258793 +licenseType: Store +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Editor/Utility/SavedBool.cs b/Assets/NaughtyAttributes/Scripts/Editor/Utility/SavedBool.cs new file mode 100644 index 0000000..4f4298c --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/Utility/SavedBool.cs @@ -0,0 +1,34 @@ +using UnityEditor; + +namespace NaughtyAttributes.Editor +{ + internal class SavedBool + { + private bool _value; + private string _name; + + public bool Value + { + get + { + return _value; + } + set + { + if (_value == value) + { + return; + } + + _value = value; + EditorPrefs.SetBool(_name, value); + } + } + + public SavedBool(string name, bool value) + { + _name = name; + _value = EditorPrefs.GetBool(name, value); + } + } +} \ No newline at end of file diff --git a/Assets/NaughtyAttributes/Scripts/Editor/Utility/SavedBool.cs.meta b/Assets/NaughtyAttributes/Scripts/Editor/Utility/SavedBool.cs.meta new file mode 100644 index 0000000..aebf007 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Editor/Utility/SavedBool.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 18613afe66b0c0344a2be5f430bf965a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test.meta b/Assets/NaughtyAttributes/Scripts/Test.meta new file mode 100644 index 0000000..6eca4f6 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ce2bd76b5676a434bb8a84254f67f1dc +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/AnimatorParamTest.cs b/Assets/NaughtyAttributes/Scripts/Test/AnimatorParamTest.cs new file mode 100644 index 0000000..3182d28 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/AnimatorParamTest.cs @@ -0,0 +1,53 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class AnimatorParamTest : MonoBehaviour + { + public Animator animator0; + + [AnimatorParam("animator0")] + public int hash0; + + [AnimatorParam("animator0")] + public string name0; + + public AnimatorParamNest1 nest1; + + [Button("Log 'hash0' and 'name0'")] + private void TestLog() + { + Debug.Log($"hash0 = {hash0}"); + Debug.Log($"name0 = {name0}"); + Debug.Log($"Animator.StringToHash(name0) = {Animator.StringToHash(name0)}"); + } + } + + [System.Serializable] + public class AnimatorParamNest1 + { + public Animator animator1; + private Animator Animator1 => animator1; + + [AnimatorParam("Animator1", AnimatorControllerParameterType.Bool)] + public int hash1; + + [AnimatorParam("Animator1", AnimatorControllerParameterType.Float)] + public string name1; + + public AnimatorParamNest2 nest2; + } + + [System.Serializable] + public class AnimatorParamNest2 + { + public Animator animator2; + private Animator GetAnimator2() => animator2; + + [AnimatorParam("GetAnimator2", AnimatorControllerParameterType.Int)] + public int hash1; + + [AnimatorParam("GetAnimator2", AnimatorControllerParameterType.Trigger)] + public string name1; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/AnimatorParamTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/AnimatorParamTest.cs.meta new file mode 100644 index 0000000..a8daa63 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/AnimatorParamTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9bff20ccdde00fc49a62bad6a4ef9982 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/BoxGroupTest.cs b/Assets/NaughtyAttributes/Scripts/Test/BoxGroupTest.cs new file mode 100644 index 0000000..80a1109 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/BoxGroupTest.cs @@ -0,0 +1,32 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class BoxGroupTest : MonoBehaviour + { + [BoxGroup("Integers")] + public int int0; + [BoxGroup("Integers")] + public int int1; + + [BoxGroup("Floats")] + public float float0; + [BoxGroup("Floats")] + public float float1; + + [BoxGroup("Sliders")] + [MinMaxSlider(0, 1)] + public Vector2 slider0; + [BoxGroup("Sliders")] + [MinMaxSlider(0, 1)] + public Vector2 slider1; + + public string str0; + public string str1; + + [BoxGroup] + public Transform trans0; + [BoxGroup] + public Transform trans1; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/BoxGroupTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/BoxGroupTest.cs.meta new file mode 100644 index 0000000..0c5ee54 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/BoxGroupTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3920f5ea384951b4990e4d9e8032d12e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/ButtonTest.cs b/Assets/NaughtyAttributes/Scripts/Test/ButtonTest.cs new file mode 100644 index 0000000..e69c892 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ButtonTest.cs @@ -0,0 +1,39 @@ +using System.Collections; +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ButtonTest : MonoBehaviour + { + public int myInt; + + [Button(enabledMode: EButtonEnableMode.Always)] + private void IncrementMyInt() + { + myInt++; + } + + [Button("Decrement My Int", EButtonEnableMode.Editor)] + private void DecrementMyInt() + { + myInt--; + } + + [Button(enabledMode: EButtonEnableMode.Playmode)] + private void LogMyInt(string prefix = "MyInt = ") + { + Debug.Log(prefix + myInt); + } + + [Button("StartCoroutine")] + private IEnumerator IncrementMyIntCoroutine() + { + int seconds = 5; + for (int i = 0; i < seconds; i++) + { + myInt++; + yield return new WaitForSeconds(1.0f); + } + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/ButtonTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/ButtonTest.cs.meta new file mode 100644 index 0000000..1d7d58f --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ButtonTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b592f12a9f69ac3408f6f870762232c7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/CurveRangeTest.cs b/Assets/NaughtyAttributes/Scripts/Test/CurveRangeTest.cs new file mode 100644 index 0000000..ba65e68 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/CurveRangeTest.cs @@ -0,0 +1,32 @@ +using UnityEngine; +using NaughtyAttributes; + +public class CurveRangeTest : MonoBehaviour +{ + [CurveRange(-1, -1, 1, 1, EColor.Red)] + public AnimationCurve curve; + + [CurveRange(EColor.Orange)] + public AnimationCurve curve1; + + [CurveRange(0, 0, 10, 10)] + public AnimationCurve curve2; + + public CurveRangeNest1 nest1; + + [System.Serializable] + public class CurveRangeNest1 + { + [CurveRange(0, 0, 1, 1, EColor.Green)] + public AnimationCurve curve; + + public CurveRangeNest2 nest2; + } + + [System.Serializable] + public class CurveRangeNest2 + { + [CurveRange(0, 0, 5, 5, EColor.Blue)] + public AnimationCurve curve; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/CurveRangeTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/CurveRangeTest.cs.meta new file mode 100644 index 0000000..e43f8f0 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/CurveRangeTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6587b100d001e7e46b9aaae7f1180b40 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/DisableIfTest.cs b/Assets/NaughtyAttributes/Scripts/Test/DisableIfTest.cs new file mode 100644 index 0000000..286a3bf --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/DisableIfTest.cs @@ -0,0 +1,120 @@ +using System; +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class DisableIfTest : MonoBehaviour + { + public bool disable1; + public bool disable2; + public DisableIfEnum enum1; + [EnumFlags] public DisableIfEnumFlag enum2; + + [DisableIf(EConditionOperator.And, "disable1", "disable2")] + [ReorderableList] + public int[] disableIfAll; + + [DisableIf(EConditionOperator.Or, "disable1", "disable2")] + [ReorderableList] + public int[] disableIfAny; + + [DisableIf("enum1", DisableIfEnum.Case0)] + [ReorderableList] + public int[] disableIfEnum; + + [DisableIf("enum2", DisableIfEnumFlag.Flag0)] + [ReorderableList] + public int[] disableIfEnumFlag; + + [DisableIf("enum2", DisableIfEnumFlag.Flag0 | DisableIfEnumFlag.Flag1)] + [ReorderableList] + public int[] disableIfEnumFlagMulti; + + public DisableIfNest1 nest1; + } + + [System.Serializable] + public class DisableIfNest1 + { + public bool disable1; + public bool disable2; + public DisableIfEnum enum1; + [EnumFlags] public DisableIfEnumFlag enum2; + public bool Disable1 { get { return disable1; } } + public bool Disable2 { get { return disable2; } } + public DisableIfEnum Enum1 { get { return enum1; } } + public DisableIfEnumFlag Enum2 { get { return enum2; } } + + [DisableIf(EConditionOperator.And, "Disable1", "Disable2")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int disableIfAll = 1; + + [DisableIf(EConditionOperator.Or, "Disable1", "Disable2")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int disableIfAny = 2; + + [DisableIf("Enum1", DisableIfEnum.Case1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int disableIfEnum = 3; + + [DisableIf("Enum2", DisableIfEnumFlag.Flag0)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int disableIfEnumFlag; + + [DisableIf("Enum2", DisableIfEnumFlag.Flag0 | DisableIfEnumFlag.Flag1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int disableIfEnumFlagMulti; + + public DisableIfNest2 nest2; + } + + [System.Serializable] + public class DisableIfNest2 + { + public bool disable1; + public bool disable2; + public DisableIfEnum enum1; + [EnumFlags] public DisableIfEnumFlag enum2; + public bool GetDisable1() { return disable1; } + public bool GetDisable2() { return disable2; } + public DisableIfEnum GetEnum1() { return enum1; } + public DisableIfEnumFlag GetEnum2() { return enum2; } + + [DisableIf(EConditionOperator.And, "GetDisable1", "GetDisable2")] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 enableIfAll = new Vector2(0.25f, 0.75f); + + [DisableIf(EConditionOperator.Or, "GetDisable1", "GetDisable2")] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 enableIfAny = new Vector2(0.25f, 0.75f); + + [DisableIf("GetEnum1", DisableIfEnum.Case2)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 enableIfEnum = new Vector2(0.25f, 0.75f); + + [DisableIf("GetEnum2", DisableIfEnumFlag.Flag0)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 disableIfEnumFlag; + + [DisableIf("GetEnum2", DisableIfEnumFlag.Flag0 | DisableIfEnumFlag.Flag1)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 disableIfEnumFlagMulti; + } + + [System.Serializable] + public enum DisableIfEnum + { + Case0, + Case1, + Case2 + } + + [Flags] + public enum DisableIfEnumFlag + { + Flag0 = 1, + Flag1 = 2, + Flag2 = 4, + Flag3 = 8 + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/DisableIfTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/DisableIfTest.cs.meta new file mode 100644 index 0000000..c3a1e7a --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/DisableIfTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0e48a088cb96287448c3be58932bfcb7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/DropdownTest.cs b/Assets/NaughtyAttributes/Scripts/Test/DropdownTest.cs new file mode 100644 index 0000000..83a24e4 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/DropdownTest.cs @@ -0,0 +1,45 @@ +using UnityEngine; +using System.Collections.Generic; + +namespace NaughtyAttributes.Test +{ + public class DropdownTest : MonoBehaviour + { + [Dropdown("intValues")] + public int intValue; + +#pragma warning disable 414 + private int[] intValues = new int[] { 1, 2, 3 }; +#pragma warning restore 414 + + public DropdownNest1 nest1; + } + + [System.Serializable] + public class DropdownNest1 + { + [Dropdown("StringValues")] + public string stringValue; + + private List StringValues { get { return new List() { "A", "B", "C" }; } } + + public DropdownNest2 nest2; + } + + [System.Serializable] + public class DropdownNest2 + { + [Dropdown("GetVectorValues")] + public Vector3 vectorValue; + + private DropdownList GetVectorValues() + { + return new DropdownList() + { + { "Right", Vector3.right }, + { "Up", Vector3.up }, + { "Forward", Vector3.forward } + }; + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/DropdownTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/DropdownTest.cs.meta new file mode 100644 index 0000000..ec7fa24 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/DropdownTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3855e37cd6b01194e8166573c7c4b37d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/EnableIfTest.cs b/Assets/NaughtyAttributes/Scripts/Test/EnableIfTest.cs new file mode 100644 index 0000000..b1d3431 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/EnableIfTest.cs @@ -0,0 +1,120 @@ +using System; +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class EnableIfTest : MonoBehaviour + { + public bool enable1; + public bool enable2; + public EnableIfEnum enum1; + [EnumFlags] public EnableIfEnumFlag enum2; + + [EnableIf(EConditionOperator.And, "enable1", "enable2")] + [ReorderableList] + public int[] enableIfAll; + + [EnableIf(EConditionOperator.Or, "enable1", "enable2")] + [ReorderableList] + public int[] enableIfAny; + + [EnableIf("enum1", EnableIfEnum.Case0)] + [ReorderableList] + public int[] enableIfEnum; + + [EnableIf("enum2", EnableIfEnumFlag.Flag0)] + [ReorderableList] + public int[] enableIfEnumFlag; + + [EnableIf("enum2", EnableIfEnumFlag.Flag0 | EnableIfEnumFlag.Flag1)] + [ReorderableList] + public int[] enableIfEnumFlagMulti; + + public EnableIfNest1 nest1; + } + + [System.Serializable] + public class EnableIfNest1 + { + public bool enable1; + public bool enable2; + public EnableIfEnum enum1; + [EnumFlags] public EnableIfEnumFlag enum2; + public bool Enable1 { get { return enable1; } } + public bool Enable2 { get { return enable2; } } + public EnableIfEnum Enum1 { get { return enum1; } } + public EnableIfEnumFlag Enum2 { get { return enum2; } } + + [EnableIf(EConditionOperator.And, "Enable1", "Enable2")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int enableIfAll; + + [EnableIf(EConditionOperator.Or, "Enable1", "Enable2")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int enableIfAny; + + [EnableIf("Enum1", EnableIfEnum.Case1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int enableIfEnum; + + [EnableIf("Enum2", EnableIfEnumFlag.Flag0)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int enableIfEnumFlag; + + [EnableIf("Enum2", EnableIfEnumFlag.Flag0 | EnableIfEnumFlag.Flag1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int enableIfEnumFlagMulti; + + public EnableIfNest2 nest2; + } + + [System.Serializable] + public class EnableIfNest2 + { + public bool enable1; + public bool enable2; + public EnableIfEnum enum1; + [EnumFlags] public EnableIfEnumFlag enum2; + public bool GetEnable1() { return enable1; } + public bool GetEnable2() { return enable2; } + public EnableIfEnum GetEnum1() { return enum1; } + public EnableIfEnumFlag GetEnum2() { return enum2; } + + [EnableIf(EConditionOperator.And, "GetEnable1", "GetEnable2")] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 enableIfAll = new Vector2(0.25f, 0.75f); + + [EnableIf(EConditionOperator.Or, "GetEnable1", "GetEnable2")] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 enableIfAny = new Vector2(0.25f, 0.75f); + + [EnableIf("GetEnum1", EnableIfEnum.Case2)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 enableIfEnum = new Vector2(0.25f, 0.75f); + + [EnableIf("GetEnum2", EnableIfEnumFlag.Flag0)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 enableIfEnumFlag; + + [EnableIf("GetEnum2", EnableIfEnumFlag.Flag0 | EnableIfEnumFlag.Flag1)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 enableIfEnumFlagMulti; + } + + [System.Serializable] + public enum EnableIfEnum + { + Case0, + Case1, + Case2 + } + + [Flags] + public enum EnableIfEnumFlag + { + Flag0 = 1, + Flag1 = 2, + Flag2 = 4, + Flag3 = 8 + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/EnableIfTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/EnableIfTest.cs.meta new file mode 100644 index 0000000..c22fe7b --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/EnableIfTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bed506d8be3a10f45bec4bf2237bec87 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/EnumFlagsTest.cs b/Assets/NaughtyAttributes/Scripts/Test/EnumFlagsTest.cs new file mode 100644 index 0000000..bb3a098 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/EnumFlagsTest.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public enum TestEnum + { + None = 0, + B = 1 << 0, + C = 1 << 1, + D = 1 << 2, + E = 1 << 3, + F = 1 << 4, + All = ~0 + } + + public class EnumFlagsTest : MonoBehaviour + { + [EnumFlags] + public TestEnum flags0; + + public EnumFlagsNest1 nest1; + } + + [System.Serializable] + public class EnumFlagsNest1 + { + [EnumFlags] + public TestEnum flags1; + + public EnumFlagsNest2 nest2; + } + + [System.Serializable] + public class EnumFlagsNest2 + { + [EnumFlags] + public TestEnum flags2; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/EnumFlagsTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/EnumFlagsTest.cs.meta new file mode 100644 index 0000000..b548675 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/EnumFlagsTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7b7f6b84ce0d7674d8a386fde729279c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/ExpandableTest.cs b/Assets/NaughtyAttributes/Scripts/Test/ExpandableTest.cs new file mode 100644 index 0000000..477d85d --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ExpandableTest.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ExpandableTest : MonoBehaviour + { + [Expandable] + public ScriptableObject obj0; + + public ExpandableScriptableObjectNest1 nest1; + } + + [System.Serializable] + public class ExpandableScriptableObjectNest1 + { + [Expandable] + public ScriptableObject obj1; + + public ExpandableScriptableObjectNest2 nest2; + } + + [System.Serializable] + public class ExpandableScriptableObjectNest2 + { + [Expandable] + public ScriptableObject obj2; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/ExpandableTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/ExpandableTest.cs.meta new file mode 100644 index 0000000..ffa82d1 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ExpandableTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 64c4c9aee2b494d44be9bb0b7f12ed7c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/FoldoutTest.cs b/Assets/NaughtyAttributes/Scripts/Test/FoldoutTest.cs new file mode 100644 index 0000000..0bf94f1 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/FoldoutTest.cs @@ -0,0 +1,32 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class FoldoutTest : MonoBehaviour + { + [Foldout("Integers")] + public int int0; + [Foldout("Integers")] + public int int1; + + [Foldout("Floats")] + public float float0; + [Foldout("Floats")] + public float float1; + + [Foldout("Sliders")] + [MinMaxSlider(0, 1)] + public Vector2 slider0; + [Foldout("Sliders")] + [MinMaxSlider(0, 1)] + public Vector2 slider1; + + public string str0; + public string str1; + + [Foldout("Transforms")] + public Transform trans0; + [Foldout("Transforms")] + public Transform trans1; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/FoldoutTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/FoldoutTest.cs.meta new file mode 100644 index 0000000..8c72e06 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/FoldoutTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3b437215d92efa74ea85ff726ca0dd09 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/HideIfTest.cs b/Assets/NaughtyAttributes/Scripts/Test/HideIfTest.cs new file mode 100644 index 0000000..dbacd17 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/HideIfTest.cs @@ -0,0 +1,119 @@ +using System; +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class HideIfTest : MonoBehaviour + { + public bool hide1; + public bool hide2; + public HideIfEnum enum1; + [EnumFlags] public HideIfEnumFlag enum2; + + [HideIf(EConditionOperator.And, "hide1", "hide2")] + [ReorderableList] + public int[] hideIfAll; + + [HideIf(EConditionOperator.Or, "hide1", "hide2")] + [ReorderableList] + public int[] hideIfAny; + + [HideIf("enum1", HideIfEnum.Case0)] + [ReorderableList] + public int[] hideIfEnum; + + [HideIf("enum2", HideIfEnumFlag.Flag0)] + [ReorderableList] + public int[] hideIfEnumFlag; + + [HideIf("enum2", HideIfEnumFlag.Flag0 | HideIfEnumFlag.Flag1)] + [ReorderableList] + public int[] hideIfEnumFlagMulti; + + public HideIfNest1 nest1; + } + + [System.Serializable] + public class HideIfNest1 + { + public bool hide1; + public bool hide2; + public HideIfEnum enum1; + [EnumFlags] public HideIfEnumFlag enum2; + public bool Hide1 { get { return hide1; } } + public bool Hide2 { get { return hide2; } } + public HideIfEnum Enum1 { get { return enum1; } } + public HideIfEnumFlag Enum2 { get { return enum2; } } + + [HideIf(EConditionOperator.And, "Hide1", "Hide2")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int hideIfAll; + + [HideIf(EConditionOperator.Or, "Hide1", "Hide2")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int hideIfAny; + + [HideIf("Enum1", HideIfEnum.Case1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int hideIfEnum; + + [HideIf("Enum2", HideIfEnumFlag.Flag0)] + [AllowNesting] + public int hideIfEnumFlag; + + [HideIf("Enum2", HideIfEnumFlag.Flag0 | HideIfEnumFlag.Flag1)] + [AllowNesting] + public int hideIfEnumFlagMulti; + + public HideIfNest2 nest2; + } + + [System.Serializable] + public class HideIfNest2 + { + public bool hide1; + public bool hide2; + public HideIfEnum enum1; + [EnumFlags] public HideIfEnumFlag enum2; + public bool GetHide1() { return hide1; } + public bool GetHide2() { return hide2; } + public HideIfEnum GetEnum1() { return enum1; } + public HideIfEnumFlag GetEnum2() { return enum2; } + + [HideIf(EConditionOperator.And, "GetHide1", "GetHide2")] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 hideIfAll = new Vector2(0.25f, 0.75f); + + [HideIf(EConditionOperator.Or, "GetHide1", "GetHide2")] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 hideIfAny = new Vector2(0.25f, 0.75f); + + [HideIf("GetEnum1", HideIfEnum.Case2)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 hideIfEnum = new Vector2(0.25f, 0.75f); + + [HideIf("GetEnum2", HideIfEnumFlag.Flag0)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 hideIfEnumFlag; + + [HideIf("GetEnum2", HideIfEnumFlag.Flag0 | HideIfEnumFlag.Flag1)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 hideIfEnumFlagMulti; + } + + public enum HideIfEnum + { + Case0, + Case1, + Case2 + } + + [Flags] + public enum HideIfEnumFlag + { + Flag0 = 1, + Flag1 = 2, + Flag2 = 4, + Flag3 = 8 + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/HideIfTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/HideIfTest.cs.meta new file mode 100644 index 0000000..6115ad2 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/HideIfTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3cf166cb519e666419bb79b0c50c5ee1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/HorizontalLineTest.cs b/Assets/NaughtyAttributes/Scripts/Test/HorizontalLineTest.cs new file mode 100644 index 0000000..f017da5 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/HorizontalLineTest.cs @@ -0,0 +1,51 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class HorizontalLineTest : MonoBehaviour + { + [HorizontalLine(color: EColor.Black)] + [Header("Black")] + [HorizontalLine(color: EColor.Blue)] + [Header("Blue")] + [HorizontalLine(color: EColor.Gray)] + [Header("Gray")] + [HorizontalLine(color: EColor.Green)] + [Header("Green")] + [HorizontalLine(color: EColor.Indigo)] + [Header("Indigo")] + [HorizontalLine(color: EColor.Orange)] + [Header("Orange")] + [HorizontalLine(color: EColor.Pink)] + [Header("Pink")] + [HorizontalLine(color: EColor.Red)] + [Header("Red")] + [HorizontalLine(color: EColor.Violet)] + [Header("Violet")] + [HorizontalLine(color: EColor.White)] + [Header("White")] + [HorizontalLine(color: EColor.Yellow)] + [Header("Yellow")] + [HorizontalLine(10.0f)] + [Header("Thick")] + public int line0; + + public HorizontalLineNest1 nest1; + } + + [System.Serializable] + public class HorizontalLineNest1 + { + [HorizontalLine] + public int line1; + + public HorizontalLineNest2 nest2; + } + + [System.Serializable] + public class HorizontalLineNest2 + { + [HorizontalLine] + public int line2; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/HorizontalLineTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/HorizontalLineTest.cs.meta new file mode 100644 index 0000000..4d7ff37 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/HorizontalLineTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5cc6d3f8d4a53374887b3d620a6972e3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/InfoBoxTest.cs b/Assets/NaughtyAttributes/Scripts/Test/InfoBoxTest.cs new file mode 100644 index 0000000..4f72651 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/InfoBoxTest.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class InfoBoxTest : MonoBehaviour + { + [InfoBox("Normal", EInfoBoxType.Normal)] + public int normal; + + public InfoBoxNest1 nest1; + } + + [System.Serializable] + public class InfoBoxNest1 + { + [InfoBox("Warning", EInfoBoxType.Warning)] + public int warning; + + public InfoBoxNest2 nest2; + } + + [System.Serializable] + public class InfoBoxNest2 + { + [InfoBox("Error", EInfoBoxType.Error)] + public int error; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/InfoBoxTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/InfoBoxTest.cs.meta new file mode 100644 index 0000000..68dc824 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/InfoBoxTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0dcb08e489c17644e9eacaa1ec5fe781 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/InputAxisTest.cs b/Assets/NaughtyAttributes/Scripts/Test/InputAxisTest.cs new file mode 100644 index 0000000..667d2f2 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/InputAxisTest.cs @@ -0,0 +1,34 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class InputAxisTest : MonoBehaviour + { + [InputAxis] + public string inputAxis0; + + public InputAxisNest1 nest1; + + [Button] + private void LogInputAxis0() + { + Debug.Log(inputAxis0); + } + } + + [System.Serializable] + public class InputAxisNest1 + { + [InputAxis] + public string inputAxis1; + + public InputAxisNest2 nest2; + } + + [System.Serializable] + public struct InputAxisNest2 + { + [InputAxis] + public string inputAxis2; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/InputAxisTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/InputAxisTest.cs.meta new file mode 100644 index 0000000..b44a862 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/InputAxisTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e0cc8a31c22090847b75538c0ed2d2fc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/LabelTest.cs b/Assets/NaughtyAttributes/Scripts/Test/LabelTest.cs new file mode 100644 index 0000000..dbe61d5 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/LabelTest.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class LabelTest : MonoBehaviour + { + [Label("Label 0")] + public int int0; + + public LabelNest1 nest1; + } + + [System.Serializable] + public class LabelNest1 + { + [Label("Label 1")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int int1; + + public LabelNest2 nest2; + } + + [System.Serializable] + public class LabelNest2 + { + [Label("Label 2")] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 vector2; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/LabelTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/LabelTest.cs.meta new file mode 100644 index 0000000..114af72 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/LabelTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7488af014527ebf42af5c4fc4d5f4f5b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/LayerTest.cs b/Assets/NaughtyAttributes/Scripts/Test/LayerTest.cs new file mode 100644 index 0000000..af4bbb1 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/LayerTest.cs @@ -0,0 +1,46 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class LayerTest : MonoBehaviour + { + [Layer] + public int layerNumber0; + + [Layer] + public string layerName0; + + public LayerNest1 nest1; + + [Button] + public void DebugLog() + { + Debug.LogFormat("{0} = {1}", nameof(layerNumber0), layerNumber0); + Debug.LogFormat("{0} = {1}", nameof(layerName0), layerName0); + Debug.LogFormat("LayerToName({0}) = {1}", layerNumber0, LayerMask.LayerToName(layerNumber0)); + Debug.LogFormat("NameToLayer({0}) = {1}", layerName0, LayerMask.NameToLayer(layerName0)); + } + } + + [System.Serializable] + public class LayerNest1 + { + [Layer] + public int layerNumber1; + + [Layer] + public string layerName1; + + public LayerNest2 nest2; + } + + [System.Serializable] + public struct LayerNest2 + { + [Layer] + public int layerNumber2; + + [Layer] + public string layerName2; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/LayerTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/LayerTest.cs.meta new file mode 100644 index 0000000..d66d32c --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/LayerTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 460459d6ac76acd4d872f94cf444e6fa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/MinMaxSliderTest.cs b/Assets/NaughtyAttributes/Scripts/Test/MinMaxSliderTest.cs new file mode 100644 index 0000000..981f9a6 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/MinMaxSliderTest.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class MinMaxSliderTest : MonoBehaviour + { + [MinMaxSlider(0.0f, 1.0f)] + public Vector2 minMaxSlider0 = new Vector2(0.25f, 0.75f); + + public MinMaxSliderNest1 nest1; + } + + [System.Serializable] + public class MinMaxSliderNest1 + { + [MinMaxSlider(0.0f, 1.0f)] + public Vector2 minMaxSlider1 = new Vector2(0.25f, 0.75f); + + public MinMaxSliderNest2 nest2; + } + + [System.Serializable] + public class MinMaxSliderNest2 + { + [MinMaxSlider(1, 11)] + public Vector2Int minMaxSlider2 = new Vector2Int(6, 11); + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/MinMaxSliderTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/MinMaxSliderTest.cs.meta new file mode 100644 index 0000000..7580a81 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/MinMaxSliderTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fd67fbde6acdd6a44944f12e507067c5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/MinMaxValueTest.cs b/Assets/NaughtyAttributes/Scripts/Test/MinMaxValueTest.cs new file mode 100644 index 0000000..0de488e --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/MinMaxValueTest.cs @@ -0,0 +1,129 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class MinMaxValueTest : MonoBehaviour + { + [MinValue(0)] + public int min0Int; + + [MaxValue(0)] + public int max0Int; + + [MinValue(0), MaxValue(1)] + public float range01Float; + + [MinValue(0), MaxValue(1)] + public Vector2 range01Vector2; + + [MinValue(0), MaxValue(1)] + public Vector3 range01Vector3; + + [MinValue(0), MaxValue(1)] + public Vector4 range01Vector4; + + [MinValue(0)] + public Vector2Int min0Vector2Int; + + [MaxValue(100)] + public Vector2Int max100Vector2Int; + + [MinValue(0)] + public Vector3Int min0Vector3Int; + + [MaxValue(100)] + public Vector3Int max100Vector3Int; + + public MinMaxValueNest1 nest1; + } + + [System.Serializable] + public class MinMaxValueNest1 + { + [MinValue(0)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int min0Int; + + [MaxValue(0)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int max0Int; + + [MinValue(0), MaxValue(1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public float range01Float; + + [MinValue(0), MaxValue(1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector2 range01Vector2; + + [MinValue(0), MaxValue(1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector3 range01Vector3; + + [MinValue(0), MaxValue(1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector4 range01Vector4; + + [MinValue(0)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector2Int min0Vector2Int; + + [MaxValue(100)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector2Int max100Vector2Int; + + [MinValue(0)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector3Int min0Vector3Int; + + [MaxValue(100)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector3Int max100Vector3Int; + + public MinMaxValueNest2 nest2; + } + + [System.Serializable] + public class MinMaxValueNest2 + { + [MinValue(0)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int min0Int; + + [MaxValue(0)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int max0Int; + + [MinValue(0), MaxValue(1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public float range01Float; + + [MinValue(0), MaxValue(1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector2 range01Vector2; + + [MinValue(0), MaxValue(1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector3 range01Vector3; + + [MinValue(0), MaxValue(1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector4 range01Vector4; + + [MinValue(0)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector2Int min0Vector2Int; + + [MaxValue(100)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector2Int max100Vector2Int; + + [MinValue(0)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector3Int min0Vector3Int; + + [MaxValue(100)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector3Int max100Vector3Int; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/MinMaxValueTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/MinMaxValueTest.cs.meta new file mode 100644 index 0000000..328dee3 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/MinMaxValueTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 450a05787c54e6b4fa88ffe223bcee87 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/NaughtyAttributes.Test.asmdef b/Assets/NaughtyAttributes/Scripts/Test/NaughtyAttributes.Test.asmdef new file mode 100644 index 0000000..910f548 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/NaughtyAttributes.Test.asmdef @@ -0,0 +1,14 @@ +{ + "name": "NaughtyAttributes.Test", + "references": [ + "NaughtyAttributes.Core" + ], + "optionalUnityReferences": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [] +} \ No newline at end of file diff --git a/Assets/NaughtyAttributes/Scripts/Test/NaughtyAttributes.Test.asmdef.meta b/Assets/NaughtyAttributes/Scripts/Test/NaughtyAttributes.Test.asmdef.meta new file mode 100644 index 0000000..c3d49e7 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/NaughtyAttributes.Test.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: df1dea26b8503004d92d621e88aa9421 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/OnValueChangedTest.cs b/Assets/NaughtyAttributes/Scripts/Test/OnValueChangedTest.cs new file mode 100644 index 0000000..328cd92 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/OnValueChangedTest.cs @@ -0,0 +1,51 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class OnValueChangedTest : MonoBehaviour + { + [OnValueChanged("OnValueChangedMethod1")] + [OnValueChanged("OnValueChangedMethod2")] + public int int0; + + private void OnValueChangedMethod1() + { + Debug.LogFormat("int0: {0}", int0); + } + + private void OnValueChangedMethod2() + { + Debug.LogFormat("int0: {0}", int0); + } + + public OnValueChangedNest1 nest1; + } + + [System.Serializable] + public class OnValueChangedNest1 + { + [OnValueChanged("OnValueChangedMethod")] + [AllowNesting] + public int int1; + + private void OnValueChangedMethod() + { + Debug.LogFormat("int1: {0}", int1); + } + + public OnValueChangedNest2 nest2; + } + + [System.Serializable] + public class OnValueChangedNest2 + { + [OnValueChanged("OnValueChangedMethod")] + [AllowNesting] + public int int2; + + private void OnValueChangedMethod() + { + Debug.LogFormat("int2: {0}", int2); + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/OnValueChangedTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/OnValueChangedTest.cs.meta new file mode 100644 index 0000000..bfd1ab2 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/OnValueChangedTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ff1df679e5b32f64bb106752c63933fa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/ProgressBarTest.cs b/Assets/NaughtyAttributes/Scripts/Test/ProgressBarTest.cs new file mode 100644 index 0000000..cd3294b --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ProgressBarTest.cs @@ -0,0 +1,35 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ProgressBarTest : MonoBehaviour + { + [Header("Constant ProgressBar")] + [ProgressBar("Health", 100, EColor.Red)] + public float health = 50.0f; + + [Header("Nested ProgressBar")] + public ProgressBarNest1 nest1; + + [Header("Dynamic ProgressBar")] + [ProgressBar("Elixir", "maxElixir", color: EColor.Violet)] + public int elixir = 50; + public int maxElixir = 100; + } + + [System.Serializable] + public class ProgressBarNest1 + { + [ProgressBar("Mana", 100, EColor.Blue)] + public float mana = 25.0f; + + public ProgressBarNest2 nest2; + } + + [System.Serializable] + public class ProgressBarNest2 + { + [ProgressBar("Stamina", 100, EColor.Green)] + public float stamina = 75.0f; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/ProgressBarTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/ProgressBarTest.cs.meta new file mode 100644 index 0000000..db88429 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ProgressBarTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 96ca4c27fc649764b9d1625f1740cb9e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/ReadOnlyTest.cs b/Assets/NaughtyAttributes/Scripts/Test/ReadOnlyTest.cs new file mode 100644 index 0000000..138a6eb --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ReadOnlyTest.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ReadOnlyTest : MonoBehaviour + { + [ReadOnly] + public int readOnlyInt = 5; + + public ReadOnlyNest1 nest1; + } + + [System.Serializable] + public class ReadOnlyNest1 + { + [ReadOnly] + [AllowNesting] + public float readOnlyFloat = 3.14f; + + public ReadOnlyNest2 nest2; + } + + [System.Serializable] + public struct ReadOnlyNest2 + { + [ReadOnly] + [AllowNesting] + public string readOnlyString; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/ReadOnlyTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/ReadOnlyTest.cs.meta new file mode 100644 index 0000000..d65c60c --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ReadOnlyTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5443d37a05e188846bda9b05b067184e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/ReorderableListTest.cs b/Assets/NaughtyAttributes/Scripts/Test/ReorderableListTest.cs new file mode 100644 index 0000000..3daea74 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ReorderableListTest.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ReorderableListTest : MonoBehaviour + { + [ReorderableList] + public int[] intArray; + + [ReorderableList] + public List vectorList; + + [ReorderableList] + public List structList; + + [ReorderableList] + public GameObject[] gameObjectsList; + + [ReorderableList] + public List transformsList; + + [ReorderableList] + public List monoBehavioursList; + } + + [System.Serializable] + public struct SomeStruct + { + public int Int; + public float Float; + public Vector3 Vector; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/ReorderableListTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/ReorderableListTest.cs.meta new file mode 100644 index 0000000..b993018 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ReorderableListTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c93fde7cd79390148ac576c3a159a77b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/RequiredTest.cs b/Assets/NaughtyAttributes/Scripts/Test/RequiredTest.cs new file mode 100644 index 0000000..1ea1eb6 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/RequiredTest.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class RequiredTest : MonoBehaviour + { + [Required] + public Transform trans0; + + public RequiredNest1 nest1; + } + + [System.Serializable] + public class RequiredNest1 + { + [Required] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Transform trans1; + + public RequiredNest2 nest2; + } + + [System.Serializable] + public class RequiredNest2 + { + [Required("trans2 is invalid custom message - hohoho")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Transform trans2; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/RequiredTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/RequiredTest.cs.meta new file mode 100644 index 0000000..bc51260 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/RequiredTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9c8c10b2234650d42b2a8efad6b413db +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/ResizableTextAreaTest.cs b/Assets/NaughtyAttributes/Scripts/Test/ResizableTextAreaTest.cs new file mode 100644 index 0000000..bf13ce8 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ResizableTextAreaTest.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ResizableTextAreaTest : MonoBehaviour + { + [ResizableTextArea] + public string text0; + + public ResizableTextAreaNest1 nest1; + } + + [System.Serializable] + public class ResizableTextAreaNest1 + { + [ResizableTextArea] + public string text1; + + public ResizableTextAreaNest2 nest2; + } + + [System.Serializable] + public class ResizableTextAreaNest2 + { + [ResizableTextArea] + public string text2; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/ResizableTextAreaTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/ResizableTextAreaTest.cs.meta new file mode 100644 index 0000000..380566d --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ResizableTextAreaTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fb4f4bb2e3e063340a24f4bb24528bb5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/SceneTest.cs b/Assets/NaughtyAttributes/Scripts/Test/SceneTest.cs new file mode 100644 index 0000000..4f4a9b6 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/SceneTest.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class SceneTest : MonoBehaviour + { + [Scene] + public string scene0; + + public SceneNest1 nest1; + } + + [System.Serializable] + public class SceneNest1 + { + [Scene] + public string scene1; + + public SceneNest2 nest2; + } + + [System.Serializable] + public struct SceneNest2 + { + [Scene] + public int scene2; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/SceneTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/SceneTest.cs.meta new file mode 100644 index 0000000..3ceca2f --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/SceneTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 281a85803caf74a459439020a0840fa4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/ShowAssetPreviewTest.cs b/Assets/NaughtyAttributes/Scripts/Test/ShowAssetPreviewTest.cs new file mode 100644 index 0000000..e9aaf3f --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ShowAssetPreviewTest.cs @@ -0,0 +1,37 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ShowAssetPreviewTest : MonoBehaviour + { + [ShowAssetPreview] + public Sprite sprite0; + + [ShowAssetPreview(96, 96)] + public GameObject prefab0; + + public ShowAssetPreviewNest1 nest1; + } + + [System.Serializable] + public class ShowAssetPreviewNest1 + { + [ShowAssetPreview] + public Sprite sprite1; + + [ShowAssetPreview(96, 96)] + public GameObject prefab1; + + public ShowAssetPreviewNest2 nest2; + } + + [System.Serializable] + public class ShowAssetPreviewNest2 + { + [ShowAssetPreview] + public Sprite sprite2; + + [ShowAssetPreview(96, 96)] + public GameObject prefab2; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/ShowAssetPreviewTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/ShowAssetPreviewTest.cs.meta new file mode 100644 index 0000000..b636853 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ShowAssetPreviewTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 705c14aa9ecaa274289972381f471367 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/ShowIfTest.cs b/Assets/NaughtyAttributes/Scripts/Test/ShowIfTest.cs new file mode 100644 index 0000000..27e9af4 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ShowIfTest.cs @@ -0,0 +1,119 @@ +using System; +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ShowIfTest : MonoBehaviour + { + public bool show1; + public bool show2; + public ShowIfEnum enum1; + [EnumFlags] public ShowIfEnumFlag enum2; + + [ShowIf(EConditionOperator.And, "show1", "show2")] + [ReorderableList] + public int[] showIfAll; + + [ShowIf(EConditionOperator.Or, "show1", "show2")] + [ReorderableList] + public int[] showIfAny; + + [ShowIf("enum1", ShowIfEnum.Case0)] + [ReorderableList] + public int[] showIfEnum; + + [ShowIf("enum2", ShowIfEnumFlag.Flag0)] + [ReorderableList] + public int[] showIfEnumFlag; + + [ShowIf("enum2", ShowIfEnumFlag.Flag0 | ShowIfEnumFlag.Flag1)] + [ReorderableList] + public int[] showIfEnumFlagMulti; + + public ShowIfNest1 nest1; + } + + [System.Serializable] + public class ShowIfNest1 + { + public bool show1; + public bool show2; + public ShowIfEnum enum1; + [EnumFlags] public ShowIfEnumFlag enum2; + public bool Show1 { get { return show1; } } + public bool Show2 { get { return show2; } } + public ShowIfEnum Enum1 { get { return enum1; } } + public ShowIfEnumFlag Enum2 { get { return enum2; } } + + [ShowIf(EConditionOperator.And, "Show1", "Show2")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int showIfAll; + + [ShowIf(EConditionOperator.Or, "Show1", "Show2")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int showIfAny; + + [ShowIf("Enum1", ShowIfEnum.Case1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int showIfEnum; + + [ShowIf("Enum2", ShowIfEnumFlag.Flag0)] + [AllowNesting] + public int showIfEnumFlag; + + [ShowIf("Enum2", ShowIfEnumFlag.Flag0 | ShowIfEnumFlag.Flag1)] + [AllowNesting] + public int showIfEnumFlagMulti; + + public ShowIfNest2 nest2; + } + + [System.Serializable] + public class ShowIfNest2 + { + public bool show1; + public bool show2; + public ShowIfEnum enum1; + [EnumFlags] public ShowIfEnumFlag enum2; + public bool GetShow1() { return show1; } + public bool GetShow2() { return show2; } + public ShowIfEnum GetEnum1() { return enum1; } + public ShowIfEnumFlag GetEnum2() { return enum2; } + + [ShowIf(EConditionOperator.And, "GetShow1", "GetShow2")] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 showIfAll = new Vector2(0.25f, 0.75f); + + [ShowIf(EConditionOperator.Or, "GetShow1", "GetShow2")] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 showIfAny = new Vector2(0.25f, 0.75f); + + [ShowIf("GetEnum1", ShowIfEnum.Case2)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 showIfEnum = new Vector2(0.25f, 0.75f); + + [ShowIf("GetEnum2", ShowIfEnumFlag.Flag0)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 showIfEnumFlag; + + [ShowIf("GetEnum2", ShowIfEnumFlag.Flag0 | ShowIfEnumFlag.Flag1)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 showIfEnumFlagMulti; + } + + public enum ShowIfEnum + { + Case0, + Case1, + Case2 + } + + [Flags] + public enum ShowIfEnumFlag + { + Flag0 = 1, + Flag1 = 2, + Flag2 = 4, + Flag3 = 8 + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/ShowIfTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/ShowIfTest.cs.meta new file mode 100644 index 0000000..749d05c --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ShowIfTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4fdbfcfbf5b056a4bac491fe21569572 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/ShowNativePropertyTest.cs b/Assets/NaughtyAttributes/Scripts/Test/ShowNativePropertyTest.cs new file mode 100644 index 0000000..fdff514 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ShowNativePropertyTest.cs @@ -0,0 +1,79 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ShowNativePropertyTest : MonoBehaviour + { + [ShowNativeProperty] + private Transform Transform + { + get + { + return transform; + } + } + + [ShowNativeProperty] + private Transform ParentTransform + { + get + { + return transform.parent; + } + } + + [ShowNativeProperty] + private ushort MyUShort + { + get + { + return ushort.MaxValue; + } + } + + [ShowNativeProperty] + private short MyShort + { + get + { + return short.MaxValue; + } + } + + [ShowNativeProperty] + private ulong MyULong + { + get + { + return ulong.MaxValue; + } + } + + [ShowNativeProperty] + private long MyLong + { + get + { + return long.MaxValue; + } + } + + [ShowNativeProperty] + private uint MyUInt + { + get + { + return uint.MaxValue; + } + } + + [ShowNativeProperty] + private int MyInt + { + get + { + return int.MaxValue; + } + } + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/ShowNativePropertyTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/ShowNativePropertyTest.cs.meta new file mode 100644 index 0000000..19f9e31 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ShowNativePropertyTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b5a73795d25dd334e90a5a347c6079d9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/ShowNonSerializedFieldTest.cs b/Assets/NaughtyAttributes/Scripts/Test/ShowNonSerializedFieldTest.cs new file mode 100644 index 0000000..9d4776a --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ShowNonSerializedFieldTest.cs @@ -0,0 +1,33 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ShowNonSerializedFieldTest : MonoBehaviour + { +#pragma warning disable 414 + [ShowNonSerializedField] + private ushort myUShort = ushort.MaxValue; + + [ShowNonSerializedField] + private short myShort = short.MaxValue; + + [ShowNonSerializedField] + private uint myUInt = uint.MaxValue; + + [ShowNonSerializedField] + private int myInt = 10; + + [ShowNonSerializedField] + private ulong myULong = ulong.MaxValue; + + [ShowNonSerializedField] + private long myLong = long.MaxValue; + + [ShowNonSerializedField] + private const float PI = 3.14159f; + + [ShowNonSerializedField] + private static readonly Vector3 CONST_VECTOR = Vector3.one; +#pragma warning restore 414 + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/ShowNonSerializedFieldTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/ShowNonSerializedFieldTest.cs.meta new file mode 100644 index 0000000..404ff1b --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ShowNonSerializedFieldTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 913d67a695253f744bdc776625b9b948 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/TagTest.cs b/Assets/NaughtyAttributes/Scripts/Test/TagTest.cs new file mode 100644 index 0000000..144c856 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/TagTest.cs @@ -0,0 +1,34 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class TagTest : MonoBehaviour + { + [Tag] + public string tag0; + + public TagNest1 nest1; + + [Button] + private void LogTag0() + { + Debug.Log(tag0); + } + } + + [System.Serializable] + public class TagNest1 + { + [Tag] + public string tag1; + + public TagNest2 nest2; + } + + [System.Serializable] + public struct TagNest2 + { + [Tag] + public string tag2; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/TagTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/TagTest.cs.meta new file mode 100644 index 0000000..88ea5af --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/TagTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8bcc0d5613b48fb43bd36c9d37e99900 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/ValidateInputTest.cs b/Assets/NaughtyAttributes/Scripts/Test/ValidateInputTest.cs new file mode 100644 index 0000000..2f21264 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ValidateInputTest.cs @@ -0,0 +1,52 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ValidateInputTest : MonoBehaviour + { + [ValidateInput("NotZero0", "int0 must not be zero")] + public int int0; + + private bool NotZero0(int value) + { + return value != 0; + } + + public ValidateInputNest1 nest1; + + public ValidateInputInheritedNest inheritedNest; + } + + [System.Serializable] + public class ValidateInputNest1 + { + [ValidateInput("NotZero1")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int int1; + + private bool NotZero1(int value) + { + return value != 0; + } + + public ValidateInputNest2 nest2; + } + + [System.Serializable] + public class ValidateInputNest2 + { + [ValidateInput("NotZero2")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int int2; + + private bool NotZero2(int value) + { + return value != 0; + } + } + + [System.Serializable] + public class ValidateInputInheritedNest : ValidateInputNest1 + { + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/ValidateInputTest.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/ValidateInputTest.cs.meta new file mode 100644 index 0000000..f57070a --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/ValidateInputTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 94adafcfe59aa344c9b5596b2cc6ecd0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/_NaughtyComponent.cs b/Assets/NaughtyAttributes/Scripts/Test/_NaughtyComponent.cs new file mode 100644 index 0000000..a165e93 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/_NaughtyComponent.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class _NaughtyComponent : MonoBehaviour + { + } + + [System.Serializable] + public class MyClass + { + } + + [System.Serializable] + public struct MyStruct + { + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/_NaughtyComponent.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/_NaughtyComponent.cs.meta new file mode 100644 index 0000000..10803ee --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/_NaughtyComponent.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 9c928ea15ae74a44089beb2e534c1a35 +timeCreated: 1507996629 +licenseType: Store +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/_NaughtyScriptableObject.cs b/Assets/NaughtyAttributes/Scripts/Test/_NaughtyScriptableObject.cs new file mode 100644 index 0000000..6448b0d --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/_NaughtyScriptableObject.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + //[CreateAssetMenu(fileName = "NaughtyScriptableObject", menuName = "NaughtyAttributes/_NaughtyScriptableObject")] + public class _NaughtyScriptableObject : ScriptableObject + { + [Expandable] + public List<_TestScriptableObject> list; + } +} diff --git a/Assets/NaughtyAttributes/Scripts/Test/_NaughtyScriptableObject.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/_NaughtyScriptableObject.cs.meta new file mode 100644 index 0000000..6328fa3 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/_NaughtyScriptableObject.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 753bdb918c6038142acddbd7aae6958f +timeCreated: 1518639587 +licenseType: Store +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/Scripts/Test/_TestScriptableObject.cs b/Assets/NaughtyAttributes/Scripts/Test/_TestScriptableObject.cs new file mode 100644 index 0000000..56b7131 --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/_TestScriptableObject.cs @@ -0,0 +1,24 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + //[CreateAssetMenu(fileName = "TestScriptableObject", menuName = "NaughtyAttributes/TestScriptableObject")] + public class _TestScriptableObject : ScriptableObject + { + [MinMaxSlider(0.0f, 1.0f)] + public Vector2 minMaxSlider; + + [Dropdown("GetVectorValues")] + public Vector3 vectorValue; + + private DropdownList GetVectorValues() + { + return new DropdownList() + { + { "Right", Vector3.right }, + { "Up", Vector3.up }, + { "Forward", Vector3.forward } + }; + } + } +} \ No newline at end of file diff --git a/Assets/NaughtyAttributes/Scripts/Test/_TestScriptableObject.cs.meta b/Assets/NaughtyAttributes/Scripts/Test/_TestScriptableObject.cs.meta new file mode 100644 index 0000000..5037e5c --- /dev/null +++ b/Assets/NaughtyAttributes/Scripts/Test/_TestScriptableObject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 19472ac11eae27a4b804f354ca7d9c00 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NaughtyAttributes/package.json b/Assets/NaughtyAttributes/package.json new file mode 100644 index 0000000..47f9147 --- /dev/null +++ b/Assets/NaughtyAttributes/package.json @@ -0,0 +1,17 @@ +{ + "name": "com.dbrizov.naughtyattributes", + "displayName": "NaughtyAttributes", + "version": "2.1.0", + "unity": "2018.4", + "description": "NaughtyAttributes is an extension for the Unity Inspector.", + "keywords": [ "attribute", "inspector", "editor" ], + "category": "editor extensions", + "dependencies": {}, + "samples": [ + { + "displayName": "Demo Scene", + "description": "Demo Scene", + "path": "Samples/DemoScene" + } + ] +} diff --git a/Assets/NaughtyAttributes/package.json.meta b/Assets/NaughtyAttributes/package.json.meta new file mode 100644 index 0000000..6f1fa82 --- /dev/null +++ b/Assets/NaughtyAttributes/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: db9a5ca20403b0344ae64015de8f8c86 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 9d847ad..5a0bb85 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -690,6 +690,7 @@ GameObject: - component: {fileID: 327492103} - component: {fileID: 327492102} - component: {fileID: 327492107} + - component: {fileID: 327492109} m_Layer: 3 m_Name: Dobber m_TagString: Player @@ -709,8 +710,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: ec5d582fdf544e84d8dff955464dd912, type: 3} m_Name: m_EditorClassIdentifier: - moveSpeed: 1.5 - sprintSpeed: 3 + inputReferences: {fileID: 327492109} + moveSpeed: 2 + sprintSpeed: 4 turnSpeed: 5 --- !u!54 &327492103 Rigidbody: @@ -785,7 +787,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 327492101} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 2.02, z: 0} + m_LocalPosition: {x: -2.11, y: 1.577, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 538642876} @@ -803,9 +805,21 @@ CapsuleCollider: m_IsTrigger: 0 m_Enabled: 1 m_Radius: 0.5 - m_Height: 2 + m_Height: 1 m_Direction: 1 m_Center: {x: 0, y: 0, z: 0} +--- !u!114 &327492109 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 327492101} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8459aa7dda3b68a4091ac26c935c9207, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &461855388 GameObject: m_ObjectHideFlags: 0 @@ -950,8 +964,8 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 461855388} - m_LocalRotation: {x: 0.27059805, y: -0.65328145, z: 0.27059805, w: 0.65328157} - m_LocalPosition: {x: 10, y: 12.02, z: 0} + m_LocalRotation: {x: 0.27059808, y: -0.65328145, z: 0.27059802, w: 0.65328157} + m_LocalPosition: {x: 7.8900003, y: 11.577, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} @@ -968,7 +982,7 @@ Mesh: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_Name: pb_Mesh20402 + m_Name: pb_Mesh20720 serializedVersion: 10 m_SubMeshes: - serializedVersion: 2 @@ -1243,8 +1257,8 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 868555978} - m_LocalRotation: {x: 0.27059805, y: -0.65328145, z: 0.27059805, w: 0.65328157} - m_LocalPosition: {x: 10, y: 12.02, z: 0} + m_LocalRotation: {x: 0.27059808, y: -0.65328145, z: 0.27059802, w: 0.65328157} + m_LocalPosition: {x: 7.8900003, y: 11.577, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 1706117571} @@ -1353,7 +1367,7 @@ Mesh: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_Name: pb_Mesh20314 + m_Name: pb_Mesh20348 serializedVersion: 10 m_SubMeshes: - serializedVersion: 2 @@ -1635,7 +1649,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: f6c10dd1253711b4e832373429b08971, type: 3} propertyPath: m_LocalPosition.y - value: -0.68 + value: -0.263 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: f6c10dd1253711b4e832373429b08971, type: 3} propertyPath: m_LocalPosition.z @@ -1673,6 +1687,30 @@ PrefabInstance: propertyPath: m_Name value: dobber objectReference: {fileID: 0} + - target: {fileID: 2754812699227853805, guid: f6c10dd1253711b4e832373429b08971, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2754812699227853805, guid: f6c10dd1253711b4e832373429b08971, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2754812699227853805, guid: f6c10dd1253711b4e832373429b08971, type: 3} + propertyPath: m_LocalRotation.w + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 2754812699227853805, guid: f6c10dd1253711b4e832373429b08971, type: 3} + propertyPath: m_LocalRotation.x + value: -0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 2754812699227853805, guid: f6c10dd1253711b4e832373429b08971, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2754812699227853805, guid: f6c10dd1253711b4e832373429b08971, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: -90 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: f6c10dd1253711b4e832373429b08971, type: 3} --- !u!1 &1706117570 @@ -1897,6 +1935,7 @@ GameObject: - component: {fileID: 1945878214} - component: {fileID: 1945878213} - component: {fileID: 1945878212} + - component: {fileID: 1945878217} m_Layer: 0 m_Name: Trap m_TagString: Untagged @@ -2190,7 +2229,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1945878210} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 1, z: -5} + m_LocalPosition: {x: 0, y: 1, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} @@ -2208,6 +2247,42 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 04f87e1001e495c48ad06e9fc0522894, type: 3} m_Name: m_EditorClassIdentifier: - isSet: 0 + showReachRangeSphere: 0 + trapReachRangeDebugColor: {r: 1, g: 0, b: 0, a: 0.54901963} + showActivationReach: 0 + trapActivationReachRangeDebugColor: {r: 1, g: 0.28652775, b: 0, a: 0.54901963} + showInteractionReach: 0 + trapInteractionReachRangeDebugColor: {r: 0, g: 0.21038437, b: 1, a: 1} + isSet: 1 + isActivated: 0 + playerInRange: 0 + robberInRange: 0 + inputReferences: {fileID: 1945878217} unsetMaterial: {fileID: 2100000, guid: 79f64ed6f5d6d374d91c3a0af4070258, type: 2} setMaterial: {fileID: 2100000, guid: 5a26de236ce89e94b963be8fa2b7ade6, type: 2} + trapType: Pinns + linkAllOffsets: 1 + masterOffset: {x: 0.5, y: 0.5, z: -0.5} + trapInteractionRadiusOffset: {x: 0.5, y: 0.5, z: -0.5} + trapInteractionRadius: 1.5 + trapActivationRangeOffset: {x: 0.5, y: 0.5, z: -0.5} + trapActivationRange: 2 + trapRangeOffset: {x: 0.5, y: 0.5, z: -0.5} + trapRange: 5 + hasActivationDelay: 0 + trapActivationDelay: 0 + isRechargable: 0 + rechargeTime: 0 + requieresPlayer: 0 +--- !u!114 &1945878217 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1945878210} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8459aa7dda3b68a4091ac26c935c9207, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/ScriptTemplates.meta b/Assets/ScriptTemplates.meta new file mode 100644 index 0000000..67ecdba --- /dev/null +++ b/Assets/ScriptTemplates.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 93a300da25184c941b2c6df9a88ed311 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ScriptTemplates/80-Clean Script-NewCleanScript.cs.txt b/Assets/ScriptTemplates/80-Clean Script-NewCleanScript.cs.txt new file mode 100644 index 0000000..274f5b6 --- /dev/null +++ b/Assets/ScriptTemplates/80-Clean Script-NewCleanScript.cs.txt @@ -0,0 +1,7 @@ +using qASIC; +using UnityEngine; + +public class #SCRIPTNAME# : MonoBehaviour +{ + #NOTRIM# +} diff --git a/Assets/ScriptTemplates/80-Clean Script-NewCleanScript.cs.txt.meta b/Assets/ScriptTemplates/80-Clean Script-NewCleanScript.cs.txt.meta new file mode 100644 index 0000000..4303923 --- /dev/null +++ b/Assets/ScriptTemplates/80-Clean Script-NewCleanScript.cs.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ca30dd54d7b99c141a7d26a11cf732ef +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ScriptTemplates/80-State Machine Behaviour-NewStateMachineBehaviour.cs.txt b/Assets/ScriptTemplates/80-State Machine Behaviour-NewStateMachineBehaviour.cs.txt new file mode 100644 index 0000000..bf3bc95 --- /dev/null +++ b/Assets/ScriptTemplates/80-State Machine Behaviour-NewStateMachineBehaviour.cs.txt @@ -0,0 +1,34 @@ +using UnityEngine; + +public class #SCRIPTNAME# : StateMachineBehaviour +{ + // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state + override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) + { + #NOTRIM# + } + #NOTRIM# + // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks + override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) + { + #NOTRIM# + } + #NOTRIM# + // OnStateExit is called when a transition ends and the state machine finishes evaluating this state + override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) + { + #NOTRIM# + } + #NOTRIM# + // OnStateMove is called right after Animator.OnAnimatorMove() + override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) + { + // Implement code that processes and affects root motion + } + #NOTRIM# + // OnStateIK is called right after Animator.OnAnimatorIK() + override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) + { + // Implement code that sets up animation IK (inverse kinematics) + } +} diff --git a/Assets/ScriptTemplates/80-State Machine Behaviour-NewStateMachineBehaviour.cs.txt.meta b/Assets/ScriptTemplates/80-State Machine Behaviour-NewStateMachineBehaviour.cs.txt.meta new file mode 100644 index 0000000..457d8d1 --- /dev/null +++ b/Assets/ScriptTemplates/80-State Machine Behaviour-NewStateMachineBehaviour.cs.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0948e50486f2bb4439a0691eda1a35af +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ScriptTemplates/80-TXT File-NewTextFile.txt.txt b/Assets/ScriptTemplates/80-TXT File-NewTextFile.txt.txt new file mode 100644 index 0000000..e69de29 diff --git a/Assets/ScriptTemplates/80-TXT File-NewTextFile.txt.txt.meta b/Assets/ScriptTemplates/80-TXT File-NewTextFile.txt.txt.meta new file mode 100644 index 0000000..1aa6e1c --- /dev/null +++ b/Assets/ScriptTemplates/80-TXT File-NewTextFile.txt.txt.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 42d50fa2d5edc0d4799a6b400e998c9d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ScriptTemplates/80-qASIC__Console Command-NewConsoleCommand.cs.txt b/Assets/ScriptTemplates/80-qASIC__Console Command-NewConsoleCommand.cs.txt new file mode 100644 index 0000000..90b131d --- /dev/null +++ b/Assets/ScriptTemplates/80-qASIC__Console Command-NewConsoleCommand.cs.txt @@ -0,0 +1,18 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using qASIC.Console.Commands; + +public class #SCRIPTNAME# : GameConsoleCommand +{ + public override string CommandName { get; } = "#SCRIPTNAME#"; + public override string Description { get; } = "insert description that will be displayed in help here"; + public override string Help { get; } = "Insert detailed description that will show up in the specific help message fe. Use Hello