├── Assets ├── ShaderVariantTool │ ├── Editor │ │ ├── ShaderVariantTool.asset │ │ ├── ShaderVariantTool.asset.meta │ │ ├── GUIHelper.cs.meta │ │ ├── SettingMenuItems.cs.meta │ │ ├── ShaderVariantTool.cs.meta │ │ ├── AddShaderVariantsWindow.cs.meta │ │ ├── ShaderVariantToolEditor.cs.meta │ │ ├── SettingMenuItems.cs │ │ ├── AddShaderVariantsWindow.cs │ │ ├── ShaderVariantTool.cs │ │ ├── ShaderVariantToolEditor.cs │ │ └── GUIHelper.cs │ └── Editor.meta └── ShaderVariantTool.meta ├── LICENSE └── README.md /Assets/ShaderVariantTool/Editor/ShaderVariantTool.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kimsama/Unity-ShaderVariantCollectionTool/HEAD/Assets/ShaderVariantTool/Editor/ShaderVariantTool.asset -------------------------------------------------------------------------------- /Assets/ShaderVariantTool.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4ff1e81fe3bb687469750636ae03e01f 3 | folderAsset: yes 4 | timeCreated: 1472708055 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ShaderVariantTool/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 818334489d134ef43a65e85e6df587c0 3 | folderAsset: yes 4 | timeCreated: 1472708062 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ShaderVariantTool/Editor/ShaderVariantTool.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c1943b0a5f7c9bc4f92dc451e0749229 3 | timeCreated: 1472716011 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ShaderVariantTool/Editor/GUIHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ea9c09bb0d3662c4e882468060d02dd7 3 | timeCreated: 1472712434 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/ShaderVariantTool/Editor/SettingMenuItems.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56f80137809e805469d7ce416623453b 3 | timeCreated: 1472708142 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/ShaderVariantTool/Editor/ShaderVariantTool.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad078936fda48c84499ebe34b750cea9 3 | timeCreated: 1472708496 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/ShaderVariantTool/Editor/AddShaderVariantsWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 90275546bd9da774084299d58b98cd56 3 | timeCreated: 1472721414 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/ShaderVariantTool/Editor/ShaderVariantToolEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c84fe7e22a5787048bdb7a9637bca252 3 | timeCreated: 1472709206 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/ShaderVariantTool/Editor/SettingMenuItems.cs: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// SettingMenuItems.cs 4 | /// 5 | /// (c)2016 Kim, Hyoun Woo 6 | /// 7 | /////////////////////////////////////////////////////////////////////////////// 8 | using UnityEngine; 9 | using UnityEditor; 10 | 11 | namespace ShaderVariant.Tool 12 | { 13 | public class ShaderVariantCollectionSettingMenuItems 14 | { 15 | 16 | [MenuItem("Tools/ShaderVariant/Create ShaderVariantCollection Setting")] 17 | static public void CreateShaderVariantCollectionSetting() 18 | { 19 | ShaderVariantTool.CreateSetting(); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Kim, Hyoun Woo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unity-ShaderVariantCollectionTool 2 | A simple shader variant collection tool for Unity 5.x 3 | 4 | Unity's default behaviour is to postpone the compilation / optimization of a shader loaded at runtime until it appears on screen. 5 | 6 | See [ShaderVariantCollection.WarmUp](https://docs.unity3d.com/ScriptReference/ShaderVariantCollection.WarmUp.html) document for more details. 7 | 8 | It collects shader variants which will be used during a play session and save it out as an asset so which can be set on 'Graphics Setting', 9 | so it allows preloading that shaders which can prevent shader compilation problem causes cpu spike when a model is firstly shown. 10 | 11 | ## References 12 | 13 | * [Shader variant at `Dragonjoon`'s blog page](http://dragonjoon.blogspot.kr/2015/08/variants.html) - Well described about Unity's shader variants. (*written in Korean*) 14 | * [Shader variant at `Es_Program` on Qiita](http://qiita.com/Es_Program/items/79edf9f8fca786b365aa) - Well described about conditional compilation of Unity shader and its *`keywords`*.(*written in Japanges*) 15 | * [Using Shader Variant at `vui` on Qiita]() - *`AddShaderVariantsWindow`* was found on here. (*written in Japanges*) -------------------------------------------------------------------------------- /Assets/ShaderVariantTool/Editor/AddShaderVariantsWindow.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using System.Collections; 4 | 5 | namespace ShaderVariant.Tool 6 | { 7 | /// 8 | /// Enable to add multiple shader files into .shadervariant asset file. 9 | /// See: http://qiita.com/vui/items/33673b3187baf08f7ca3 10 | /// 11 | public class AddShaderVariantsWindow : EditorWindow 12 | { 13 | private ShaderVariantCollection svc; 14 | 15 | [MenuItem("Tools/ShaderVariant/Open ShaderVariants Window")] 16 | public static void ShowWindow() 17 | { 18 | EditorWindow.GetWindow(typeof(AddShaderVariantsWindow)); 19 | } 20 | 21 | void OnGUI() 22 | { 23 | svc = (ShaderVariantCollection)EditorGUILayout.ObjectField("ShaderVariantCollection", svc, typeof(ShaderVariantCollection), false); 24 | 25 | if (svc) 26 | { 27 | if (GUILayout.Button("Add Select Shader")) 28 | { 29 | Object[] objs = Selection.objects; 30 | foreach (Object obj in objs) 31 | { 32 | Shader shader = obj as Shader; 33 | if (shader == null) { continue; } 34 | 35 | ShaderVariantCollection.ShaderVariant sv = new ShaderVariantCollection.ShaderVariant(); 36 | sv.shader = shader; 37 | svc.Add(sv); 38 | } 39 | } 40 | } 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Assets/ShaderVariantTool/Editor/ShaderVariantTool.cs: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// ShaderVariantTool.cs 4 | /// 5 | /// (c)2016 Kim, Hyoun Woo 6 | /// 7 | /////////////////////////////////////////////////////////////////////////////// 8 | using UnityEngine; 9 | using UnityEngine.Rendering; 10 | #if UNITY_EDITOR 11 | using UnityEditor; 12 | #endif 13 | using System; 14 | using System.Collections; 15 | using System.IO; 16 | 17 | namespace ShaderVariant.Tool 18 | { 19 | /// 20 | /// Collect shader variants from shader files which are under the given path 21 | /// and create .shadervariants asset file. 22 | /// 23 | public class ShaderVariantTool : ScriptableObject 24 | { 25 | // folder where shader files are. 26 | public string[] folders; 27 | 28 | // shader keyword 29 | public string[] keywords; 30 | 31 | // rendering pass type. 32 | [HideInInspector] 33 | public PassType passType = PassType.ForwardAdd; 34 | 35 | // output path where the created .shadervariants asset file will be put. 36 | [HideInInspector] 37 | public string outputPath = "Assets/"; 38 | 39 | private readonly string assetFileExt = ".shadervariants"; 40 | [HideInInspector] 41 | public string assetFileName = "NewShaderVariants"; 42 | 43 | /// 44 | /// Collect shader variants from shader files which are under the given path. 45 | /// 46 | public void CollectShaderVariants() 47 | { 48 | if (folders.Length <= 0) 49 | { 50 | string msg = "Empty folders.\nSpecify folder where shader files are.\nNote the path should start with 'Assets/'."; 51 | EditorUtility.DisplayDialog("Error", msg, "OK"); 52 | return; 53 | } 54 | 55 | var collection = new ShaderVariantCollection(); 56 | 57 | var shaders = AssetDatabase.FindAssets("t:Shader", folders); 58 | 59 | try 60 | { 61 | foreach (var guid in shaders) 62 | { 63 | var path = AssetDatabase.GUIDToAssetPath(guid); 64 | var shader = AssetDatabase.LoadAssetAtPath(path); 65 | var variant = new ShaderVariantCollection.ShaderVariant(shader, passType, keywords); 66 | collection.Add(variant); 67 | } 68 | } 69 | catch(Exception e) 70 | { 71 | // Throw an ArgumentException if shader is null, 72 | // pass type does not exist or variant with the passed keywords is not found. 73 | EditorUtility.DisplayDialog("Error", e.Message, "OK"); 74 | } 75 | 76 | // save as asset. 77 | string assetPath = Path.Combine(outputPath, assetFileName + assetFileExt); 78 | AssetDatabase.CreateAsset(collection, assetPath); 79 | } 80 | 81 | /// 82 | /// Retrievs current path of this project. 83 | /// Unity editor expects the current folder to be set to the project folder at all times. 84 | /// 85 | /// 86 | public static string GetProjectPath() 87 | { 88 | string projectPath = System.IO.Directory.GetCurrentDirectory(); 89 | projectPath = projectPath.Replace('\\', '/'); 90 | projectPath += "/"; // last trail 91 | return projectPath; 92 | } 93 | 94 | #if UNITY_EDITOR 95 | public static void CreateSetting() 96 | { 97 | string path = "Assets/ShaderVariantTool/Editor/"; 98 | string file = "ShaderVariantTool.asset"; 99 | string filePath = path + file; 100 | 101 | ShaderVariantTool instance = ScriptableObject.CreateInstance(); 102 | AssetDatabase.CreateAsset(instance, filePath); 103 | AssetDatabase.SaveAssets(); 104 | } 105 | #endif 106 | } 107 | } -------------------------------------------------------------------------------- /Assets/ShaderVariantTool/Editor/ShaderVariantToolEditor.cs: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// ShaderVariantToolEditor.cs 4 | /// 5 | /// (c)2016 Kim, Hyoun Woo 6 | /// 7 | /////////////////////////////////////////////////////////////////////////////// 8 | using UnityEngine; 9 | using UnityEngine.Rendering; 10 | using UnityEditor; 11 | using System.Collections; 12 | using System.IO; 13 | 14 | namespace ShaderVariant.Tool 15 | { 16 | [CustomEditor(typeof(ShaderVariantTool))] 17 | public class ShaderVariantToolEditor : Editor 18 | { 19 | ShaderVariantTool tool = null; 20 | 21 | protected SerializedObject targetObject; 22 | protected SerializedProperty foldersProp; 23 | protected SerializedProperty keywordsProp; 24 | 25 | void OnEnable() 26 | { 27 | tool = target as ShaderVariantTool; 28 | 29 | // serialzied things. 30 | targetObject = new SerializedObject(tool); 31 | foldersProp = targetObject.FindProperty("folders"); 32 | keywordsProp = targetObject.FindProperty("keywords"); 33 | } 34 | 35 | public override void OnInspectorGUI() 36 | { 37 | if (target == null) 38 | return; 39 | 40 | // Header Title 41 | GUIStyle headerStyle = GUITool.GUIHelper.MakeHeader(); 42 | EditorGUILayout.LabelField("ShaderVariant Collection Tool", headerStyle, GUILayout.Height(20)); 43 | EditorGUILayout.Space(); 44 | 45 | // Specify the place where all shader files are. 46 | EditorGUILayout.LabelField("Shader:", EditorStyles.boldLabel); 47 | GUITool.GUIHelper.DrawSerializedProperty(foldersProp); 48 | GUITool.GUIHelper.DrawSerializedProperty(keywordsProp); 49 | 50 | EditorGUILayout.Space(); 51 | 52 | // Specify rendering pass type. 53 | EditorGUILayout.LabelField("PassType:", EditorStyles.boldLabel); 54 | tool.passType = (PassType)EditorGUILayout.EnumPopup(tool.passType, GUILayout.MaxWidth(200)); 55 | 56 | EditorGUILayout.Space(); 57 | 58 | EditorGUILayout.LabelField("Output:", EditorStyles.boldLabel); 59 | float originalWidth = EditorGUIUtility.labelWidth; 60 | EditorGUIUtility.labelWidth = 50f; 61 | 62 | // output folder 63 | using (new EditorGUILayout.HorizontalScope()) 64 | { 65 | string path = string.Empty; 66 | if (string.IsNullOrEmpty(tool.outputPath)) 67 | path = ShaderVariantTool.GetProjectPath(); 68 | else 69 | path = tool.outputPath; 70 | 71 | tool.outputPath = EditorGUILayout.TextField(" path: ", tool.outputPath, GUILayout.MinWidth(250)); 72 | if (GUILayout.Button("...", GUILayout.Width(20))) 73 | { 74 | string projectFolder = Path.Combine(ShaderVariantTool.GetProjectPath(), tool.outputPath); 75 | path = EditorUtility.OpenFolderPanel("Select folder", projectFolder, ""); 76 | if (path.Length != 0) 77 | { 78 | tool.outputPath = path.Replace(ShaderVariantTool.GetProjectPath(), ""); 79 | } 80 | } 81 | } 82 | 83 | // Specify the asset filename which will be created. 84 | tool.assetFileName = EditorGUILayout.TextField(" file: ", tool.assetFileName, GUILayout.MinWidth(300)); 85 | EditorGUIUtility.labelWidth = originalWidth; 86 | EditorGUILayout.Space(); 87 | 88 | // Collect! 89 | EditorGUILayout.LabelField("ShaderVariant:", EditorStyles.boldLabel); 90 | if (GUILayout.Button("Collect")) 91 | { 92 | tool.CollectShaderVariants(); 93 | } 94 | 95 | // Save if there are any changes. 96 | if (GUI.changed) 97 | { 98 | if (targetObject.ApplyModifiedProperties()) 99 | { 100 | EditorUtility.SetDirty(tool); 101 | AssetDatabase.Refresh(); 102 | } 103 | } 104 | } 105 | } 106 | } -------------------------------------------------------------------------------- /Assets/ShaderVariantTool/Editor/GUIHelper.cs: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// GUIHelper.cs 4 | /// 5 | /// (c)2015 Kim, Hyoun Woo 6 | /// 7 | /////////////////////////////////////////////////////////////////////////////// 8 | using UnityEngine; 9 | using UnityEditor; 10 | 11 | namespace GUITool 12 | { 13 | public static class GUIHelper 14 | { 15 | public static GUIStyle MakeHeader() 16 | { 17 | GUIStyle headerStyle = new GUIStyle(GUI.skin.label); 18 | headerStyle.fontSize = 12; 19 | headerStyle.fontStyle = FontStyle.Bold; 20 | 21 | return headerStyle; 22 | } 23 | 24 | /// 25 | /// A wrapper put help message on the Inspector. 26 | /// 27 | public static void HelpBox(string message, MessageType msgType) 28 | { 29 | EditorGUILayout.HelpBox(message, msgType); 30 | } 31 | 32 | const int defaultVisibleArrayElements = 20; 33 | static int maxVisibleArrayElements = defaultVisibleArrayElements; 34 | 35 | /// 36 | /// Recursively draw properties of the given SerializedProperty data. 37 | /// 38 | public static void DrawSerializedProperty(SerializedProperty prop, GUIStyle guiStyle = null) 39 | { 40 | switch (prop.propertyType) 41 | { 42 | case SerializedPropertyType.Generic: 43 | // make Array and Object to be fold 44 | prop.isExpanded = EditorGUILayout.Foldout(prop.isExpanded, prop.name); 45 | if (!prop.isExpanded) 46 | break; 47 | 48 | // increase indentation 49 | EditorGUI.indentLevel++; 50 | if (!prop.isArray) 51 | { 52 | // get Serializable Object 53 | var child = prop.Copy(); 54 | var end = prop.GetEndProperty(true); 55 | if (child.Next(true)) 56 | { 57 | while (!SerializedProperty.EqualContents(child, end)) 58 | { 59 | DrawSerializedProperty(child); 60 | if (!child.Next(false)) 61 | break; 62 | } 63 | } 64 | } 65 | else 66 | { 67 | // Handles array type with separate way due to SerializedProperty provides 68 | // its own method for array type. 69 | prop.arraySize = EditorGUILayout.IntField("Length", prop.arraySize); 70 | var showCount = Mathf.Min(prop.arraySize, maxVisibleArrayElements); 71 | for (int i = 0; i < showCount; i++) 72 | { 73 | if (guiStyle != null) 74 | { 75 | using (new GUILayout.VerticalScope()) 76 | { 77 | DrawSerializedProperty(prop.GetArrayElementAtIndex(i)); 78 | } 79 | } 80 | else 81 | DrawSerializedProperty(prop.GetArrayElementAtIndex(i)); 82 | } 83 | // Hide elements if it exceeds defined show count. 84 | if (prop.arraySize > showCount) 85 | { 86 | using (new GUILayout.HorizontalScope()) 87 | { 88 | // Do indentation 89 | for (int i = 0; i < EditorGUI.indentLevel; i++) 90 | { 91 | GUILayout.Space(EditorGUIUtility.singleLineHeight); 92 | } 93 | if (GUILayout.Button("Show more ...")) 94 | { 95 | maxVisibleArrayElements += defaultVisibleArrayElements; 96 | } 97 | } 98 | } 99 | } 100 | // decrease indentation 101 | EditorGUI.indentLevel--; 102 | break; 103 | case SerializedPropertyType.Integer: 104 | prop.intValue = EditorGUILayout.IntField(prop.name, prop.intValue); 105 | break; 106 | case SerializedPropertyType.Boolean: 107 | prop.boolValue = EditorGUILayout.Toggle(prop.name, prop.boolValue); 108 | break; 109 | case SerializedPropertyType.Float: 110 | prop.floatValue = EditorGUILayout.FloatField(prop.name, prop.floatValue); 111 | break; 112 | case SerializedPropertyType.String: 113 | prop.stringValue = EditorGUILayout.TextField(prop.name, prop.stringValue); 114 | break; 115 | case SerializedPropertyType.Color: 116 | prop.colorValue = EditorGUILayout.ColorField(prop.name, prop.colorValue); 117 | break; 118 | case SerializedPropertyType.ObjectReference: 119 | prop.objectReferenceValue = EditorGUILayout.ObjectField( 120 | prop.name, prop.objectReferenceValue, typeof(Object), true); 121 | EditorGUI.indentLevel++; 122 | EditorGUILayout.LabelField("Type", prop.type); 123 | EditorGUI.indentLevel--; 124 | break; 125 | case SerializedPropertyType.LayerMask: 126 | prop.intValue = EditorGUILayout.IntField(prop.name, prop.intValue); 127 | break; 128 | case SerializedPropertyType.Enum: 129 | // Both of Mask and normal status are shown 130 | EditorGUILayout.PropertyField(prop); 131 | prop.enumValueIndex = EditorGUILayout.IntField(prop.name, prop.enumValueIndex); 132 | EditorGUI.indentLevel++; 133 | prop.enumValueIndex = EditorGUILayout.Popup("< Enum >", prop.enumValueIndex, prop.enumNames); 134 | prop.enumValueIndex = EditorGUILayout.MaskField("< Mask >", prop.enumValueIndex, prop.enumNames); 135 | EditorGUI.indentLevel--; 136 | break; 137 | case SerializedPropertyType.Vector2: 138 | prop.vector2Value = EditorGUILayout.Vector2Field(prop.name, prop.vector2Value); 139 | break; 140 | case SerializedPropertyType.Vector3: 141 | prop.vector3Value = EditorGUILayout.Vector3Field(prop.name, prop.vector3Value); 142 | break; 143 | case SerializedPropertyType.Rect: 144 | prop.rectValue = EditorGUILayout.RectField(prop.name, prop.rectValue); 145 | break; 146 | case SerializedPropertyType.ArraySize: 147 | prop.intValue = EditorGUILayout.IntField(prop.name, prop.intValue); 148 | break; 149 | case SerializedPropertyType.Character: 150 | EditorGUILayout.PropertyField(prop); 151 | break; 152 | case SerializedPropertyType.AnimationCurve: 153 | prop.animationCurveValue = EditorGUILayout.CurveField(prop.name, prop.animationCurveValue); 154 | break; 155 | case SerializedPropertyType.Bounds: 156 | prop.boundsValue = EditorGUILayout.BoundsField(prop.name, prop.boundsValue); 157 | break; 158 | case SerializedPropertyType.Gradient: 159 | EditorGUILayout.PropertyField(prop); 160 | break; 161 | case SerializedPropertyType.Quaternion: 162 | prop.quaternionValue = Quaternion.Euler( 163 | EditorGUILayout.Vector3Field(prop.name, prop.quaternionValue.eulerAngles)); 164 | break; 165 | } 166 | } 167 | 168 | } 169 | } 170 | --------------------------------------------------------------------------------