code1--PhoneManage

public class PhoneManage:MonoBehaviour
{
    public enum Platform
    {
        A,B
    }
    
    public Platform curPlatform = Platform.A;
    
    public Vector3 a1,a2;
    public int b1;
    public Vector3 c1;
}

code2--IEditor(放入Editor文件夹下)

[CustomEditor(typeof(PhoneManage))]
public class IEditor : Editor 
{
	
		public override void OnInspectorGUI()
		{
				PhoneManage me = (PhoneManage)target;
				me.curPlatform = (PhoneManage.Platform)EditorGUILayout.EnumPopup ("type", me.curPlatform);
			
				switch(me.curPlatform)
				{
						case PhoneManage.Platform.A:
						me.a1 = EditorGUILayout.Vector3Field("a1",me.a1);
						me.a2 = EditorGUILayout.Vector3Field("a2",me.a2);
						break;
						
						case PhoneManage.Platform.B:
						me.b1 = EditorGUILayout.IntField("b1",me.b1);
						break;
				}
		}
}

  

相关文章:

  • 2021-04-23
  • 2021-08-29
  • 2022-12-23
  • 2022-12-23
  • 2021-06-21
  • 2021-06-17
  • 2022-02-06
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-05
  • 2022-12-23
  • 2022-01-06
  • 2022-12-23
  • 2021-06-23
  • 2022-12-23
相关资源
相似解决方案