bool TestCondition( System.Object targetObject, TypeDescription td )
bool TestCondition( SerializedObject so )

robot_2Generated
code_blocksInput

Description

The TestCondition method in the HideIfAttribute class is used to determine whether a property should be hidden based on the value of another property within the same class. This method is typically utilized in the Editor Inspector to conditionally hide properties.

Usage

To use the TestCondition method, you need to pass the target object and a TypeDescription instance as parameters. The method will return a boolean value indicating whether the condition for hiding the property is met.

Example

// Example usage of HideIfAttribute.TestCondition
public class MyComponent : Component
{
    [HideIf("IsHidden", true)]
    public int HiddenProperty { get; set; }

    public bool IsHidden { get; set; }

    public void CheckVisibility()
    {
        HideIfAttribute hideIf = new HideIfAttribute("IsHidden", true);
        bool shouldHide = hideIf.TestCondition(this, new TypeDescription(typeof(MyComponent)));
        // shouldHide will be true if IsHidden is true
    }
}