Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConditionalFieldAttribute does not hide HeaderAttribute [Bug] #5

Open
wqyeo opened this issue Feb 2, 2019 · 5 comments
Open

ConditionalFieldAttribute does not hide HeaderAttribute [Bug] #5

wqyeo opened this issue Feb 2, 2019 · 5 comments

Comments

@wqyeo
Copy link
Contributor

wqyeo commented Feb 2, 2019

Yet another trivial and minor bug where ConditionalFieldAttribute does not hide HeaderAttribute, as shown in both of these screenshots:

Codes used when encountering this:

    [Separator("Shooter Targetting properties", true)]

    [SerializeField, Tooltip("True if this shooter locks on to an enemy")]
    private bool lockOn;

    [ConditionalField("lockOn", false), SerializeField, Tooltip("Where this shot is angled towards."), Range(0f, 360f)]
    private float shootingAngle;
    
    [MustBeAssigned, ConditionalField("lockOn", true), SerializeField, Tooltip("The target this shooter is locking on to. (Play if null.)")]
    private Transform targetTransform;

    [Header("Angle Rotating Options")]

    [SerializeField, ConditionalField("lockOn", false), Tooltip("The rotational speed applied to the shooting angle.")]
    private float shootAngleRotationSpeed;

Though I can see the design idea in not fixing this. (Where there might be more than 1 field below the header, and it would look weird/bad if we hid the header at that situation.)

Maybe a parameter in the attribute that removes the header(if exists) when hidden? Or some checking to see if there is some fields below that doesn't have a header before hiding the header.

@wqyeo
Copy link
Contributor Author

wqyeo commented Feb 11, 2019

Probably not too possible.

Tried changing the header's attribute property directly, only to find out that you can't actually do so due to how attributes are tied to the binary files.

Saw nothing that could help the header in the UnityEditor API. (Though I might add that I am not too proficient with the UnityEditor API itself)

Could prob close this issue unless someone manages to find a way to hide the headers.

@Deadcows
Copy link
Owner

Let's consider this one as "by design". You may try to use SeparatorAttribute instead of the Header and I can add specific behavior for combination of Separator and ConditionalField.

I'll close this one when my ConditionalField attribute will work fine with SeparatorAttribure

@Deadcows
Copy link
Owner

Deadcows commented Jun 2, 2019

this one in my TODO list now. I'll close this issue for now

@Deadcows Deadcows closed this as completed Jun 2, 2019
@Podden
Copy link

Podden commented Oct 12, 2023

Bump ;). Just ran into it

@Deadcows
Copy link
Owner

A note for the Andrew from (hopefully near) future
I think I need to reimplement some Decorators and also finally reimplement ConfitionalFieldAttribute to use AttributeBase. It's one of the most important steps towards MyBox 2.0

@Deadcows Deadcows reopened this Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants