9/4/2023 0 Comments Scriptable gamesPosition.y += EditorGUIUtility.singleLineHeight * 1.5f Using (var changeCheck = new EditorGUI.ChangeCheckScope())ĮditorGUI.PropertyField(xRect, xDimension, GUIContent.none) ĮditorGUI.PropertyField(yRect, yDimension, GUIContent.none) Īrray.arraySize = xDimension.intValue * yDimension.intValue Var array = property.FindPropertyRelative(nameof(Table.flatArray)) Var yDimension = property.FindPropertyRelative(nameof(Table.yDimension)) Var xDimension = property.FindPropertyRelative(nameof(Table.xDimension)) XRect.height = EditorGUIUtility.singleLineHeight Property.isExpanded = EditorGUI.Foldout(foldoutRect, property.isExpanded, label) Public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)įoldoutRect.height = EditorGUIUtility.singleLineHeight įoldoutRect.width = EditorGUIUtility.labelWidth Return height * EditorGUIUtility.singleLineHeight Height += property.FindPropertyRelative(nameof(Table.xDimension)).intValue * 1.5f Public override float GetPropertyHeight(SerializedProperty property, GUIContent label) Private class TableDrawer : PropertyDrawer Could of course make this generic but for the drawer it easier this way for nowįlatArray = new char įor (var x = 0 x flatArray I would probably simply use a wrapper class like e.g. Use a field instead public List Crosswords Make sure that the type Crossword itself is So both your properties are not serialized (= saved) at all. Note: Unity doesn’t support serialization of multilevel types ( multidimensional arrays, jagged arrays, dictionaries, and nested container types) Serializers in Unity work directly on the fields of your C# classes rather than their properties, so there are rules that your fields must conform to to be serialized. The script to save and load the scriptable object are used within the scene The object is created successfully through an editor script and it has all the data saved, but if I close and reopen the Editor, and try to load the fields are null. This is the code that I use to save the Scriptable Object private static void Save(Level level, string path)ĪssetDatabase.CreateAsset(level, path + ".asset") ĮditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()) Return Crosswords.First(crossword => crossword.Direction = direction & crossword.GetCrosswordIndexes().Contains(new Vector2(x, y))) Ottieni la prima e l'unica parola che si trova sotto quell'indice Public Crossword GetCrosswordAtIndex(int x, int y, Direction direction)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |