Example #1
0
    public override void OnInspectorGUI()
    {
        var enemyTypes = serializedObject.FindProperty(nameof(EnemySpawner.EnemyTypes));

        EditorGUILayout.PropertyField(enemyTypes, true);

        var enemyNames = new string[enemyTypes.arraySize];

        for (int i = 0; i < enemyNames.Length; i++)
        {
            enemyNames[i] = enemyTypes.GetArrayElementAtIndex(i)?.objectReferenceValue?.name ?? "Null";
        }

        EditorExtensions.CustomArrayProperty(serializedObject.FindProperty(nameof(EnemySpawner.Waves)), (p, i) => WaveEditor(p, i, enemyTypes.arraySize, enemyNames));

        EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(EnemySpawner.DifficultyIncreaseTime)), true);

        serializedObject.ApplyModifiedProperties();

        EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(EnemySpawner.Waves)), true);
    }