#Cant Set Properties in Custom Editor
1 messages · Page 1 of 1 (latest)
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEditor.SceneManagement;
using UnityEditor.Overlays;
[CustomEditor(typeof(Test))]
public class TestEditor : Editor
{
private bool SETUPFoldopen;
private bool LSFoldopen;
private bool LSActivated;
[HideInInspector] public SerializedProperty Sanimator;
public void OnEnable()
{
Sanimator = serializedObject.FindProperty("animator");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
Test script = (Test)target;
GUILayout.Label("-- --", EditorStyles.label);
GUILayout.Label("Game Test System", EditorStyles.boldLabel);
GUILayout.Space(10);
SETUPFoldopen = EditorGUILayout.BeginFoldoutHeaderGroup(SETUPFoldopen, "Setup");
if (SETUPFoldopen)
{
EditorGUILayout.ObjectField("Animator: ", script.animator, typeof(Animator), true);
if (LSActivated)
{
if (!script.animator)
{
EditorGUILayout.HelpBox("You need to have a Animator Set to use Loading System", MessageType.Error);
} else if (script.animator.parameters.ToString().Contains("Exit") == false)
{
EditorGUILayout.HelpBox("You need to have a Exit Boolean Parameter in the Animator to use Loading System", MessageType.Warning);
}
}
}
EditorGUILayout.EndFoldoutHeaderGroup();
GUILayout.Space(5);
// Limit