Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

custom editor question, value not sticking

Discussion in 'Editor & General Support' started by steveh2112, Feb 8, 2020.

  1. steveh2112

    steveh2112

    Joined:
    Aug 30, 2015
    Posts:
    314
    i just started using a custom editor and i have this code
    Code (CSharp):
    1. ai._ChangeWanderTimeMax = EditorGUILayout.Slider("Change Time Max", ai._ChangeWanderTimeMax, 1.0f, 50.0f);
    in the editor.cs script

    i can set the value fine with the slider or input field but as soon as i run, the value goes to 1

    its a simple definition in another class
    Code (CSharp):
    1. public float _ChangeWanderTimeMax;
    and nothing in the code changes the value
    any ideas?
    thanks
     
  2. steveh2112

    steveh2112

    Joined:
    Aug 30, 2015
    Posts:
    314
    ok, i figured it out, because i made a preset, then changed the editor, i guess the preset was nuking the changes somehow.