Hello everybody!
I’m currently trying to make a custom inspector so that i can easily change variables.
This is how the principle works:
Child editor script fetches variables from components → custom editor fetches those from the child editor → displays them → if any changes are made, sets the child script variables to the same value → child script sets all variables correctly in their respective components
The problem is that i can’t seem to change the variables in my custom editor. Anything i try to do gets reverted back automatically. Is there a solution?
Extract from code:
showFoldout10 = EditorGUILayout.Foldout(showFoldout10, "Optimisation");
//Optimisation
if(showFoldout10)
{
EditorGUILayout.Space();
EditorGUILayout.FloatField("Cover: Amount Of Rays", coverAmountOfRays);
EditorGUILayout.FloatField("Cover: Fielf Of View", coverFieldOfView);
EditorGUILayout.FloatField("Cover: Distance To Check", coverDistanceToCheck);
EditorGUILayout.FloatField("Patrol: Frames To Check", patrolTickBarrier);
}
if(GUI.changed)
{
SetVariablesToChild();
}
else
{
GetVariablesFromChild();
}
Thank you, Nikita