Advertisement
PotiSolhdoost

Untitled

Jul 24th, 2023
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEditor;
  3.  
  4. [CustomEditor(typeof(Game))]
  5. public class GameEditor : Editor
  6. {
  7. public override void OnInspectorGUI()
  8. {
  9. Game game = (Game)target;
  10.  
  11. EditorGUILayout.PropertyField(serializedObject.FindProperty("gameMode"), new GUIContent("Game Mode"));
  12.  
  13. if (game.gameMode == Game.GameMode.CustomStart)
  14. {
  15. EditorGUILayout.PropertyField(serializedObject.FindProperty("playerWhitePositions"), true);
  16. EditorGUILayout.PropertyField(serializedObject.FindProperty("playerBlackPositions"), true);
  17. }
  18.  
  19. // Draw the rest of the fields
  20. DrawPropertiesExcluding(serializedObject, "gameMode", "playerWhitePositions", "playerBlackPositions");
  21.  
  22. serializedObject.ApplyModifiedProperties();
  23. }
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement