简体   繁体   中英

Unity - Show Different attributes for different values of another variables in inspector

I want to have something like this:

I have a script attached to a game object. the script has something like below, for example:

enum Type {type1, type2};

public Type temptype;

public float F1;
public float F2;
public float F3;
public float F4;
public float F5;

in the inspector, when I select "type1" for "temptype" variable, I want to F1, F2 and F3 appear but F4 and F5 be hidden. and when "type2" is selected, F1, F2, F3 hides and F4 and F5 be visible.

this is like "Render Mode" option of canvas component. when we select "screen space - overlay", some variables show in below and when we select "world" some different variables appear.

I don't want to use custom inspector technics. Maybe drawers or property attributes.

我认为没有customEditors不可能实现:/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM