Hi,
I want create many different kind of variable foreach value of dropdown list. Sorry my bad english, please look my image in attachment. How can i do it.
Thanks so much.
Hi,
I want create many different kind of variable foreach value of dropdown list. Sorry my bad english, please look my image in attachment. How can i do it.
Thanks so much.
Here is my solution, for C#
An exemple test class (your code) :
using UnityEngine;
using System.Collections;
public class MyTestScript : MonoBehaviour {
public enum ParametersType {
WithoutParameters,
WithParameters
}
public ParametersType type = ParametersType.WithoutParameters;
public string testString = "";
public int testInt = 0;
}
And the your custom UI script, should be in the Editor folder at the root of the Assets folder :
using UnityEngine;
using System.Collections;
using UnityEditor;
[CustomEditor(typeof(MyTestScript))]
public class TestCustomInspector : Editor
{
public override void OnInspectorGUI()
{
MyTestScript script = (MyTestScript)target;
script.type = (MyTestScript.ParametersType)EditorGUILayout.EnumPopup("My type", script.type);
if (script.type == MyTestScript.ParametersType.WithParameters)
{
script.testString = EditorGUILayout.TextField("Test string", script.testString);
script.testInt = EditorGUILayout.IntField("Test int", script.testInt);
}
}
}
Result :
to