This little code will help you use scripts in Unity faster, more efficiently and more comfortably.
[HideIf("hideColliderSettings", true)]
public Vector3 size;
[HideIfNull("target")]
float distanceToTarget;
[HideIfNotNull("target")]
public string error = "Please, set enemy's target";
public enum Type : int
{
archer,
warrior,
mage
}
public Type EnemyType;
[HideIfEnumValue("EnemyType",HideIf.NotEqual, (int) Type.warrior)]
public float swordDamage;
[HideIfEnumValue("EnemyType",HideIf.NotEqual, (int) Type.archer)]
public float arrowDamage;
[HideIfEnumValue("EnemyType",HideIf.NotEqual, (int) Type.mage)]
public float orbDamage;
[HideIfNotNull("textFieldUI")]
[TextArea(1,2)] public string textArea;
[HideIfNull("playerColliders")]
[HideIfEnumValueAttribute("colliderType", HideIf.Equal, (int) Type.Box)]
public float radius;
[HideIfEnumValue("EnemyType",HideIf.Equal, (int) Type.warrior)]
public float projectileSpeed {get; private set;}
[HideIfEnumValue("EnemyType",HideIf.NotEqual, (int) Type.warrior)]
[SerializeField] private float _swordDamage;
public class HideIfScriptable : ScriptableObject
{
public bool isHidden;
[HideIf("isHidden", true)]
public int data;
}
public class ChildExample : ParentExample
{
[HideIf("_isHidden", true)]
[SerializeField] private int _number;
}
Guidanel - huge thanks for last three features. This user's support made this asset even more flexible and convenient.
You can just download repository and move file to Unity Assets folder. Installation is finished.
I made a simple HideIfExample.cs with a demonstration of all attributes.