├── .gitignore ├── Assets ├── Editor.meta ├── Editor │ ├── DebugUtilsEditor.cs │ └── DebugUtilsEditor.cs.meta ├── Scripts.meta ├── Scripts │ ├── DebugUtils.cs │ └── DebugUtils.cs.meta ├── SerializableDictionary.meta └── SerializableDictionary │ ├── Editor.meta │ ├── Editor │ ├── SerializableDictionaryPropertyDrawer.cs │ └── SerializableDictionaryPropertyDrawer.cs.meta │ ├── Example.meta │ ├── Example │ ├── SerializableDicitonary Example.unity │ ├── SerializableDicitonary Example.unity.meta │ ├── SerializableDictionaryExample.cs │ ├── SerializableDictionaryExample.cs.meta │ ├── UserSerializableDictionaries.cs │ └── UserSerializableDictionaries.cs.meta │ ├── SerializableDictionary.cs │ ├── SerializableDictionary.cs.meta │ ├── SerializableDictionary.pdf │ ├── SerializableDictionary.pdf.meta │ ├── SerializableHashSet.cs │ └── SerializableHashSet.cs.meta ├── LICENSE ├── Packages ├── manifest.json └── packages-lock.json ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── PackageManagerSettings.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset ├── UnityConnectSettings.asset ├── VFXManager.asset └── XRSettings.asset ├── README.md └── docs ├── SerializableDictionary_screenshot1.png ├── SerializableDictionary_screenshot2.png ├── SerializableDictionary_screenshot3.png ├── SerializableDictionary_screenshot4.png └── SerializableDictionary_screenshot5.png /.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Uu]ser[Ss]ettings/ 12 | 13 | # MemoryCaptures can get excessive in size. 14 | # They also could contain extremely sensitive data 15 | /[Mm]emoryCaptures/ 16 | 17 | # Asset meta data should only be ignored when the corresponding asset is also ignored 18 | !/[Aa]ssets/**/*.meta 19 | 20 | # Uncomment this line if you wish to ignore the asset store tools plugin 21 | # /[Aa]ssets/AssetStoreTools* 22 | 23 | # Autogenerated Jetbrains Rider plugin 24 | /[Aa]ssets/Plugins/Editor/JetBrains* 25 | 26 | # Visual Studio cache directory 27 | .vs/ 28 | 29 | # Gradle cache directory 30 | .gradle/ 31 | 32 | # Autogenerated VS/MD/Consulo solution and project files 33 | ExportedObj/ 34 | .consulo/ 35 | *.csproj 36 | *.unityproj 37 | *.sln 38 | *.suo 39 | *.tmp 40 | *.user 41 | *.userprefs 42 | *.pidb 43 | *.booproj 44 | *.svd 45 | *.pdb 46 | *.mdb 47 | *.opendb 48 | *.VC.db 49 | 50 | # Unity3D generated meta files 51 | *.pidb.meta 52 | *.pdb.meta 53 | *.mdb.meta 54 | 55 | # Unity3D generated file on crash reports 56 | sysinfo.txt 57 | 58 | # Builds 59 | *.apk 60 | *.aab 61 | *.unitypackage 62 | 63 | # Crashlytics generated file 64 | crashlytics-build.properties 65 | 66 | # Packed Addressables 67 | /[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin* 68 | 69 | # Temporary auto-generated Android Assets 70 | /[Aa]ssets/[Ss]treamingAssets/aa.meta 71 | /[Aa]ssets/[Ss]treamingAssets/aa/* 72 | 73 | /[Aa]ssets/AssetStoreTools 74 | /[Aa]ssets/AssetStoreTools.meta 75 | 76 | .DS_Store 77 | .vscode/ 78 | .vs/ 79 | -------------------------------------------------------------------------------- /Assets/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e566f99fef2079e439ceff9f96929af2 3 | folderAsset: yes 4 | timeCreated: 1492869331 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Editor/DebugUtilsEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | using System.Text; 6 | 7 | public static class DebugUtilsEditor 8 | { 9 | public static string ToString(SerializedProperty property) 10 | { 11 | StringBuilder sb = new StringBuilder(); 12 | var iterator = property.Copy(); 13 | var end = property.GetEndProperty(); 14 | do 15 | { 16 | sb.AppendLine(iterator.propertyPath + " (" + iterator.type + " " + iterator.propertyType + ") = " 17 | + SerializableDictionaryPropertyDrawer.GetPropertyValue(iterator) 18 | #if UNITY_5_6_OR_NEWER 19 | + (iterator.isArray ? " (" + iterator.arrayElementType + ")" : "") 20 | #endif 21 | ); 22 | } while(iterator.Next(true) && iterator.propertyPath != end.propertyPath); 23 | return sb.ToString(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Assets/Editor/DebugUtilsEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5b7d2a000641847429d5e126d8041bf5 3 | timeCreated: 1493478007 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 507f9976f399e407397bc9ccecc6a34a 3 | folderAsset: yes 4 | timeCreated: 1494580492 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Scripts/DebugUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using System.Linq; 5 | using System; 6 | 7 | public static class DebugUtils 8 | { 9 | public static string ToString(Array array) 10 | { 11 | if(array == null) 12 | return "null"; 13 | else 14 | return "{" + string.Join(", ", array.Cast().Select(o => o.ToString()).ToArray()) + "}"; 15 | } 16 | 17 | public static string ToString(Dictionary dict) 18 | { 19 | if(dict == null) 20 | return "null"; 21 | else 22 | return "{" + string.Join(", ", dict.Select(kvp => kvp.Key.ToString() + ":" + kvp.Value.ToString()).ToArray()) + "}"; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Assets/Scripts/DebugUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 31cc353e47e40934c82f169f9468c198 3 | timeCreated: 1493477885 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/SerializableDictionary.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4ea273c3261a84628a936a79731edc23 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/SerializableDictionary/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 20029ee1c099f4b47afbac48208879b9 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/SerializableDictionary/Editor/SerializableDictionaryPropertyDrawer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | using System.Reflection; 6 | using System; 7 | 8 | [CustomPropertyDrawer(typeof(SerializableDictionaryBase), true)] 9 | #if NET_4_6 || NET_STANDARD_2_0 10 | [CustomPropertyDrawer(typeof(SerializableHashSetBase), true)] 11 | #endif 12 | public class SerializableDictionaryPropertyDrawer : PropertyDrawer 13 | { 14 | const string KeysFieldName = "m_keys"; 15 | const string ValuesFieldName = "m_values"; 16 | protected const float IndentWidth = 15f; 17 | 18 | static GUIContent s_iconPlus = IconContent ("Toolbar Plus", "Add entry"); 19 | static GUIContent s_iconMinus = IconContent ("Toolbar Minus", "Remove entry"); 20 | static GUIContent s_warningIconConflict = IconContent ("console.warnicon.sml", "Conflicting key, this entry will be lost"); 21 | static GUIContent s_warningIconOther = IconContent ("console.infoicon.sml", "Conflicting key"); 22 | static GUIContent s_warningIconNull = IconContent ("console.warnicon.sml", "Null key, this entry will be lost"); 23 | static GUIStyle s_buttonStyle = GUIStyle.none; 24 | static GUIContent s_tempContent = new GUIContent(); 25 | 26 | 27 | class ConflictState 28 | { 29 | public object conflictKey = null; 30 | public object conflictValue = null; 31 | public int conflictIndex = -1 ; 32 | public int conflictOtherIndex = -1 ; 33 | public bool conflictKeyPropertyExpanded = false; 34 | public bool conflictValuePropertyExpanded = false; 35 | public float conflictLineHeight = 0f; 36 | } 37 | 38 | struct PropertyIdentity 39 | { 40 | public PropertyIdentity(SerializedProperty property) 41 | { 42 | this.instance = property.serializedObject.targetObject; 43 | this.propertyPath = property.propertyPath; 44 | } 45 | 46 | public UnityEngine.Object instance; 47 | public string propertyPath; 48 | } 49 | 50 | static Dictionary s_conflictStateDict = new Dictionary(); 51 | 52 | enum Action 53 | { 54 | None, 55 | Add, 56 | Remove 57 | } 58 | 59 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 60 | { 61 | label = EditorGUI.BeginProperty(position, label, property); 62 | 63 | Action buttonAction = Action.None; 64 | int buttonActionIndex = 0; 65 | 66 | var keyArrayProperty = property.FindPropertyRelative(KeysFieldName); 67 | var valueArrayProperty = property.FindPropertyRelative(ValuesFieldName); 68 | 69 | ConflictState conflictState = GetConflictState(property); 70 | 71 | if(conflictState.conflictIndex != -1) 72 | { 73 | keyArrayProperty.InsertArrayElementAtIndex(conflictState.conflictIndex); 74 | var keyProperty = keyArrayProperty.GetArrayElementAtIndex(conflictState.conflictIndex); 75 | SetPropertyValue(keyProperty, conflictState.conflictKey); 76 | keyProperty.isExpanded = conflictState.conflictKeyPropertyExpanded; 77 | 78 | if(valueArrayProperty != null) 79 | { 80 | valueArrayProperty.InsertArrayElementAtIndex(conflictState.conflictIndex); 81 | var valueProperty = valueArrayProperty.GetArrayElementAtIndex(conflictState.conflictIndex); 82 | SetPropertyValue(valueProperty, conflictState.conflictValue); 83 | valueProperty.isExpanded = conflictState.conflictValuePropertyExpanded; 84 | } 85 | } 86 | 87 | var buttonWidth = s_buttonStyle.CalcSize(s_iconPlus).x; 88 | 89 | var labelPosition = position; 90 | labelPosition.height = EditorGUIUtility.singleLineHeight; 91 | if (property.isExpanded) 92 | labelPosition.xMax -= s_buttonStyle.CalcSize(s_iconPlus).x; 93 | 94 | EditorGUI.PropertyField(labelPosition, property, label, false); 95 | // property.isExpanded = EditorGUI.Foldout(labelPosition, property.isExpanded, label); 96 | if (property.isExpanded) 97 | { 98 | var buttonPosition = position; 99 | buttonPosition.xMin = buttonPosition.xMax - buttonWidth; 100 | buttonPosition.height = EditorGUIUtility.singleLineHeight; 101 | EditorGUI.BeginDisabledGroup(conflictState.conflictIndex != -1); 102 | if(GUI.Button(buttonPosition, s_iconPlus, s_buttonStyle)) 103 | { 104 | buttonAction = Action.Add; 105 | buttonActionIndex = keyArrayProperty.arraySize; 106 | } 107 | EditorGUI.EndDisabledGroup(); 108 | 109 | EditorGUI.indentLevel++; 110 | var linePosition = position; 111 | linePosition.y += EditorGUIUtility.singleLineHeight; 112 | linePosition.xMax -= buttonWidth; 113 | 114 | foreach(var entry in EnumerateEntries(keyArrayProperty, valueArrayProperty)) 115 | { 116 | var keyProperty = entry.keyProperty; 117 | var valueProperty = entry.valueProperty; 118 | int i = entry.index; 119 | 120 | float lineHeight = DrawKeyValueLine(keyProperty, valueProperty, linePosition, i); 121 | 122 | buttonPosition = linePosition; 123 | buttonPosition.x = linePosition.xMax; 124 | buttonPosition.height = EditorGUIUtility.singleLineHeight; 125 | if(GUI.Button(buttonPosition, s_iconMinus, s_buttonStyle)) 126 | { 127 | buttonAction = Action.Remove; 128 | buttonActionIndex = i; 129 | } 130 | 131 | if(i == conflictState.conflictIndex && conflictState.conflictOtherIndex == -1) 132 | { 133 | var iconPosition = linePosition; 134 | iconPosition.size = s_buttonStyle.CalcSize(s_warningIconNull); 135 | GUI.Label(iconPosition, s_warningIconNull); 136 | } 137 | else if(i == conflictState.conflictIndex) 138 | { 139 | var iconPosition = linePosition; 140 | iconPosition.size = s_buttonStyle.CalcSize(s_warningIconConflict); 141 | GUI.Label(iconPosition, s_warningIconConflict); 142 | } 143 | else if(i == conflictState.conflictOtherIndex) 144 | { 145 | var iconPosition = linePosition; 146 | iconPosition.size = s_buttonStyle.CalcSize(s_warningIconOther); 147 | GUI.Label(iconPosition, s_warningIconOther); 148 | } 149 | 150 | 151 | linePosition.y += lineHeight; 152 | } 153 | 154 | EditorGUI.indentLevel--; 155 | } 156 | 157 | if(buttonAction == Action.Add) 158 | { 159 | keyArrayProperty.InsertArrayElementAtIndex(buttonActionIndex); 160 | if(valueArrayProperty != null) 161 | valueArrayProperty.InsertArrayElementAtIndex(buttonActionIndex); 162 | } 163 | else if(buttonAction == Action.Remove) 164 | { 165 | DeleteArrayElementAtIndex(keyArrayProperty, buttonActionIndex); 166 | if(valueArrayProperty != null) 167 | DeleteArrayElementAtIndex(valueArrayProperty, buttonActionIndex); 168 | } 169 | 170 | conflictState.conflictKey = null; 171 | conflictState.conflictValue = null; 172 | conflictState.conflictIndex = -1; 173 | conflictState.conflictOtherIndex = -1; 174 | conflictState.conflictLineHeight = 0f; 175 | conflictState.conflictKeyPropertyExpanded = false; 176 | conflictState.conflictValuePropertyExpanded = false; 177 | 178 | foreach(var entry1 in EnumerateEntries(keyArrayProperty, valueArrayProperty)) 179 | { 180 | var keyProperty1 = entry1.keyProperty; 181 | int i = entry1.index; 182 | object keyProperty1Value = GetPropertyValue(keyProperty1); 183 | 184 | if(keyProperty1Value == null) 185 | { 186 | var valueProperty1 = entry1.valueProperty; 187 | SaveProperty(keyProperty1, valueProperty1, i, -1, conflictState); 188 | DeleteArrayElementAtIndex(keyArrayProperty, i); 189 | if(valueArrayProperty != null) 190 | DeleteArrayElementAtIndex(valueArrayProperty, i); 191 | 192 | break; 193 | } 194 | 195 | 196 | foreach(var entry2 in EnumerateEntries(keyArrayProperty, valueArrayProperty, i + 1)) 197 | { 198 | var keyProperty2 = entry2.keyProperty; 199 | int j = entry2.index; 200 | object keyProperty2Value = GetPropertyValue(keyProperty2); 201 | 202 | if(ComparePropertyValues(keyProperty1Value, keyProperty2Value)) 203 | { 204 | var valueProperty2 = entry2.valueProperty; 205 | SaveProperty(keyProperty2, valueProperty2, j, i, conflictState); 206 | DeleteArrayElementAtIndex(keyArrayProperty, j); 207 | if(valueArrayProperty != null) 208 | DeleteArrayElementAtIndex(valueArrayProperty, j); 209 | 210 | goto breakLoops; 211 | } 212 | } 213 | } 214 | breakLoops: 215 | 216 | EditorGUI.EndProperty(); 217 | } 218 | 219 | static float DrawKeyValueLine(SerializedProperty keyProperty, SerializedProperty valueProperty, Rect linePosition, int index) 220 | { 221 | bool keyCanBeExpanded = CanPropertyBeExpanded(keyProperty); 222 | 223 | if(valueProperty != null) 224 | { 225 | bool valueCanBeExpanded = CanPropertyBeExpanded(valueProperty); 226 | 227 | if(!keyCanBeExpanded && valueCanBeExpanded) 228 | { 229 | return DrawKeyValueLineExpand(keyProperty, valueProperty, linePosition); 230 | } 231 | else 232 | { 233 | var keyLabel = keyCanBeExpanded ? ("Key " + index.ToString()) : ""; 234 | var valueLabel = valueCanBeExpanded ? ("Value " + index.ToString()) : ""; 235 | return DrawKeyValueLineSimple(keyProperty, valueProperty, keyLabel, valueLabel, linePosition); 236 | } 237 | } 238 | else 239 | { 240 | if(!keyCanBeExpanded) 241 | { 242 | return DrawKeyLine(keyProperty, linePosition, null); 243 | } 244 | else 245 | { 246 | var keyLabel = string.Format("{0} {1}", ObjectNames.NicifyVariableName(keyProperty.type), index); 247 | return DrawKeyLine(keyProperty, linePosition, keyLabel); 248 | } 249 | } 250 | } 251 | 252 | static float DrawKeyValueLineSimple(SerializedProperty keyProperty, SerializedProperty valueProperty, string keyLabel, string valueLabel, Rect linePosition) 253 | { 254 | float labelWidth = EditorGUIUtility.labelWidth; 255 | float labelWidthRelative = labelWidth / linePosition.width; 256 | 257 | float keyPropertyHeight = EditorGUI.GetPropertyHeight(keyProperty); 258 | var keyPosition = linePosition; 259 | keyPosition.height = keyPropertyHeight; 260 | keyPosition.width = labelWidth - IndentWidth; 261 | EditorGUIUtility.labelWidth = keyPosition.width * labelWidthRelative; 262 | EditorGUI.PropertyField(keyPosition, keyProperty, TempContent(keyLabel), true); 263 | 264 | float valuePropertyHeight = EditorGUI.GetPropertyHeight(valueProperty); 265 | var valuePosition = linePosition; 266 | valuePosition.height = valuePropertyHeight; 267 | valuePosition.xMin += labelWidth; 268 | EditorGUIUtility.labelWidth = valuePosition.width * labelWidthRelative; 269 | EditorGUI.indentLevel--; 270 | EditorGUI.PropertyField(valuePosition, valueProperty, TempContent(valueLabel), true); 271 | EditorGUI.indentLevel++; 272 | 273 | EditorGUIUtility.labelWidth = labelWidth; 274 | 275 | return Mathf.Max(keyPropertyHeight, valuePropertyHeight); 276 | } 277 | 278 | static float DrawKeyValueLineExpand(SerializedProperty keyProperty, SerializedProperty valueProperty, Rect linePosition) 279 | { 280 | float labelWidth = EditorGUIUtility.labelWidth; 281 | 282 | float keyPropertyHeight = EditorGUI.GetPropertyHeight(keyProperty); 283 | var keyPosition = linePosition; 284 | keyPosition.height = keyPropertyHeight; 285 | keyPosition.width = labelWidth - IndentWidth; 286 | EditorGUI.PropertyField(keyPosition, keyProperty, GUIContent.none, true); 287 | 288 | float valuePropertyHeight = EditorGUI.GetPropertyHeight(valueProperty); 289 | var valuePosition = linePosition; 290 | valuePosition.height = valuePropertyHeight; 291 | EditorGUI.PropertyField(valuePosition, valueProperty, GUIContent.none, true); 292 | 293 | EditorGUIUtility.labelWidth = labelWidth; 294 | 295 | return Mathf.Max(keyPropertyHeight, valuePropertyHeight); 296 | } 297 | 298 | static float DrawKeyLine(SerializedProperty keyProperty, Rect linePosition, string keyLabel) 299 | { 300 | float keyPropertyHeight = EditorGUI.GetPropertyHeight(keyProperty); 301 | var keyPosition = linePosition; 302 | keyPosition.height = keyPropertyHeight; 303 | keyPosition.width = linePosition.width; 304 | 305 | var keyLabelContent = keyLabel != null ? TempContent(keyLabel) : GUIContent.none; 306 | EditorGUI.PropertyField(keyPosition, keyProperty, keyLabelContent, true); 307 | 308 | return keyPropertyHeight; 309 | } 310 | 311 | static bool CanPropertyBeExpanded(SerializedProperty property) 312 | { 313 | switch(property.propertyType) 314 | { 315 | case SerializedPropertyType.Generic: 316 | case SerializedPropertyType.Vector4: 317 | case SerializedPropertyType.Quaternion: 318 | return true; 319 | default: 320 | return false; 321 | } 322 | } 323 | 324 | static void SaveProperty(SerializedProperty keyProperty, SerializedProperty valueProperty, int index, int otherIndex, ConflictState conflictState) 325 | { 326 | conflictState.conflictKey = GetPropertyValue(keyProperty); 327 | conflictState.conflictValue = valueProperty != null ? GetPropertyValue(valueProperty) : null; 328 | float keyPropertyHeight = EditorGUI.GetPropertyHeight(keyProperty); 329 | float valuePropertyHeight = valueProperty != null ? EditorGUI.GetPropertyHeight(valueProperty) : 0f; 330 | float lineHeight = Mathf.Max(keyPropertyHeight, valuePropertyHeight); 331 | conflictState.conflictLineHeight = lineHeight; 332 | conflictState.conflictIndex = index; 333 | conflictState.conflictOtherIndex = otherIndex; 334 | conflictState.conflictKeyPropertyExpanded = keyProperty.isExpanded; 335 | conflictState.conflictValuePropertyExpanded = valueProperty != null ? valueProperty.isExpanded : false; 336 | } 337 | 338 | public override float GetPropertyHeight(SerializedProperty property, GUIContent label) 339 | { 340 | float propertyHeight = EditorGUIUtility.singleLineHeight; 341 | 342 | if (property.isExpanded) 343 | { 344 | var keysProperty = property.FindPropertyRelative(KeysFieldName); 345 | var valuesProperty = property.FindPropertyRelative(ValuesFieldName); 346 | 347 | foreach(var entry in EnumerateEntries(keysProperty, valuesProperty)) 348 | { 349 | var keyProperty = entry.keyProperty; 350 | var valueProperty = entry.valueProperty; 351 | float keyPropertyHeight = EditorGUI.GetPropertyHeight(keyProperty); 352 | float valuePropertyHeight = valueProperty != null ? EditorGUI.GetPropertyHeight(valueProperty) : 0f; 353 | float lineHeight = Mathf.Max(keyPropertyHeight, valuePropertyHeight); 354 | propertyHeight += lineHeight; 355 | } 356 | 357 | ConflictState conflictState = GetConflictState(property); 358 | 359 | if(conflictState.conflictIndex != -1) 360 | { 361 | propertyHeight += conflictState.conflictLineHeight; 362 | } 363 | } 364 | 365 | return propertyHeight; 366 | } 367 | 368 | static ConflictState GetConflictState(SerializedProperty property) 369 | { 370 | ConflictState conflictState; 371 | PropertyIdentity propId = new PropertyIdentity(property); 372 | if(!s_conflictStateDict.TryGetValue(propId, out conflictState)) 373 | { 374 | conflictState = new ConflictState(); 375 | s_conflictStateDict.Add(propId, conflictState); 376 | } 377 | return conflictState; 378 | } 379 | 380 | static Dictionary s_serializedPropertyValueAccessorsDict; 381 | 382 | static SerializableDictionaryPropertyDrawer() 383 | { 384 | Dictionary serializedPropertyValueAccessorsNameDict = new Dictionary() { 385 | { SerializedPropertyType.Integer, "intValue" }, 386 | { SerializedPropertyType.Boolean, "boolValue" }, 387 | { SerializedPropertyType.Float, "floatValue" }, 388 | { SerializedPropertyType.String, "stringValue" }, 389 | { SerializedPropertyType.Color, "colorValue" }, 390 | { SerializedPropertyType.ObjectReference, "objectReferenceValue" }, 391 | { SerializedPropertyType.LayerMask, "intValue" }, 392 | { SerializedPropertyType.Enum, "intValue" }, 393 | { SerializedPropertyType.Vector2, "vector2Value" }, 394 | { SerializedPropertyType.Vector3, "vector3Value" }, 395 | { SerializedPropertyType.Vector4, "vector4Value" }, 396 | { SerializedPropertyType.Rect, "rectValue" }, 397 | { SerializedPropertyType.ArraySize, "intValue" }, 398 | { SerializedPropertyType.Character, "intValue" }, 399 | { SerializedPropertyType.AnimationCurve, "animationCurveValue" }, 400 | { SerializedPropertyType.Bounds, "boundsValue" }, 401 | { SerializedPropertyType.Quaternion, "quaternionValue" }, 402 | }; 403 | Type serializedPropertyType = typeof(SerializedProperty); 404 | 405 | s_serializedPropertyValueAccessorsDict = new Dictionary(); 406 | BindingFlags flags = BindingFlags.Instance | BindingFlags.Public; 407 | 408 | foreach(var kvp in serializedPropertyValueAccessorsNameDict) 409 | { 410 | PropertyInfo propertyInfo = serializedPropertyType.GetProperty(kvp.Value, flags); 411 | s_serializedPropertyValueAccessorsDict.Add(kvp.Key, propertyInfo); 412 | } 413 | } 414 | 415 | static GUIContent IconContent(string name, string tooltip) 416 | { 417 | var builtinIcon = EditorGUIUtility.IconContent (name); 418 | return new GUIContent(builtinIcon.image, tooltip); 419 | } 420 | 421 | static GUIContent TempContent(string text) 422 | { 423 | s_tempContent.text = text; 424 | return s_tempContent; 425 | } 426 | 427 | static void DeleteArrayElementAtIndex(SerializedProperty arrayProperty, int index) 428 | { 429 | var property = arrayProperty.GetArrayElementAtIndex(index); 430 | // if(arrayProperty.arrayElementType.StartsWith("PPtr<$")) 431 | if(property.propertyType == SerializedPropertyType.ObjectReference) 432 | { 433 | property.objectReferenceValue = null; 434 | } 435 | 436 | arrayProperty.DeleteArrayElementAtIndex(index); 437 | } 438 | 439 | public static object GetPropertyValue(SerializedProperty p) 440 | { 441 | PropertyInfo propertyInfo; 442 | if(s_serializedPropertyValueAccessorsDict.TryGetValue(p.propertyType, out propertyInfo)) 443 | { 444 | return propertyInfo.GetValue(p, null); 445 | } 446 | else 447 | { 448 | if(p.isArray) 449 | return GetPropertyValueArray(p); 450 | else 451 | return GetPropertyValueGeneric(p); 452 | } 453 | } 454 | 455 | static void SetPropertyValue(SerializedProperty p, object v) 456 | { 457 | PropertyInfo propertyInfo; 458 | if(s_serializedPropertyValueAccessorsDict.TryGetValue(p.propertyType, out propertyInfo)) 459 | { 460 | propertyInfo.SetValue(p, v, null); 461 | } 462 | else 463 | { 464 | if(p.isArray) 465 | SetPropertyValueArray(p, v); 466 | else 467 | SetPropertyValueGeneric(p, v); 468 | } 469 | } 470 | 471 | static object GetPropertyValueArray(SerializedProperty property) 472 | { 473 | object[] array = new object[property.arraySize]; 474 | for(int i = 0; i < property.arraySize; i++) 475 | { 476 | SerializedProperty item = property.GetArrayElementAtIndex(i); 477 | array[i] = GetPropertyValue(item); 478 | } 479 | return array; 480 | } 481 | 482 | static object GetPropertyValueGeneric(SerializedProperty property) 483 | { 484 | Dictionary dict = new Dictionary(); 485 | var iterator = property.Copy(); 486 | if(iterator.Next(true)) 487 | { 488 | var end = property.GetEndProperty(); 489 | do 490 | { 491 | string name = iterator.name; 492 | object value = GetPropertyValue(iterator); 493 | dict.Add(name, value); 494 | } while(iterator.Next(false) && iterator.propertyPath != end.propertyPath); 495 | } 496 | return dict; 497 | } 498 | 499 | static void SetPropertyValueArray(SerializedProperty property, object v) 500 | { 501 | object[] array = (object[]) v; 502 | property.arraySize = array.Length; 503 | for(int i = 0; i < property.arraySize; i++) 504 | { 505 | SerializedProperty item = property.GetArrayElementAtIndex(i); 506 | SetPropertyValue(item, array[i]); 507 | } 508 | } 509 | 510 | static void SetPropertyValueGeneric(SerializedProperty property, object v) 511 | { 512 | Dictionary dict = (Dictionary) v; 513 | var iterator = property.Copy(); 514 | if(iterator.Next(true)) 515 | { 516 | var end = property.GetEndProperty(); 517 | do 518 | { 519 | string name = iterator.name; 520 | SetPropertyValue(iterator, dict[name]); 521 | } while(iterator.Next(false) && iterator.propertyPath != end.propertyPath); 522 | } 523 | } 524 | 525 | static bool ComparePropertyValues(object value1, object value2) 526 | { 527 | if(value1 is Dictionary && value2 is Dictionary) 528 | { 529 | var dict1 = (Dictionary)value1; 530 | var dict2 = (Dictionary)value2; 531 | return CompareDictionaries(dict1, dict2); 532 | } 533 | else 534 | { 535 | return object.Equals(value1, value2); 536 | } 537 | } 538 | 539 | static bool CompareDictionaries(Dictionary dict1, Dictionary dict2) 540 | { 541 | if(dict1.Count != dict2.Count) 542 | return false; 543 | 544 | foreach(var kvp1 in dict1) 545 | { 546 | var key1 = kvp1.Key; 547 | object value1 = kvp1.Value; 548 | 549 | object value2; 550 | if(!dict2.TryGetValue(key1, out value2)) 551 | return false; 552 | 553 | if(!ComparePropertyValues(value1, value2)) 554 | return false; 555 | } 556 | 557 | return true; 558 | } 559 | 560 | struct EnumerationEntry 561 | { 562 | public SerializedProperty keyProperty; 563 | public SerializedProperty valueProperty; 564 | public int index; 565 | 566 | public EnumerationEntry(SerializedProperty keyProperty, SerializedProperty valueProperty, int index) 567 | { 568 | this.keyProperty = keyProperty; 569 | this.valueProperty = valueProperty; 570 | this.index = index; 571 | } 572 | } 573 | 574 | static IEnumerable EnumerateEntries(SerializedProperty keyArrayProperty, SerializedProperty valueArrayProperty, int startIndex = 0) 575 | { 576 | if(keyArrayProperty.arraySize > startIndex) 577 | { 578 | int index = startIndex; 579 | var keyProperty = keyArrayProperty.GetArrayElementAtIndex(startIndex); 580 | var valueProperty = valueArrayProperty != null ? valueArrayProperty.GetArrayElementAtIndex(startIndex) : null; 581 | var endProperty = keyArrayProperty.GetEndProperty(); 582 | 583 | do 584 | { 585 | yield return new EnumerationEntry(keyProperty, valueProperty, index); 586 | index++; 587 | } while(keyProperty.Next(false) 588 | && (valueProperty != null ? valueProperty.Next(false) : true) 589 | && !SerializedProperty.EqualContents(keyProperty, endProperty)); 590 | } 591 | } 592 | } 593 | 594 | [CustomPropertyDrawer(typeof(SerializableDictionaryBase.Storage), true)] 595 | public class SerializableDictionaryStoragePropertyDrawer : PropertyDrawer 596 | { 597 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 598 | { 599 | property.Next(true); 600 | EditorGUI.PropertyField(position, property, label, true); 601 | } 602 | 603 | public override float GetPropertyHeight(SerializedProperty property, GUIContent label) 604 | { 605 | property.Next(true); 606 | return EditorGUI.GetPropertyHeight(property); 607 | } 608 | } 609 | -------------------------------------------------------------------------------- /Assets/SerializableDictionary/Editor/SerializableDictionaryPropertyDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 91da51d02ab9ebc459d80d5965d40d19 3 | timeCreated: 1492869349 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/SerializableDictionary/Example.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ea574807be3814126807ca7b22d13988 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/SerializableDictionary/Example/SerializableDicitonary Example.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 8 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} 24 | m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} 25 | m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 3 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} 42 | --- !u!157 &4 43 | LightmapSettings: 44 | m_ObjectHideFlags: 0 45 | serializedVersion: 11 46 | m_GIWorkflowMode: 1 47 | m_GISettings: 48 | serializedVersion: 2 49 | m_BounceScale: 1 50 | m_IndirectOutputScale: 1 51 | m_AlbedoBoost: 1 52 | m_TemporalCoherenceThreshold: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 9 58 | m_Resolution: 1 59 | m_BakeResolution: 50 60 | m_TextureWidth: 1024 61 | m_TextureHeight: 1024 62 | m_AO: 1 63 | m_AOMaxDistance: 1 64 | m_CompAOExponent: 1 65 | m_CompAOExponentDirect: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 0 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 1 75 | m_BakeBackend: 0 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVRFilterTypeDirect: 0 81 | m_PVRFilterTypeIndirect: 0 82 | m_PVRFilterTypeAO: 0 83 | m_PVRFilteringMode: 0 84 | m_PVRCulling: 1 85 | m_PVRFilteringGaussRadiusDirect: 1 86 | m_PVRFilteringGaussRadiusIndirect: 5 87 | m_PVRFilteringGaussRadiusAO: 2 88 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 89 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 90 | m_PVRFilteringAtrousPositionSigmaAO: 1 91 | m_ShowResolutionOverlay: 1 92 | m_LightingDataAsset: {fileID: 0} 93 | m_UseShadowmask: 0 94 | --- !u!196 &5 95 | NavMeshSettings: 96 | serializedVersion: 2 97 | m_ObjectHideFlags: 0 98 | m_BuildSettings: 99 | serializedVersion: 2 100 | agentTypeID: 0 101 | agentRadius: 0.5 102 | agentHeight: 2 103 | agentSlope: 45 104 | agentClimb: 0.4 105 | ledgeDropHeight: 0 106 | maxJumpAcrossDistance: 0 107 | minRegionArea: 2 108 | manualCellSize: 0 109 | cellSize: 0.16666666 110 | manualTileSize: 0 111 | tileSize: 256 112 | accuratePlacement: 0 113 | debug: 114 | m_Flags: 0 115 | m_NavMeshData: {fileID: 0} 116 | --- !u!1 &714127983 117 | GameObject: 118 | m_ObjectHideFlags: 0 119 | m_PrefabParentObject: {fileID: 0} 120 | m_PrefabInternal: {fileID: 0} 121 | serializedVersion: 5 122 | m_Component: 123 | - component: {fileID: 714127989} 124 | - component: {fileID: 714127988} 125 | - component: {fileID: 714127987} 126 | - component: {fileID: 714127986} 127 | - component: {fileID: 714127985} 128 | - component: {fileID: 714127984} 129 | m_Layer: 0 130 | m_Name: Main Camera 131 | m_TagString: MainCamera 132 | m_Icon: {fileID: 0} 133 | m_NavMeshLayer: 0 134 | m_StaticEditorFlags: 0 135 | m_IsActive: 1 136 | --- !u!114 &714127984 137 | MonoBehaviour: 138 | m_ObjectHideFlags: 0 139 | m_PrefabParentObject: {fileID: 0} 140 | m_PrefabInternal: {fileID: 0} 141 | m_GameObject: {fileID: 714127983} 142 | m_Enabled: 1 143 | m_EditorHideFlags: 0 144 | m_Script: {fileID: 11500000, guid: d5ff00a74ccb984498070d9930a7944c, type: 3} 145 | m_Name: 146 | m_EditorClassIdentifier: 147 | m_stringStringDictionary: 148 | m_keys: 149 | - first key 150 | - second key 151 | - third key 152 | m_values: 153 | - value A 154 | - value B 155 | - value C 156 | m_objectColorDictionary: 157 | m_keys: 158 | - {fileID: 714127983} 159 | - {fileID: 714127984} 160 | m_values: 161 | - {r: 0, g: 0, b: 1, a: 1} 162 | - {r: 1, g: 0, b: 0, a: 1} 163 | m_stringColorArrayDictionary: 164 | m_keys: 165 | - rainbow 166 | - grayscale 167 | m_values: 168 | - data: 169 | - {r: 1, g: 0, b: 0, a: 1} 170 | - {r: 1, g: 0.40000004, b: 0, a: 1} 171 | - {r: 1, g: 0.9333334, b: 0, a: 1} 172 | - {r: 0, g: 1, b: 0, a: 1} 173 | - {r: 0, g: 0.6, b: 1, a: 1} 174 | - {r: 0.26666668, g: 0, b: 1, a: 1} 175 | - {r: 0.6, g: 0, b: 1, a: 1} 176 | - data: 177 | - {r: 0, g: 0, b: 0, a: 0} 178 | - {r: 0.2509804, g: 0.2509804, b: 0.2509804, a: 0.2509804} 179 | - {r: 0.5019608, g: 0.5019608, b: 0.5019608, a: 0.5019608} 180 | - {r: 0.7529412, g: 0.7529412, b: 0.7529412, a: 0.7529412} 181 | - {r: 1, g: 1, b: 1, a: 1} 182 | m_stringHashSet: 183 | m_keys: 184 | - item 1 185 | - item 2 186 | - item 3 187 | --- !u!81 &714127985 188 | AudioListener: 189 | m_ObjectHideFlags: 0 190 | m_PrefabParentObject: {fileID: 0} 191 | m_PrefabInternal: {fileID: 0} 192 | m_GameObject: {fileID: 714127983} 193 | m_Enabled: 1 194 | --- !u!124 &714127986 195 | Behaviour: 196 | m_ObjectHideFlags: 0 197 | m_PrefabParentObject: {fileID: 0} 198 | m_PrefabInternal: {fileID: 0} 199 | m_GameObject: {fileID: 714127983} 200 | m_Enabled: 1 201 | --- !u!92 &714127987 202 | Behaviour: 203 | m_ObjectHideFlags: 0 204 | m_PrefabParentObject: {fileID: 0} 205 | m_PrefabInternal: {fileID: 0} 206 | m_GameObject: {fileID: 714127983} 207 | m_Enabled: 1 208 | --- !u!20 &714127988 209 | Camera: 210 | m_ObjectHideFlags: 0 211 | m_PrefabParentObject: {fileID: 0} 212 | m_PrefabInternal: {fileID: 0} 213 | m_GameObject: {fileID: 714127983} 214 | m_Enabled: 1 215 | serializedVersion: 2 216 | m_ClearFlags: 1 217 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844} 218 | m_NormalizedViewPortRect: 219 | serializedVersion: 2 220 | x: 0 221 | y: 0 222 | width: 1 223 | height: 1 224 | near clip plane: 0.3 225 | far clip plane: 1000 226 | field of view: 60 227 | orthographic: 0 228 | orthographic size: 5 229 | m_Depth: -1 230 | m_CullingMask: 231 | serializedVersion: 2 232 | m_Bits: 4294967295 233 | m_RenderingPath: -1 234 | m_TargetTexture: {fileID: 0} 235 | m_TargetDisplay: 0 236 | m_TargetEye: 3 237 | m_HDR: 0 238 | m_AllowMSAA: 1 239 | m_AllowDynamicResolution: 0 240 | m_ForceIntoRT: 0 241 | m_OcclusionCulling: 1 242 | m_StereoConvergence: 10 243 | m_StereoSeparation: 0.022 244 | --- !u!4 &714127989 245 | Transform: 246 | m_ObjectHideFlags: 0 247 | m_PrefabParentObject: {fileID: 0} 248 | m_PrefabInternal: {fileID: 0} 249 | m_GameObject: {fileID: 714127983} 250 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 251 | m_LocalPosition: {x: 0, y: 1, z: -10} 252 | m_LocalScale: {x: 1, y: 1, z: 1} 253 | m_Children: [] 254 | m_Father: {fileID: 0} 255 | m_RootOrder: 0 256 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 257 | -------------------------------------------------------------------------------- /Assets/SerializableDictionary/Example/SerializableDicitonary Example.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6c0758ade4ba74b7493ce3806fa2f38b 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/SerializableDictionary/Example/SerializableDictionaryExample.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class SerializableDictionaryExample : MonoBehaviour { 6 | // The dictionaries can be accessed throught a property 7 | [SerializeField] 8 | StringStringDictionary m_stringStringDictionary = null; 9 | public IDictionary StringStringDictionary 10 | { 11 | get { return m_stringStringDictionary; } 12 | set { m_stringStringDictionary.CopyFrom (value); } 13 | } 14 | 15 | public ObjectColorDictionary m_objectColorDictionary; 16 | public StringColorArrayDictionary m_stringColorArrayDictionary; 17 | #if NET_4_6 || NET_STANDARD_2_0 18 | public StringHashSet m_stringHashSet; 19 | #endif 20 | 21 | void Reset () 22 | { 23 | // access by property 24 | StringStringDictionary = new Dictionary() { {"first key", "value A"}, {"second key", "value B"}, {"third key", "value C"} }; 25 | m_objectColorDictionary = new ObjectColorDictionary() { {gameObject, Color.blue}, {this, Color.red} }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Assets/SerializableDictionary/Example/SerializableDictionaryExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d5ff00a74ccb984498070d9930a7944c 3 | timeCreated: 1492868873 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/SerializableDictionary/Example/UserSerializableDictionaries.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System; 4 | using UnityEngine; 5 | 6 | [Serializable] 7 | public class StringStringDictionary : SerializableDictionary {} 8 | 9 | [Serializable] 10 | public class ObjectColorDictionary : SerializableDictionary {} 11 | 12 | [Serializable] 13 | public class ColorArrayStorage : SerializableDictionary.Storage {} 14 | 15 | [Serializable] 16 | public class StringColorArrayDictionary : SerializableDictionary {} 17 | 18 | [Serializable] 19 | public class MyClass 20 | { 21 | public int i; 22 | public string str; 23 | } 24 | 25 | [Serializable] 26 | public class QuaternionMyClassDictionary : SerializableDictionary {} 27 | 28 | #if NET_4_6 || NET_STANDARD_2_0 29 | [Serializable] 30 | public class StringHashSet : SerializableHashSet {} 31 | #endif 32 | -------------------------------------------------------------------------------- /Assets/SerializableDictionary/Example/UserSerializableDictionaries.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd910530dd8f6b5429c65a494644ed09 3 | timeCreated: 1493639913 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/SerializableDictionary/SerializableDictionary.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | using UnityEngine; 6 | 7 | public abstract class SerializableDictionaryBase 8 | { 9 | public abstract class Storage {} 10 | 11 | protected class Dictionary : System.Collections.Generic.Dictionary 12 | { 13 | public Dictionary() {} 14 | public Dictionary(IDictionary dict) : base(dict) {} 15 | public Dictionary(SerializationInfo info, StreamingContext context) : base(info, context) {} 16 | } 17 | } 18 | 19 | [Serializable] 20 | public abstract class SerializableDictionaryBase : SerializableDictionaryBase, IDictionary, IDictionary, ISerializationCallbackReceiver, IDeserializationCallback, ISerializable 21 | { 22 | Dictionary m_dict; 23 | [SerializeField] 24 | TKey[] m_keys; 25 | [SerializeField] 26 | TValueStorage[] m_values; 27 | 28 | public SerializableDictionaryBase() 29 | { 30 | m_dict = new Dictionary(); 31 | } 32 | 33 | public SerializableDictionaryBase(IDictionary dict) 34 | { 35 | m_dict = new Dictionary(dict); 36 | } 37 | 38 | protected abstract void SetValue(TValueStorage[] storage, int i, TValue value); 39 | protected abstract TValue GetValue(TValueStorage[] storage, int i); 40 | 41 | public void CopyFrom(IDictionary dict) 42 | { 43 | m_dict.Clear(); 44 | foreach (var kvp in dict) 45 | { 46 | m_dict[kvp.Key] = kvp.Value; 47 | } 48 | } 49 | 50 | public void OnAfterDeserialize() 51 | { 52 | if(m_keys != null && m_values != null && m_keys.Length == m_values.Length) 53 | { 54 | m_dict.Clear(); 55 | int n = m_keys.Length; 56 | for(int i = 0; i < n; ++i) 57 | { 58 | m_dict[m_keys[i]] = GetValue(m_values, i); 59 | } 60 | 61 | m_keys = null; 62 | m_values = null; 63 | } 64 | } 65 | 66 | public void OnBeforeSerialize() 67 | { 68 | int n = m_dict.Count; 69 | m_keys = new TKey[n]; 70 | m_values = new TValueStorage[n]; 71 | 72 | int i = 0; 73 | foreach(var kvp in m_dict) 74 | { 75 | m_keys[i] = kvp.Key; 76 | SetValue(m_values, i, kvp.Value); 77 | ++i; 78 | } 79 | } 80 | 81 | #region IDictionary 82 | 83 | public ICollection Keys { get { return ((IDictionary)m_dict).Keys; } } 84 | public ICollection Values { get { return ((IDictionary)m_dict).Values; } } 85 | public int Count { get { return ((IDictionary)m_dict).Count; } } 86 | public bool IsReadOnly { get { return ((IDictionary)m_dict).IsReadOnly; } } 87 | 88 | public TValue this[TKey key] 89 | { 90 | get { return ((IDictionary)m_dict)[key]; } 91 | set { ((IDictionary)m_dict)[key] = value; } 92 | } 93 | 94 | public void Add(TKey key, TValue value) 95 | { 96 | ((IDictionary)m_dict).Add(key, value); 97 | } 98 | 99 | public bool ContainsKey(TKey key) 100 | { 101 | return ((IDictionary)m_dict).ContainsKey(key); 102 | } 103 | 104 | public bool Remove(TKey key) 105 | { 106 | return ((IDictionary)m_dict).Remove(key); 107 | } 108 | 109 | public bool TryGetValue(TKey key, out TValue value) 110 | { 111 | return ((IDictionary)m_dict).TryGetValue(key, out value); 112 | } 113 | 114 | public void Add(KeyValuePair item) 115 | { 116 | ((IDictionary)m_dict).Add(item); 117 | } 118 | 119 | public void Clear() 120 | { 121 | ((IDictionary)m_dict).Clear(); 122 | } 123 | 124 | public bool Contains(KeyValuePair item) 125 | { 126 | return ((IDictionary)m_dict).Contains(item); 127 | } 128 | 129 | public void CopyTo(KeyValuePair[] array, int arrayIndex) 130 | { 131 | ((IDictionary)m_dict).CopyTo(array, arrayIndex); 132 | } 133 | 134 | public bool Remove(KeyValuePair item) 135 | { 136 | return ((IDictionary)m_dict).Remove(item); 137 | } 138 | 139 | public IEnumerator> GetEnumerator() 140 | { 141 | return ((IDictionary)m_dict).GetEnumerator(); 142 | } 143 | 144 | IEnumerator IEnumerable.GetEnumerator() 145 | { 146 | return ((IDictionary)m_dict).GetEnumerator(); 147 | } 148 | 149 | #endregion 150 | 151 | #region IDictionary 152 | 153 | public bool IsFixedSize { get { return ((IDictionary)m_dict).IsFixedSize; } } 154 | ICollection IDictionary.Keys { get { return ((IDictionary)m_dict).Keys; } } 155 | ICollection IDictionary.Values { get { return ((IDictionary)m_dict).Values; } } 156 | public bool IsSynchronized { get { return ((IDictionary)m_dict).IsSynchronized; } } 157 | public object SyncRoot { get { return ((IDictionary)m_dict).SyncRoot; } } 158 | 159 | public object this[object key] 160 | { 161 | get { return ((IDictionary)m_dict)[key]; } 162 | set { ((IDictionary)m_dict)[key] = value; } 163 | } 164 | 165 | public void Add(object key, object value) 166 | { 167 | ((IDictionary)m_dict).Add(key, value); 168 | } 169 | 170 | public bool Contains(object key) 171 | { 172 | return ((IDictionary)m_dict).Contains(key); 173 | } 174 | 175 | IDictionaryEnumerator IDictionary.GetEnumerator() 176 | { 177 | return ((IDictionary)m_dict).GetEnumerator(); 178 | } 179 | 180 | public void Remove(object key) 181 | { 182 | ((IDictionary)m_dict).Remove(key); 183 | } 184 | 185 | public void CopyTo(Array array, int index) 186 | { 187 | ((IDictionary)m_dict).CopyTo(array, index); 188 | } 189 | 190 | #endregion 191 | 192 | #region IDeserializationCallback 193 | 194 | public void OnDeserialization(object sender) 195 | { 196 | ((IDeserializationCallback)m_dict).OnDeserialization(sender); 197 | } 198 | 199 | #endregion 200 | 201 | #region ISerializable 202 | 203 | protected SerializableDictionaryBase(SerializationInfo info, StreamingContext context) 204 | { 205 | m_dict = new Dictionary(info, context); 206 | } 207 | 208 | public void GetObjectData(SerializationInfo info, StreamingContext context) 209 | { 210 | ((ISerializable)m_dict).GetObjectData(info, context); 211 | } 212 | 213 | #endregion 214 | } 215 | 216 | public static class SerializableDictionary 217 | { 218 | public class Storage : SerializableDictionaryBase.Storage 219 | { 220 | public T data; 221 | } 222 | } 223 | 224 | [Serializable] 225 | public class SerializableDictionary : SerializableDictionaryBase 226 | { 227 | public SerializableDictionary() {} 228 | public SerializableDictionary(IDictionary dict) : base(dict) {} 229 | protected SerializableDictionary(SerializationInfo info, StreamingContext context) : base(info, context) {} 230 | 231 | protected override TValue GetValue(TValue[] storage, int i) 232 | { 233 | return storage[i]; 234 | } 235 | 236 | protected override void SetValue(TValue[] storage, int i, TValue value) 237 | { 238 | storage[i] = value; 239 | } 240 | } 241 | 242 | [Serializable] 243 | public class SerializableDictionary : SerializableDictionaryBase where TValueStorage : SerializableDictionary.Storage, new() 244 | { 245 | public SerializableDictionary() {} 246 | public SerializableDictionary(IDictionary dict) : base(dict) {} 247 | protected SerializableDictionary(SerializationInfo info, StreamingContext context) : base(info, context) {} 248 | 249 | protected override TValue GetValue(TValueStorage[] storage, int i) 250 | { 251 | return storage[i].data; 252 | } 253 | 254 | protected override void SetValue(TValueStorage[] storage, int i, TValue value) 255 | { 256 | storage[i] = new TValueStorage(); 257 | storage[i].data = value; 258 | } 259 | } 260 | -------------------------------------------------------------------------------- /Assets/SerializableDictionary/SerializableDictionary.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e7be1c9624387604fba4005ccf7dbd5a 3 | timeCreated: 1492868176 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/SerializableDictionary/SerializableDictionary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azixMcAze/Unity-SerializableDictionary/b4b39588d8744b69a3a53246cdc20b3ba92ec7ba/Assets/SerializableDictionary/SerializableDictionary.pdf -------------------------------------------------------------------------------- /Assets/SerializableDictionary/SerializableDictionary.pdf.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8eb73a56b3a6ee64ab2c30cac8878d8f 3 | timeCreated: 1492869030 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/SerializableDictionary/SerializableHashSet.cs: -------------------------------------------------------------------------------- 1 | #if NET_4_6 || NET_STANDARD_2_0 2 | using System; 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | using System.Runtime.Serialization; 6 | using UnityEngine; 7 | 8 | public abstract class SerializableHashSetBase 9 | { 10 | public abstract class Storage {} 11 | 12 | protected class HashSet : System.Collections.Generic.HashSet 13 | { 14 | public HashSet() {} 15 | public HashSet(ISet set) : base(set) {} 16 | public HashSet(SerializationInfo info, StreamingContext context) : base(info, context) {} 17 | } 18 | } 19 | 20 | [Serializable] 21 | public abstract class SerializableHashSet : SerializableHashSetBase, ISet, ISerializationCallbackReceiver, IDeserializationCallback, ISerializable 22 | { 23 | HashSet m_hashSet; 24 | [SerializeField] 25 | T[] m_keys; 26 | 27 | public SerializableHashSet() 28 | { 29 | m_hashSet = new HashSet(); 30 | } 31 | 32 | public SerializableHashSet(ISet set) 33 | { 34 | m_hashSet = new HashSet(set); 35 | } 36 | 37 | public void CopyFrom(ISet set) 38 | { 39 | m_hashSet.Clear(); 40 | foreach (var value in set) 41 | { 42 | m_hashSet.Add(value); 43 | } 44 | } 45 | 46 | public void OnAfterDeserialize() 47 | { 48 | if(m_keys != null) 49 | { 50 | m_hashSet.Clear(); 51 | int n = m_keys.Length; 52 | for(int i = 0; i < n; ++i) 53 | { 54 | m_hashSet.Add(m_keys[i]); 55 | } 56 | 57 | m_keys = null; 58 | } 59 | } 60 | 61 | public void OnBeforeSerialize() 62 | { 63 | int n = m_hashSet.Count; 64 | m_keys = new T[n]; 65 | 66 | int i = 0; 67 | foreach(var value in m_hashSet) 68 | { 69 | m_keys[i] = value; 70 | ++i; 71 | } 72 | } 73 | 74 | #region ISet 75 | 76 | public int Count { get { return ((ISet)m_hashSet).Count; } } 77 | public bool IsReadOnly { get { return ((ISet)m_hashSet).IsReadOnly; } } 78 | 79 | public bool Add(T item) 80 | { 81 | return ((ISet)m_hashSet).Add(item); 82 | } 83 | 84 | public void ExceptWith(IEnumerable other) 85 | { 86 | ((ISet)m_hashSet).ExceptWith(other); 87 | } 88 | 89 | public void IntersectWith(IEnumerable other) 90 | { 91 | ((ISet)m_hashSet).IntersectWith(other); 92 | } 93 | 94 | public bool IsProperSubsetOf(IEnumerable other) 95 | { 96 | return ((ISet)m_hashSet).IsProperSubsetOf(other); 97 | } 98 | 99 | public bool IsProperSupersetOf(IEnumerable other) 100 | { 101 | return ((ISet)m_hashSet).IsProperSupersetOf(other); 102 | } 103 | 104 | public bool IsSubsetOf(IEnumerable other) 105 | { 106 | return ((ISet)m_hashSet).IsSubsetOf(other); 107 | } 108 | 109 | public bool IsSupersetOf(IEnumerable other) 110 | { 111 | return ((ISet)m_hashSet).IsSupersetOf(other); 112 | } 113 | 114 | public bool Overlaps(IEnumerable other) 115 | { 116 | return ((ISet)m_hashSet).Overlaps(other); 117 | } 118 | 119 | public bool SetEquals(IEnumerable other) 120 | { 121 | return ((ISet)m_hashSet).SetEquals(other); 122 | } 123 | 124 | public void SymmetricExceptWith(IEnumerable other) 125 | { 126 | ((ISet)m_hashSet).SymmetricExceptWith(other); 127 | } 128 | 129 | public void UnionWith(IEnumerable other) 130 | { 131 | ((ISet)m_hashSet).UnionWith(other); 132 | } 133 | 134 | void ICollection.Add(T item) 135 | { 136 | ((ISet)m_hashSet).Add(item); 137 | } 138 | 139 | public void Clear() 140 | { 141 | ((ISet)m_hashSet).Clear(); 142 | } 143 | 144 | public bool Contains(T item) 145 | { 146 | return ((ISet)m_hashSet).Contains(item); 147 | } 148 | 149 | public void CopyTo(T[] array, int arrayIndex) 150 | { 151 | ((ISet)m_hashSet).CopyTo(array, arrayIndex); 152 | } 153 | 154 | public bool Remove(T item) 155 | { 156 | return ((ISet)m_hashSet).Remove(item); 157 | } 158 | 159 | public IEnumerator GetEnumerator() 160 | { 161 | return ((ISet)m_hashSet).GetEnumerator(); 162 | } 163 | 164 | IEnumerator IEnumerable.GetEnumerator() 165 | { 166 | return ((ISet)m_hashSet).GetEnumerator(); 167 | } 168 | 169 | #endregion 170 | 171 | #region IDeserializationCallback 172 | 173 | public void OnDeserialization(object sender) 174 | { 175 | ((IDeserializationCallback)m_hashSet).OnDeserialization(sender); 176 | } 177 | 178 | #endregion 179 | 180 | #region ISerializable 181 | 182 | protected SerializableHashSet(SerializationInfo info, StreamingContext context) 183 | { 184 | m_hashSet = new HashSet(info, context); 185 | } 186 | 187 | public void GetObjectData(SerializationInfo info, StreamingContext context) 188 | { 189 | ((ISerializable)m_hashSet).GetObjectData(info, context); 190 | } 191 | 192 | #endregion 193 | } 194 | #endif -------------------------------------------------------------------------------- /Assets/SerializableDictionary/SerializableHashSet.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2c5ea2742f9d6498493646c49cb0a3e7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Mathieu Le Ber 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 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.collab-proxy": "1.2.16", 4 | "com.unity.ide.rider": "1.1.4", 5 | "com.unity.ide.vscode": "1.2.3", 6 | "com.unity.test-framework": "1.1.24", 7 | "com.unity.textmeshpro": "2.1.4", 8 | "com.unity.timeline": "1.2.18", 9 | "com.unity.ugui": "1.0.0", 10 | "com.unity.modules.ai": "1.0.0", 11 | "com.unity.modules.androidjni": "1.0.0", 12 | "com.unity.modules.animation": "1.0.0", 13 | "com.unity.modules.assetbundle": "1.0.0", 14 | "com.unity.modules.audio": "1.0.0", 15 | "com.unity.modules.cloth": "1.0.0", 16 | "com.unity.modules.director": "1.0.0", 17 | "com.unity.modules.imageconversion": "1.0.0", 18 | "com.unity.modules.imgui": "1.0.0", 19 | "com.unity.modules.jsonserialize": "1.0.0", 20 | "com.unity.modules.particlesystem": "1.0.0", 21 | "com.unity.modules.physics": "1.0.0", 22 | "com.unity.modules.physics2d": "1.0.0", 23 | "com.unity.modules.screencapture": "1.0.0", 24 | "com.unity.modules.terrain": "1.0.0", 25 | "com.unity.modules.terrainphysics": "1.0.0", 26 | "com.unity.modules.tilemap": "1.0.0", 27 | "com.unity.modules.ui": "1.0.0", 28 | "com.unity.modules.uielements": "1.0.0", 29 | "com.unity.modules.umbra": "1.0.0", 30 | "com.unity.modules.unityanalytics": "1.0.0", 31 | "com.unity.modules.unitywebrequest": "1.0.0", 32 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 33 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 34 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 35 | "com.unity.modules.unitywebrequestwww": "1.0.0", 36 | "com.unity.modules.vehicles": "1.0.0", 37 | "com.unity.modules.video": "1.0.0", 38 | "com.unity.modules.vr": "1.0.0", 39 | "com.unity.modules.wind": "1.0.0", 40 | "com.unity.modules.xr": "1.0.0" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Packages/packages-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.collab-proxy": { 4 | "version": "1.2.16", 5 | "depth": 0, 6 | "source": "registry", 7 | "dependencies": {}, 8 | "url": "https://packages.unity.com" 9 | }, 10 | "com.unity.ext.nunit": { 11 | "version": "1.0.6", 12 | "depth": 1, 13 | "source": "registry", 14 | "dependencies": {}, 15 | "url": "https://packages.unity.com" 16 | }, 17 | "com.unity.ide.rider": { 18 | "version": "1.1.4", 19 | "depth": 0, 20 | "source": "registry", 21 | "dependencies": { 22 | "com.unity.test-framework": "1.1.1" 23 | }, 24 | "url": "https://packages.unity.com" 25 | }, 26 | "com.unity.ide.vscode": { 27 | "version": "1.2.3", 28 | "depth": 0, 29 | "source": "registry", 30 | "dependencies": {}, 31 | "url": "https://packages.unity.com" 32 | }, 33 | "com.unity.test-framework": { 34 | "version": "1.1.24", 35 | "depth": 0, 36 | "source": "registry", 37 | "dependencies": { 38 | "com.unity.ext.nunit": "1.0.6", 39 | "com.unity.modules.imgui": "1.0.0", 40 | "com.unity.modules.jsonserialize": "1.0.0" 41 | }, 42 | "url": "https://packages.unity.com" 43 | }, 44 | "com.unity.textmeshpro": { 45 | "version": "2.1.4", 46 | "depth": 0, 47 | "source": "registry", 48 | "dependencies": { 49 | "com.unity.ugui": "1.0.0" 50 | }, 51 | "url": "https://packages.unity.com" 52 | }, 53 | "com.unity.timeline": { 54 | "version": "1.2.18", 55 | "depth": 0, 56 | "source": "registry", 57 | "dependencies": { 58 | "com.unity.modules.director": "1.0.0", 59 | "com.unity.modules.animation": "1.0.0", 60 | "com.unity.modules.audio": "1.0.0", 61 | "com.unity.modules.particlesystem": "1.0.0" 62 | }, 63 | "url": "https://packages.unity.com" 64 | }, 65 | "com.unity.ugui": { 66 | "version": "1.0.0", 67 | "depth": 0, 68 | "source": "builtin", 69 | "dependencies": { 70 | "com.unity.modules.ui": "1.0.0", 71 | "com.unity.modules.imgui": "1.0.0" 72 | } 73 | }, 74 | "com.unity.modules.ai": { 75 | "version": "1.0.0", 76 | "depth": 0, 77 | "source": "builtin", 78 | "dependencies": {} 79 | }, 80 | "com.unity.modules.androidjni": { 81 | "version": "1.0.0", 82 | "depth": 0, 83 | "source": "builtin", 84 | "dependencies": {} 85 | }, 86 | "com.unity.modules.animation": { 87 | "version": "1.0.0", 88 | "depth": 0, 89 | "source": "builtin", 90 | "dependencies": {} 91 | }, 92 | "com.unity.modules.assetbundle": { 93 | "version": "1.0.0", 94 | "depth": 0, 95 | "source": "builtin", 96 | "dependencies": {} 97 | }, 98 | "com.unity.modules.audio": { 99 | "version": "1.0.0", 100 | "depth": 0, 101 | "source": "builtin", 102 | "dependencies": {} 103 | }, 104 | "com.unity.modules.cloth": { 105 | "version": "1.0.0", 106 | "depth": 0, 107 | "source": "builtin", 108 | "dependencies": { 109 | "com.unity.modules.physics": "1.0.0" 110 | } 111 | }, 112 | "com.unity.modules.director": { 113 | "version": "1.0.0", 114 | "depth": 0, 115 | "source": "builtin", 116 | "dependencies": { 117 | "com.unity.modules.audio": "1.0.0", 118 | "com.unity.modules.animation": "1.0.0" 119 | } 120 | }, 121 | "com.unity.modules.imageconversion": { 122 | "version": "1.0.0", 123 | "depth": 0, 124 | "source": "builtin", 125 | "dependencies": {} 126 | }, 127 | "com.unity.modules.imgui": { 128 | "version": "1.0.0", 129 | "depth": 0, 130 | "source": "builtin", 131 | "dependencies": {} 132 | }, 133 | "com.unity.modules.jsonserialize": { 134 | "version": "1.0.0", 135 | "depth": 0, 136 | "source": "builtin", 137 | "dependencies": {} 138 | }, 139 | "com.unity.modules.particlesystem": { 140 | "version": "1.0.0", 141 | "depth": 0, 142 | "source": "builtin", 143 | "dependencies": {} 144 | }, 145 | "com.unity.modules.physics": { 146 | "version": "1.0.0", 147 | "depth": 0, 148 | "source": "builtin", 149 | "dependencies": {} 150 | }, 151 | "com.unity.modules.physics2d": { 152 | "version": "1.0.0", 153 | "depth": 0, 154 | "source": "builtin", 155 | "dependencies": {} 156 | }, 157 | "com.unity.modules.screencapture": { 158 | "version": "1.0.0", 159 | "depth": 0, 160 | "source": "builtin", 161 | "dependencies": { 162 | "com.unity.modules.imageconversion": "1.0.0" 163 | } 164 | }, 165 | "com.unity.modules.subsystems": { 166 | "version": "1.0.0", 167 | "depth": 1, 168 | "source": "builtin", 169 | "dependencies": { 170 | "com.unity.modules.jsonserialize": "1.0.0" 171 | } 172 | }, 173 | "com.unity.modules.terrain": { 174 | "version": "1.0.0", 175 | "depth": 0, 176 | "source": "builtin", 177 | "dependencies": {} 178 | }, 179 | "com.unity.modules.terrainphysics": { 180 | "version": "1.0.0", 181 | "depth": 0, 182 | "source": "builtin", 183 | "dependencies": { 184 | "com.unity.modules.physics": "1.0.0", 185 | "com.unity.modules.terrain": "1.0.0" 186 | } 187 | }, 188 | "com.unity.modules.tilemap": { 189 | "version": "1.0.0", 190 | "depth": 0, 191 | "source": "builtin", 192 | "dependencies": { 193 | "com.unity.modules.physics2d": "1.0.0" 194 | } 195 | }, 196 | "com.unity.modules.ui": { 197 | "version": "1.0.0", 198 | "depth": 0, 199 | "source": "builtin", 200 | "dependencies": {} 201 | }, 202 | "com.unity.modules.uielements": { 203 | "version": "1.0.0", 204 | "depth": 0, 205 | "source": "builtin", 206 | "dependencies": { 207 | "com.unity.modules.imgui": "1.0.0", 208 | "com.unity.modules.jsonserialize": "1.0.0" 209 | } 210 | }, 211 | "com.unity.modules.umbra": { 212 | "version": "1.0.0", 213 | "depth": 0, 214 | "source": "builtin", 215 | "dependencies": {} 216 | }, 217 | "com.unity.modules.unityanalytics": { 218 | "version": "1.0.0", 219 | "depth": 0, 220 | "source": "builtin", 221 | "dependencies": { 222 | "com.unity.modules.unitywebrequest": "1.0.0", 223 | "com.unity.modules.jsonserialize": "1.0.0" 224 | } 225 | }, 226 | "com.unity.modules.unitywebrequest": { 227 | "version": "1.0.0", 228 | "depth": 0, 229 | "source": "builtin", 230 | "dependencies": {} 231 | }, 232 | "com.unity.modules.unitywebrequestassetbundle": { 233 | "version": "1.0.0", 234 | "depth": 0, 235 | "source": "builtin", 236 | "dependencies": { 237 | "com.unity.modules.assetbundle": "1.0.0", 238 | "com.unity.modules.unitywebrequest": "1.0.0" 239 | } 240 | }, 241 | "com.unity.modules.unitywebrequestaudio": { 242 | "version": "1.0.0", 243 | "depth": 0, 244 | "source": "builtin", 245 | "dependencies": { 246 | "com.unity.modules.unitywebrequest": "1.0.0", 247 | "com.unity.modules.audio": "1.0.0" 248 | } 249 | }, 250 | "com.unity.modules.unitywebrequesttexture": { 251 | "version": "1.0.0", 252 | "depth": 0, 253 | "source": "builtin", 254 | "dependencies": { 255 | "com.unity.modules.unitywebrequest": "1.0.0", 256 | "com.unity.modules.imageconversion": "1.0.0" 257 | } 258 | }, 259 | "com.unity.modules.unitywebrequestwww": { 260 | "version": "1.0.0", 261 | "depth": 0, 262 | "source": "builtin", 263 | "dependencies": { 264 | "com.unity.modules.unitywebrequest": "1.0.0", 265 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 266 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 267 | "com.unity.modules.audio": "1.0.0", 268 | "com.unity.modules.assetbundle": "1.0.0", 269 | "com.unity.modules.imageconversion": "1.0.0" 270 | } 271 | }, 272 | "com.unity.modules.vehicles": { 273 | "version": "1.0.0", 274 | "depth": 0, 275 | "source": "builtin", 276 | "dependencies": { 277 | "com.unity.modules.physics": "1.0.0" 278 | } 279 | }, 280 | "com.unity.modules.video": { 281 | "version": "1.0.0", 282 | "depth": 0, 283 | "source": "builtin", 284 | "dependencies": { 285 | "com.unity.modules.audio": "1.0.0", 286 | "com.unity.modules.ui": "1.0.0", 287 | "com.unity.modules.unitywebrequest": "1.0.0" 288 | } 289 | }, 290 | "com.unity.modules.vr": { 291 | "version": "1.0.0", 292 | "depth": 0, 293 | "source": "builtin", 294 | "dependencies": { 295 | "com.unity.modules.jsonserialize": "1.0.0", 296 | "com.unity.modules.physics": "1.0.0", 297 | "com.unity.modules.xr": "1.0.0" 298 | } 299 | }, 300 | "com.unity.modules.wind": { 301 | "version": "1.0.0", 302 | "depth": 0, 303 | "source": "builtin", 304 | "dependencies": {} 305 | }, 306 | "com.unity.modules.xr": { 307 | "version": "1.0.0", 308 | "depth": 0, 309 | "source": "builtin", 310 | "dependencies": { 311 | "com.unity.modules.physics": "1.0.0", 312 | "com.unity.modules.jsonserialize": "1.0.0", 313 | "com.unity.modules.subsystems": "1.0.0" 314 | } 315 | } 316 | } 317 | } 318 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 0 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_DisableAudio: 0 16 | m_VirtualizeEffects: 1 17 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_EnablePCM: 1 18 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 19 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: [] 8 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_DefaultBehaviorMode: 0 10 | m_SpritePackerMode: 0 11 | m_SpritePackerPaddingPower: 1 12 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 13 | m_ProjectGenerationRootNamespace: 14 | m_UserGeneratedProjectSuffix: 15 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | m_PreloadedShaders: [] 39 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 40 | type: 0} 41 | m_CustomRenderPipeline: {fileID: 0} 42 | m_TransparencySortMode: 0 43 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 44 | m_DefaultRenderingPath: 1 45 | m_DefaultMobileRenderingPath: 1 46 | m_TierSettings: [] 47 | m_LightmapStripping: 0 48 | m_FogStripping: 0 49 | m_InstancingStripping: 0 50 | m_LightmapKeepPlain: 1 51 | m_LightmapKeepDirCombined: 1 52 | m_LightmapKeepDynamicPlain: 1 53 | m_LightmapKeepDynamicDirCombined: 1 54 | m_LightmapKeepShadowMask: 1 55 | m_LightmapKeepSubtractive: 1 56 | m_FogKeepLinear: 1 57 | m_FogKeepExp: 1 58 | m_FogKeepExp2: 1 59 | m_AlbedoSwatchInfos: [] 60 | m_LightsUseLinearIntensity: 0 61 | m_LightsUseColorTemperature: 0 62 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | m_SettingNames: 89 | - Humanoid 90 | -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /ProjectSettings/PackageManagerSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_ScopedRegistriesSettingsExpanded: 1 16 | oneTimeWarningShown: 0 17 | m_Registries: 18 | - m_Id: main 19 | m_Name: 20 | m_Url: https://packages.unity.com 21 | m_Scopes: [] 22 | m_IsDefault: 1 23 | m_UserSelectedRegistryName: 24 | m_UserAddingNewScopedRegistry: 0 25 | m_RegistryInfoDraft: 26 | m_ErrorMessage: 27 | m_Original: 28 | m_Id: 29 | m_Name: 30 | m_Url: 31 | m_Scopes: [] 32 | m_IsDefault: 0 33 | m_Modified: 0 34 | m_Name: 35 | m_Url: 36 | m_Scopes: 37 | - 38 | m_SelectedScopeIndex: 0 39 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_QueriesHitTriggers: 1 23 | m_QueriesStartInColliders: 1 24 | m_ChangeStopsCallbacks: 0 25 | m_AlwaysShowColliders: 0 26 | m_ShowColliderSleep: 1 27 | m_ShowColliderContacts: 0 28 | m_ShowColliderAABB: 0 29 | m_ContactArrowScale: 0.2 30 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 31 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 32 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 33 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 34 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 35 | -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!129 &1 4 | PlayerSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 11 7 | productGUID: 1092555d98e4c124a887279e579cac48 8 | AndroidProfiler: 0 9 | defaultScreenOrientation: 4 10 | targetDevice: 2 11 | useOnDemandResources: 0 12 | accelerometerFrequency: 60 13 | companyName: DefaultCompany 14 | productName: Serializable Dictionary 15 | defaultCursor: {fileID: 0} 16 | cursorHotspot: {x: 0, y: 0} 17 | m_SplashScreenBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21176471, a: 1} 18 | m_ShowUnitySplashScreen: 1 19 | m_ShowUnitySplashLogo: 1 20 | m_SplashScreenOverlayOpacity: 1 21 | m_SplashScreenAnimation: 1 22 | m_SplashScreenLogoStyle: 1 23 | m_SplashScreenDrawMode: 0 24 | m_SplashScreenBackgroundAnimationZoom: 1 25 | m_SplashScreenLogoAnimationZoom: 1 26 | m_SplashScreenBackgroundLandscapeAspect: 1 27 | m_SplashScreenBackgroundPortraitAspect: 1 28 | m_SplashScreenBackgroundLandscapeUvs: 29 | serializedVersion: 2 30 | x: 0 31 | y: 0 32 | width: 1 33 | height: 1 34 | m_SplashScreenBackgroundPortraitUvs: 35 | serializedVersion: 2 36 | x: 0 37 | y: 0 38 | width: 1 39 | height: 1 40 | m_SplashScreenLogos: [] 41 | m_SplashScreenBackgroundLandscape: {fileID: 0} 42 | m_SplashScreenBackgroundPortrait: {fileID: 0} 43 | m_VirtualRealitySplashScreen: {fileID: 0} 44 | m_HolographicTrackingLossScreen: {fileID: 0} 45 | defaultScreenWidth: 1024 46 | defaultScreenHeight: 768 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_StereoRenderingPath: 0 50 | m_ActiveColorSpace: 0 51 | m_MTRendering: 1 52 | m_MobileMTRendering: 0 53 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 54 | iosShowActivityIndicatorOnLoading: -1 55 | androidShowActivityIndicatorOnLoading: -1 56 | tizenShowActivityIndicatorOnLoading: -1 57 | iosAppInBackgroundBehavior: 0 58 | displayResolutionDialog: 1 59 | iosAllowHTTPDownload: 1 60 | allowedAutorotateToPortrait: 1 61 | allowedAutorotateToPortraitUpsideDown: 1 62 | allowedAutorotateToLandscapeRight: 1 63 | allowedAutorotateToLandscapeLeft: 1 64 | useOSAutorotation: 1 65 | use32BitDisplayBuffer: 1 66 | disableDepthAndStencilBuffers: 0 67 | defaultIsFullScreen: 1 68 | defaultIsNativeResolution: 1 69 | runInBackground: 0 70 | captureSingleScreen: 0 71 | muteOtherAudioSources: 0 72 | Prepare IOS For Recording: 0 73 | submitAnalytics: 1 74 | usePlayerLog: 1 75 | bakeCollisionMeshes: 0 76 | forceSingleInstance: 0 77 | resizableWindow: 0 78 | useMacAppStoreValidation: 0 79 | gpuSkinning: 0 80 | graphicsJobs: 0 81 | xboxPIXTextureCapture: 0 82 | xboxEnableAvatar: 0 83 | xboxEnableKinect: 0 84 | xboxEnableKinectAutoTracking: 0 85 | xboxEnableFitness: 0 86 | visibleInBackground: 0 87 | allowFullscreenSwitch: 1 88 | graphicsJobMode: 0 89 | macFullscreenMode: 2 90 | d3d9FullscreenMode: 1 91 | d3d11FullscreenMode: 1 92 | xboxSpeechDB: 0 93 | xboxEnableHeadOrientation: 0 94 | xboxEnableGuest: 0 95 | xboxEnablePIXSampling: 0 96 | n3dsDisableStereoscopicView: 0 97 | n3dsEnableSharedListOpt: 1 98 | n3dsEnableVSync: 0 99 | ignoreAlphaClear: 0 100 | xboxOneResolution: 0 101 | xboxOneMonoLoggingLevel: 0 102 | xboxOneLoggingLevel: 1 103 | videoMemoryForVertexBuffers: 0 104 | psp2PowerMode: 0 105 | psp2AcquireBGM: 1 106 | wiiUTVResolution: 0 107 | wiiUGamePadMSAA: 1 108 | wiiUSupportsNunchuk: 0 109 | wiiUSupportsClassicController: 0 110 | wiiUSupportsBalanceBoard: 0 111 | wiiUSupportsMotionPlus: 0 112 | wiiUSupportsProController: 0 113 | wiiUAllowScreenCapture: 1 114 | wiiUControllerCount: 0 115 | m_SupportedAspectRatios: 116 | 4:3: 1 117 | 5:4: 1 118 | 16:10: 1 119 | 16:9: 1 120 | Others: 1 121 | bundleVersion: 1.0 122 | preloadedAssets: [] 123 | metroInputSource: 0 124 | m_HolographicPauseOnTrackingLoss: 1 125 | xboxOneDisableKinectGpuReservation: 0 126 | xboxOneEnable7thCore: 0 127 | vrSettings: 128 | cardboard: 129 | depthFormat: 0 130 | enableTransitionView: 0 131 | daydream: 132 | depthFormat: 0 133 | useSustainedPerformanceMode: 0 134 | hololens: 135 | depthFormat: 1 136 | protectGraphicsMemory: 0 137 | useHDRDisplay: 0 138 | applicationIdentifier: {} 139 | buildNumber: {} 140 | AndroidBundleVersionCode: 1 141 | AndroidMinSdkVersion: 16 142 | AndroidTargetSdkVersion: 0 143 | AndroidPreferredInstallLocation: 1 144 | aotOptions: 145 | stripEngineCode: 1 146 | iPhoneStrippingLevel: 0 147 | iPhoneScriptCallOptimization: 0 148 | ForceInternetPermission: 0 149 | ForceSDCardPermission: 0 150 | CreateWallpaper: 0 151 | APKExpansionFiles: 0 152 | keepLoadedShadersAlive: 0 153 | StripUnusedMeshComponents: 0 154 | VertexChannelCompressionMask: 155 | serializedVersion: 2 156 | m_Bits: 238 157 | iPhoneSdkVersion: 988 158 | iOSTargetOSVersionString: 159 | tvOSSdkVersion: 0 160 | tvOSRequireExtendedGameController: 0 161 | tvOSTargetOSVersionString: 162 | uIPrerenderedIcon: 0 163 | uIRequiresPersistentWiFi: 0 164 | uIRequiresFullScreen: 1 165 | uIStatusBarHidden: 1 166 | uIExitOnSuspend: 0 167 | uIStatusBarStyle: 0 168 | iPhoneSplashScreen: {fileID: 0} 169 | iPhoneHighResSplashScreen: {fileID: 0} 170 | iPhoneTallHighResSplashScreen: {fileID: 0} 171 | iPhone47inSplashScreen: {fileID: 0} 172 | iPhone55inPortraitSplashScreen: {fileID: 0} 173 | iPhone55inLandscapeSplashScreen: {fileID: 0} 174 | iPadPortraitSplashScreen: {fileID: 0} 175 | iPadHighResPortraitSplashScreen: {fileID: 0} 176 | iPadLandscapeSplashScreen: {fileID: 0} 177 | iPadHighResLandscapeSplashScreen: {fileID: 0} 178 | appleTVSplashScreen: {fileID: 0} 179 | tvOSSmallIconLayers: [] 180 | tvOSLargeIconLayers: [] 181 | tvOSTopShelfImageLayers: [] 182 | tvOSTopShelfImageWideLayers: [] 183 | iOSLaunchScreenType: 0 184 | iOSLaunchScreenPortrait: {fileID: 0} 185 | iOSLaunchScreenLandscape: {fileID: 0} 186 | iOSLaunchScreenBackgroundColor: 187 | serializedVersion: 2 188 | rgba: 0 189 | iOSLaunchScreenFillPct: 100 190 | iOSLaunchScreenSize: 100 191 | iOSLaunchScreenCustomXibPath: 192 | iOSLaunchScreeniPadType: 0 193 | iOSLaunchScreeniPadImage: {fileID: 0} 194 | iOSLaunchScreeniPadBackgroundColor: 195 | serializedVersion: 2 196 | rgba: 0 197 | iOSLaunchScreeniPadFillPct: 100 198 | iOSLaunchScreeniPadSize: 100 199 | iOSLaunchScreeniPadCustomXibPath: 200 | iOSDeviceRequirements: [] 201 | iOSURLSchemes: [] 202 | iOSBackgroundModes: 0 203 | iOSMetalForceHardShadows: 0 204 | metalEditorSupport: 1 205 | metalAPIValidation: 1 206 | appleDeveloperTeamID: 207 | iOSManualSigningProvisioningProfileID: 208 | tvOSManualSigningProvisioningProfileID: 209 | appleEnableAutomaticSigning: 0 210 | AndroidTargetDevice: 0 211 | AndroidSplashScreenScale: 0 212 | androidSplashScreen: {fileID: 0} 213 | AndroidKeystoreName: 214 | AndroidKeyaliasName: 215 | AndroidTVCompatibility: 1 216 | AndroidIsGame: 1 217 | androidEnableBanner: 1 218 | m_AndroidBanners: 219 | - width: 320 220 | height: 180 221 | banner: {fileID: 0} 222 | androidGamepadSupportLevel: 0 223 | resolutionDialogBanner: {fileID: 0} 224 | m_BuildTargetIcons: [] 225 | m_BuildTargetBatching: [] 226 | m_BuildTargetGraphicsAPIs: [] 227 | m_BuildTargetVRSettings: [] 228 | openGLRequireES31: 0 229 | openGLRequireES31AEP: 0 230 | webPlayerTemplate: APPLICATION:Default 231 | m_TemplateCustomTags: {} 232 | wiiUTitleID: 0005000011000000 233 | wiiUGroupID: 00010000 234 | wiiUCommonSaveSize: 4096 235 | wiiUAccountSaveSize: 2048 236 | wiiUOlvAccessKey: 0 237 | wiiUTinCode: 0 238 | wiiUJoinGameId: 0 239 | wiiUJoinGameModeMask: 0000000000000000 240 | wiiUCommonBossSize: 0 241 | wiiUAccountBossSize: 0 242 | wiiUAddOnUniqueIDs: [] 243 | wiiUMainThreadStackSize: 3072 244 | wiiULoaderThreadStackSize: 1024 245 | wiiUSystemHeapSize: 128 246 | wiiUTVStartupScreen: {fileID: 0} 247 | wiiUGamePadStartupScreen: {fileID: 0} 248 | wiiUDrcBufferDisabled: 0 249 | wiiUProfilerLibPath: 250 | actionOnDotNetUnhandledException: 1 251 | enableInternalProfiler: 0 252 | logObjCUncaughtExceptions: 1 253 | enableCrashReportAPI: 0 254 | cameraUsageDescription: 255 | locationUsageDescription: 256 | microphoneUsageDescription: 257 | switchNetLibKey: 258 | switchSocketMemoryPoolSize: 6144 259 | switchSocketAllocatorPoolSize: 128 260 | switchSocketConcurrencyLimit: 14 261 | switchUseCPUProfiler: 0 262 | switchApplicationID: 0x0005000C10000001 263 | switchNSODependencies: 264 | switchTitleNames_0: 265 | switchTitleNames_1: 266 | switchTitleNames_2: 267 | switchTitleNames_3: 268 | switchTitleNames_4: 269 | switchTitleNames_5: 270 | switchTitleNames_6: 271 | switchTitleNames_7: 272 | switchTitleNames_8: 273 | switchTitleNames_9: 274 | switchTitleNames_10: 275 | switchTitleNames_11: 276 | switchTitleNames_12: 277 | switchTitleNames_13: 278 | switchTitleNames_14: 279 | switchPublisherNames_0: 280 | switchPublisherNames_1: 281 | switchPublisherNames_2: 282 | switchPublisherNames_3: 283 | switchPublisherNames_4: 284 | switchPublisherNames_5: 285 | switchPublisherNames_6: 286 | switchPublisherNames_7: 287 | switchPublisherNames_8: 288 | switchPublisherNames_9: 289 | switchPublisherNames_10: 290 | switchPublisherNames_11: 291 | switchPublisherNames_12: 292 | switchPublisherNames_13: 293 | switchPublisherNames_14: 294 | switchIcons_0: {fileID: 0} 295 | switchIcons_1: {fileID: 0} 296 | switchIcons_2: {fileID: 0} 297 | switchIcons_3: {fileID: 0} 298 | switchIcons_4: {fileID: 0} 299 | switchIcons_5: {fileID: 0} 300 | switchIcons_6: {fileID: 0} 301 | switchIcons_7: {fileID: 0} 302 | switchIcons_8: {fileID: 0} 303 | switchIcons_9: {fileID: 0} 304 | switchIcons_10: {fileID: 0} 305 | switchIcons_11: {fileID: 0} 306 | switchIcons_12: {fileID: 0} 307 | switchIcons_13: {fileID: 0} 308 | switchIcons_14: {fileID: 0} 309 | switchSmallIcons_0: {fileID: 0} 310 | switchSmallIcons_1: {fileID: 0} 311 | switchSmallIcons_2: {fileID: 0} 312 | switchSmallIcons_3: {fileID: 0} 313 | switchSmallIcons_4: {fileID: 0} 314 | switchSmallIcons_5: {fileID: 0} 315 | switchSmallIcons_6: {fileID: 0} 316 | switchSmallIcons_7: {fileID: 0} 317 | switchSmallIcons_8: {fileID: 0} 318 | switchSmallIcons_9: {fileID: 0} 319 | switchSmallIcons_10: {fileID: 0} 320 | switchSmallIcons_11: {fileID: 0} 321 | switchSmallIcons_12: {fileID: 0} 322 | switchSmallIcons_13: {fileID: 0} 323 | switchSmallIcons_14: {fileID: 0} 324 | switchManualHTML: 325 | switchAccessibleURLs: 326 | switchLegalInformation: 327 | switchMainThreadStackSize: 1048576 328 | switchPresenceGroupId: 0x0005000C10000001 329 | switchLogoHandling: 0 330 | switchReleaseVersion: 0 331 | switchDisplayVersion: 1.0.0 332 | switchStartupUserAccount: 0 333 | switchTouchScreenUsage: 0 334 | switchSupportedLanguagesMask: 0 335 | switchLogoType: 0 336 | switchApplicationErrorCodeCategory: 337 | switchUserAccountSaveDataSize: 0 338 | switchUserAccountSaveDataJournalSize: 0 339 | switchAttribute: 0 340 | switchCardSpecSize: 4 341 | switchCardSpecClock: 25 342 | switchRatingsMask: 0 343 | switchRatingsInt_0: 0 344 | switchRatingsInt_1: 0 345 | switchRatingsInt_2: 0 346 | switchRatingsInt_3: 0 347 | switchRatingsInt_4: 0 348 | switchRatingsInt_5: 0 349 | switchRatingsInt_6: 0 350 | switchRatingsInt_7: 0 351 | switchRatingsInt_8: 0 352 | switchRatingsInt_9: 0 353 | switchRatingsInt_10: 0 354 | switchRatingsInt_11: 0 355 | switchLocalCommunicationIds_0: 0x0005000C10000001 356 | switchLocalCommunicationIds_1: 357 | switchLocalCommunicationIds_2: 358 | switchLocalCommunicationIds_3: 359 | switchLocalCommunicationIds_4: 360 | switchLocalCommunicationIds_5: 361 | switchLocalCommunicationIds_6: 362 | switchLocalCommunicationIds_7: 363 | switchParentalControl: 0 364 | switchAllowsScreenshot: 1 365 | switchDataLossConfirmation: 0 366 | ps4NPAgeRating: 12 367 | ps4NPTitleSecret: 368 | ps4NPTrophyPackPath: 369 | ps4ParentalLevel: 1 370 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 371 | ps4Category: 0 372 | ps4MasterVersion: 01.00 373 | ps4AppVersion: 01.00 374 | ps4AppType: 0 375 | ps4ParamSfxPath: 376 | ps4VideoOutPixelFormat: 0 377 | ps4VideoOutInitialWidth: 1920 378 | ps4VideoOutBaseModeInitialWidth: 1920 379 | ps4VideoOutReprojectionRate: 120 380 | ps4PronunciationXMLPath: 381 | ps4PronunciationSIGPath: 382 | ps4BackgroundImagePath: 383 | ps4StartupImagePath: 384 | ps4SaveDataImagePath: 385 | ps4SdkOverride: 386 | ps4BGMPath: 387 | ps4ShareFilePath: 388 | ps4ShareOverlayImagePath: 389 | ps4PrivacyGuardImagePath: 390 | ps4NPtitleDatPath: 391 | ps4RemotePlayKeyAssignment: -1 392 | ps4RemotePlayKeyMappingDir: 393 | ps4PlayTogetherPlayerCount: 0 394 | ps4EnterButtonAssignment: 1 395 | ps4ApplicationParam1: 0 396 | ps4ApplicationParam2: 0 397 | ps4ApplicationParam3: 0 398 | ps4ApplicationParam4: 0 399 | ps4DownloadDataSize: 0 400 | ps4GarlicHeapSize: 2048 401 | ps4ProGarlicHeapSize: 2560 402 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 403 | ps4UseDebugIl2cppLibs: 0 404 | ps4pnSessions: 1 405 | ps4pnPresence: 1 406 | ps4pnFriends: 1 407 | ps4pnGameCustomData: 1 408 | playerPrefsSupport: 0 409 | restrictedAudioUsageRights: 0 410 | ps4UseResolutionFallback: 0 411 | ps4ReprojectionSupport: 0 412 | ps4UseAudio3dBackend: 0 413 | ps4SocialScreenEnabled: 0 414 | ps4ScriptOptimizationLevel: 3 415 | ps4Audio3dVirtualSpeakerCount: 14 416 | ps4attribCpuUsage: 0 417 | ps4PatchPkgPath: 418 | ps4PatchLatestPkgPath: 419 | ps4PatchChangeinfoPath: 420 | ps4PatchDayOne: 0 421 | ps4attribUserManagement: 0 422 | ps4attribMoveSupport: 0 423 | ps4attrib3DSupport: 0 424 | ps4attribShareSupport: 0 425 | ps4attribExclusiveVR: 0 426 | ps4disableAutoHideSplash: 0 427 | ps4videoRecordingFeaturesUsed: 0 428 | ps4contentSearchFeaturesUsed: 0 429 | ps4attribEyeToEyeDistanceSettingVR: 0 430 | ps4IncludedModules: [] 431 | monoEnv: 432 | psp2Splashimage: {fileID: 0} 433 | psp2NPTrophyPackPath: 434 | psp2NPSupportGBMorGJP: 0 435 | psp2NPAgeRating: 12 436 | psp2NPTitleDatPath: 437 | psp2NPCommsID: 438 | psp2NPCommunicationsID: 439 | psp2NPCommsPassphrase: 440 | psp2NPCommsSig: 441 | psp2ParamSfxPath: 442 | psp2ManualPath: 443 | psp2LiveAreaGatePath: 444 | psp2LiveAreaBackroundPath: 445 | psp2LiveAreaPath: 446 | psp2LiveAreaTrialPath: 447 | psp2PatchChangeInfoPath: 448 | psp2PatchOriginalPackage: 449 | psp2PackagePassword: F69AzBlax3CF3EDNhm3soLBPh71Yexui 450 | psp2KeystoneFile: 451 | psp2MemoryExpansionMode: 0 452 | psp2DRMType: 0 453 | psp2StorageType: 0 454 | psp2MediaCapacity: 0 455 | psp2DLCConfigPath: 456 | psp2ThumbnailPath: 457 | psp2BackgroundPath: 458 | psp2SoundPath: 459 | psp2TrophyCommId: 460 | psp2TrophyPackagePath: 461 | psp2PackagedResourcesPath: 462 | psp2SaveDataQuota: 10240 463 | psp2ParentalLevel: 1 464 | psp2ShortTitle: Not Set 465 | psp2ContentID: IV0000-ABCD12345_00-0123456789ABCDEF 466 | psp2Category: 0 467 | psp2MasterVersion: 01.00 468 | psp2AppVersion: 01.00 469 | psp2TVBootMode: 0 470 | psp2EnterButtonAssignment: 2 471 | psp2TVDisableEmu: 0 472 | psp2AllowTwitterDialog: 1 473 | psp2Upgradable: 0 474 | psp2HealthWarning: 0 475 | psp2UseLibLocation: 0 476 | psp2InfoBarOnStartup: 0 477 | psp2InfoBarColor: 0 478 | psp2UseDebugIl2cppLibs: 0 479 | psmSplashimage: {fileID: 0} 480 | splashScreenBackgroundSourceLandscape: {fileID: 0} 481 | splashScreenBackgroundSourcePortrait: {fileID: 0} 482 | spritePackerPolicy: 483 | webGLMemorySize: 256 484 | webGLExceptionSupport: 1 485 | webGLNameFilesAsHashes: 0 486 | webGLDataCaching: 0 487 | webGLDebugSymbols: 0 488 | webGLEmscriptenArgs: 489 | webGLModulesDirectory: 490 | webGLTemplate: APPLICATION:Default 491 | webGLAnalyzeBuildSize: 0 492 | webGLUseEmbeddedResources: 0 493 | webGLUseWasm: 0 494 | webGLCompressionFormat: 1 495 | scriptingDefineSymbols: {} 496 | platformArchitecture: {} 497 | scriptingBackend: {} 498 | incrementalIl2cppBuild: {} 499 | additionalIl2CppArgs: 500 | apiCompatibilityLevelPerPlatform: {} 501 | m_RenderingPath: 1 502 | m_MobileRenderingPath: 1 503 | metroPackageName: Serializable Dictionary 504 | metroPackageVersion: 505 | metroCertificatePath: 506 | metroCertificatePassword: 507 | metroCertificateSubject: 508 | metroCertificateIssuer: 509 | metroCertificateNotAfter: 0000000000000000 510 | metroApplicationDescription: Serializable Dictionary 511 | wsaImages: {} 512 | metroTileShortName: 513 | metroCommandLineArgsFile: 514 | metroTileShowName: 0 515 | metroMediumTileShowName: 0 516 | metroLargeTileShowName: 0 517 | metroWideTileShowName: 0 518 | metroDefaultTileSize: 1 519 | metroTileForegroundText: 2 520 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 521 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 522 | a: 1} 523 | metroSplashScreenUseBackgroundColor: 0 524 | platformCapabilities: {} 525 | metroFTAName: 526 | metroFTAFileTypes: [] 527 | metroProtocolName: 528 | metroCompilationOverrides: 1 529 | tizenProductDescription: 530 | tizenProductURL: 531 | tizenSigningProfileName: 532 | tizenGPSPermissions: 0 533 | tizenMicrophonePermissions: 0 534 | tizenDeploymentTarget: 535 | tizenDeploymentTargetType: -1 536 | tizenMinOSVersion: 1 537 | n3dsUseExtSaveData: 0 538 | n3dsCompressStaticMem: 1 539 | n3dsExtSaveDataNumber: 0x12345 540 | n3dsStackSize: 131072 541 | n3dsTargetPlatform: 2 542 | n3dsRegion: 7 543 | n3dsMediaSize: 0 544 | n3dsLogoStyle: 3 545 | n3dsTitle: GameName 546 | n3dsProductCode: 547 | n3dsApplicationId: 0xFF3FF 548 | stvDeviceAddress: 549 | stvProductDescription: 550 | stvProductAuthor: 551 | stvProductAuthorEmail: 552 | stvProductLink: 553 | stvProductCategory: 0 554 | XboxOneProductId: 555 | XboxOneUpdateKey: 556 | XboxOneSandboxId: 557 | XboxOneContentId: 558 | XboxOneTitleId: 559 | XboxOneSCId: 560 | XboxOneGameOsOverridePath: 561 | XboxOnePackagingOverridePath: 562 | XboxOneAppManifestOverridePath: 563 | XboxOnePackageEncryption: 0 564 | XboxOnePackageUpdateGranularity: 2 565 | XboxOneDescription: 566 | XboxOneLanguage: 567 | - enus 568 | XboxOneCapability: [] 569 | XboxOneGameRating: {} 570 | XboxOneIsContentPackage: 0 571 | XboxOneEnableGPUVariability: 0 572 | XboxOneSockets: {} 573 | XboxOneSplashScreen: {fileID: 0} 574 | XboxOneAllowedProductIds: [] 575 | XboxOnePersistentLocalStorageSize: 0 576 | xboxOneScriptCompiler: 0 577 | vrEditorSettings: 578 | daydream: 579 | daydreamIconForeground: {fileID: 0} 580 | daydreamIconBackground: {fileID: 0} 581 | cloudServicesEnabled: {} 582 | facebookSdkVersion: 7.9.1 583 | apiCompatibilityLevel: 2 584 | cloudProjectId: 585 | projectName: 586 | organizationId: 587 | cloudEnabled: 0 588 | enableNewInputSystem: 0 589 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2019.4.23f1 2 | m_EditorVersionWithRevision: 2019.4.23f1 (3f4e01f1a5ec) 3 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Fastest 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | blendWeights: 1 21 | textureQuality: 1 22 | anisotropicTextures: 0 23 | antiAliasing: 0 24 | softParticles: 0 25 | softVegetation: 0 26 | realtimeReflectionProbes: 0 27 | billboardsFaceCameraPosition: 0 28 | vSyncCount: 0 29 | lodBias: 0.3 30 | maximumLODLevel: 0 31 | particleRaycastBudget: 4 32 | asyncUploadTimeSlice: 2 33 | asyncUploadBufferSize: 4 34 | excludedTargetPlatforms: [] 35 | - serializedVersion: 2 36 | name: Fast 37 | pixelLightCount: 0 38 | shadows: 0 39 | shadowResolution: 0 40 | shadowProjection: 1 41 | shadowCascades: 1 42 | shadowDistance: 20 43 | shadowNearPlaneOffset: 3 44 | shadowCascade2Split: 0.33333334 45 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 46 | blendWeights: 2 47 | textureQuality: 0 48 | anisotropicTextures: 0 49 | antiAliasing: 0 50 | softParticles: 0 51 | softVegetation: 0 52 | realtimeReflectionProbes: 0 53 | billboardsFaceCameraPosition: 0 54 | vSyncCount: 0 55 | lodBias: 0.4 56 | maximumLODLevel: 0 57 | particleRaycastBudget: 16 58 | asyncUploadTimeSlice: 2 59 | asyncUploadBufferSize: 4 60 | excludedTargetPlatforms: [] 61 | - serializedVersion: 2 62 | name: Simple 63 | pixelLightCount: 1 64 | shadows: 1 65 | shadowResolution: 0 66 | shadowProjection: 1 67 | shadowCascades: 1 68 | shadowDistance: 20 69 | shadowNearPlaneOffset: 3 70 | shadowCascade2Split: 0.33333334 71 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 72 | blendWeights: 2 73 | textureQuality: 0 74 | anisotropicTextures: 1 75 | antiAliasing: 0 76 | softParticles: 0 77 | softVegetation: 0 78 | realtimeReflectionProbes: 0 79 | billboardsFaceCameraPosition: 0 80 | vSyncCount: 1 81 | lodBias: 0.7 82 | maximumLODLevel: 0 83 | particleRaycastBudget: 64 84 | asyncUploadTimeSlice: 2 85 | asyncUploadBufferSize: 4 86 | excludedTargetPlatforms: [] 87 | - serializedVersion: 2 88 | name: Good 89 | pixelLightCount: 2 90 | shadows: 2 91 | shadowResolution: 1 92 | shadowProjection: 1 93 | shadowCascades: 2 94 | shadowDistance: 40 95 | shadowNearPlaneOffset: 3 96 | shadowCascade2Split: 0.33333334 97 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 98 | blendWeights: 2 99 | textureQuality: 0 100 | anisotropicTextures: 1 101 | antiAliasing: 0 102 | softParticles: 0 103 | softVegetation: 1 104 | realtimeReflectionProbes: 1 105 | billboardsFaceCameraPosition: 1 106 | vSyncCount: 1 107 | lodBias: 1 108 | maximumLODLevel: 0 109 | particleRaycastBudget: 256 110 | asyncUploadTimeSlice: 2 111 | asyncUploadBufferSize: 4 112 | excludedTargetPlatforms: [] 113 | - serializedVersion: 2 114 | name: Beautiful 115 | pixelLightCount: 3 116 | shadows: 2 117 | shadowResolution: 2 118 | shadowProjection: 1 119 | shadowCascades: 2 120 | shadowDistance: 70 121 | shadowNearPlaneOffset: 3 122 | shadowCascade2Split: 0.33333334 123 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 124 | blendWeights: 4 125 | textureQuality: 0 126 | anisotropicTextures: 2 127 | antiAliasing: 2 128 | softParticles: 1 129 | softVegetation: 1 130 | realtimeReflectionProbes: 1 131 | billboardsFaceCameraPosition: 1 132 | vSyncCount: 1 133 | lodBias: 1.5 134 | maximumLODLevel: 0 135 | particleRaycastBudget: 1024 136 | asyncUploadTimeSlice: 2 137 | asyncUploadBufferSize: 4 138 | excludedTargetPlatforms: [] 139 | - serializedVersion: 2 140 | name: Fantastic 141 | pixelLightCount: 4 142 | shadows: 2 143 | shadowResolution: 2 144 | shadowProjection: 1 145 | shadowCascades: 4 146 | shadowDistance: 150 147 | shadowNearPlaneOffset: 3 148 | shadowCascade2Split: 0.33333334 149 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 150 | blendWeights: 4 151 | textureQuality: 0 152 | anisotropicTextures: 2 153 | antiAliasing: 2 154 | softParticles: 1 155 | softVegetation: 1 156 | realtimeReflectionProbes: 1 157 | billboardsFaceCameraPosition: 1 158 | vSyncCount: 1 159 | lodBias: 2 160 | maximumLODLevel: 0 161 | particleRaycastBudget: 4096 162 | asyncUploadTimeSlice: 2 163 | asyncUploadBufferSize: 4 164 | excludedTargetPlatforms: [] 165 | m_PerPlatformDefaultQuality: 166 | Android: 2 167 | Nintendo 3DS: 5 168 | PS4: 5 169 | PSM: 5 170 | PSP2: 2 171 | Samsung TV: 2 172 | Standalone: 5 173 | Tizen: 2 174 | Web: 5 175 | WebGL: 3 176 | WiiU: 5 177 | Windows Store Apps: 5 178 | XboxOne: 5 179 | iPhone: 2 180 | tvOS: 2 181 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | m_TestInitMode: 0 11 | CrashReportingSettings: 12 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 13 | m_Enabled: 0 14 | m_CaptureEditorExceptions: 1 15 | UnityPurchasingSettings: 16 | m_Enabled: 0 17 | m_TestMode: 0 18 | UnityAnalyticsSettings: 19 | m_Enabled: 0 20 | m_InitializeOnStartup: 1 21 | m_TestMode: 0 22 | m_TestEventUrl: 23 | m_TestConfigUrl: 24 | UnityAdsSettings: 25 | m_Enabled: 0 26 | m_InitializeOnStartup: 1 27 | m_TestMode: 0 28 | m_EnabledPlatforms: 4294967295 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | PerformanceReportingSettings: 32 | m_Enabled: 0 33 | -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_StripUpdateShader: {fileID: 0} 10 | m_RenderPipeSettingsPath: 11 | m_FixedTimeStep: 0.016666668 12 | m_MaxDeltaTime: 0.05 13 | -------------------------------------------------------------------------------- /ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SerializableDictionary 2 | A serializable dictionary class for Unity. 3 | 4 | Unity cannot serialize standard dictionaries. This means that they won't show or be edited in the inspector 5 | and they won't be instantiated at startup. A classic workaround is to store the keys and values in separate arrays 6 | and construct the dictionary at startup. 7 | 8 | This project provides a generic dictionary class and its custom property drawer that solves this problem. 9 | 10 | ![General screenshot](docs/SerializableDictionary_screenshot1.png) 11 | 12 | ## Features 13 | 14 | - It inherits from `Dictionary` 15 | - It implements a `CopyFrom(IDictionary)` method to help assign values from regular dictionaries 16 | - You can use any serializable type by unity as key or value. 17 | - It can be edited in the inspector without having to implement custom editors or property drawers. 18 | - The inspector will handle invalid dictionary keys such as duplicated or `null` keys and warn the user that data loss can occur if the keys are not fixed. 19 | 20 | ![Conflicting keys screenshot](docs/SerializableDictionary_screenshot2.png) 21 | 22 | ![Null key screenshot](docs/SerializableDictionary_screenshot3.png) 23 | 24 | 25 | ## Limitations 26 | - A non-generic derived class has to be created for each `` combination you want to use. A `CustomPropertyDrawer` has to be declared for each of these classes. 27 | - Multiple editing of scripts using `SerializableDictionaries` in the inspector is not supported. The inspector will show the dictionaries but data loss is likely to occur. 28 | - The conflicting key detection does not work when using `LayerMask` as key. The `LayerMask` value is changed after the `CustomPropertyDrawer` execution. 29 | - Dictionaries of lists or arrays must use the 3 arguments `SerializableDictionary` dictionary class with the extra `SerializableDictionary.Storage` class to hold the values. See the "Dictionary of lists or arrays" section for details. 30 | 31 | 32 | ## Usage 33 | 34 | ### Simple dictionary example 35 | 36 | To create a serializable dictionary of type ``: 37 | - Create a `SerializableDictionary` subclass 38 | ```csharp 39 | [Serializable] 40 | public class StringStringDictionary : SerializableDictionary {} 41 | ``` 42 | - Use `StringStringDictionary` in your scripts as a normal `IDictionary` type 43 | 44 | 45 | ### Dictionary of lists example 46 | 47 | To create a serializable dictionary of type `>`: 48 | - Create a `SerializableDictionary.Storage` subclass to hold the list 49 | ```csharp 50 | [Serializable] 51 | public class ColorListStorage : SerializableDictionary.Storage> {} 52 | ``` 53 | 54 | - Create a `SerializableDictionary` subclass using the previous subclass 55 | ```csharp 56 | [Serializable] 57 | public class StringColorListDictionary : SerializableDictionary, ColorListStorage> {} 58 | ``` 59 | - Use `StringColorListDictionary` in your scripts as a normal `IDictionary>` type 60 | 61 | 62 | ## Details 63 | 64 | Older versions of Unity (before 2020.1) are unable to directly serialize generic types. Therefore, you need to create a derived class for each `SerializedDictionary` specialization you want. 65 | ```csharp 66 | [Serializable] 67 | public class StringStringDictionary : SerializableDictionary {} 68 | 69 | [Serializable] 70 | public class MyScriptColorDictionary : SerializableDictionary {} 71 | ``` 72 | 73 | You can use your own serializable classes. 74 | ```csharp 75 | [Serializable] 76 | public class MyClass 77 | { 78 | public int i; 79 | public string str; 80 | } 81 | 82 | [Serializable] 83 | public class StringMyClassDictionary : SerializableDictionary {} 84 | ``` 85 | 86 | 87 | Add the dictionaries to your scripts and access them directly of through a property. 88 | The dictionaries can be accessed through a property of type `IDictionary` for better encapsulation. 89 | 90 | ```csharp 91 | public StringStringDictionary m_myDictionary1; 92 | 93 | [SerializeField] 94 | MyScriptColorDictionary m_myDictionary2; 95 | public IDictionary MyDictionary2 96 | { 97 | get { return m_myDictionary2; } 98 | set { m_myDictionary2.CopyFrom (value); } 99 | } 100 | 101 | public StringMyClassDictionary m_myDictionary3; 102 | ``` 103 | 104 | The `CopyFrom(value)` method clears the `m_myDictionary2` dictionary and adds to it each of content of the `value` dictionary, effectively copying `value` into `m_myDictionary2`. 105 | 106 | `SerializableDictionary` has a copy constructor from `IDictionary`. As constructors from parent classes cannot be used directly, you have to add a copy constructor to your derived classes calling the base constructor in order to use it. 107 | 108 | ```csharp 109 | [Serializable] 110 | public class StringColorDictionary : SerializableDictionary 111 | { 112 | public StringColorDictionary(IDictionary dict) : base(dict) {} 113 | } 114 | ``` 115 | 116 | ### Dictionary of lists or arrays 117 | 118 | Because unity cannot serialize a array of lists or an array of arrays, using a `SerializableDictionary` or a `SerializableDictionary>` in a script will not work properly. The dictionary will not show up in the inspector and the values will not be saved. 119 | 120 | It is necessary to create an intermediate class that will contain the list or array. This class can then be contained in an array and be serialized by Unity. 121 | 122 | Create a class that inherits from `SerializableDictionary.Storage`. This storage class will only contain a `List data` field. 123 | 124 | ```csharp 125 | [Serializable] 126 | public class ColorListStorage : SerializableDictionary.Storage> {} 127 | ``` 128 | 129 | If you use this storage class directly with SerializableDictionary, you will have to access the list or array through the `.data` field of the `Storage` class because your dictionary will inherit from `Dictionary>` instead of `Dictionary>`. This is far from ideal. 130 | 131 | ```csharp 132 | // non optimal example for a dictionary of color list 133 | [Serializable] 134 | public class ColorListStorage : SerializableDictionary.Storage> {} 135 | [Serializable] 136 | public class StringColorListDictionary : SerializableDictionary {} 137 | 138 | public StringColorListDictionary m_colorStringListDict; 139 | 140 | // you would have to access the color list through the .data field of ColorListStorage 141 | List colorList = m_colorStringListDict[key].data; 142 | ``` 143 | 144 | To access the lists directly, use the special 3 arguments `SerializableDictionary` class where `TValueStorage` is the class previously created. 145 | 146 | 147 | ```csharp 148 | [Serializable] 149 | public class ColorListStorage : SerializableDictionary.Storage> {} 150 | [Serializable] 151 | public class StringColorListDictionary : SerializableDictionary, ColorListStorage> {} 152 | 153 | public StringColorListDictionary m_colorStringListDict; 154 | 155 | // you can now access directly the color list 156 | List colorList = m_colorStringListDict[key]; 157 | ``` 158 | -------------------------------------------------------------------------------- /docs/SerializableDictionary_screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azixMcAze/Unity-SerializableDictionary/b4b39588d8744b69a3a53246cdc20b3ba92ec7ba/docs/SerializableDictionary_screenshot1.png -------------------------------------------------------------------------------- /docs/SerializableDictionary_screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azixMcAze/Unity-SerializableDictionary/b4b39588d8744b69a3a53246cdc20b3ba92ec7ba/docs/SerializableDictionary_screenshot2.png -------------------------------------------------------------------------------- /docs/SerializableDictionary_screenshot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azixMcAze/Unity-SerializableDictionary/b4b39588d8744b69a3a53246cdc20b3ba92ec7ba/docs/SerializableDictionary_screenshot3.png -------------------------------------------------------------------------------- /docs/SerializableDictionary_screenshot4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azixMcAze/Unity-SerializableDictionary/b4b39588d8744b69a3a53246cdc20b3ba92ec7ba/docs/SerializableDictionary_screenshot4.png -------------------------------------------------------------------------------- /docs/SerializableDictionary_screenshot5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azixMcAze/Unity-SerializableDictionary/b4b39588d8744b69a3a53246cdc20b3ba92ec7ba/docs/SerializableDictionary_screenshot5.png --------------------------------------------------------------------------------