SaintsField icon indicating copy to clipboard operation
SaintsField copied to clipboard

GetComponentInParents/Children still shows error box when assigned

Open laurentopia opened this issue 1 year ago • 3 comments

I think it's by design but it is not very useful to still show an error when the object was deparented and therefore the references component is no longer in the same hierarchy image

laurentopia avatar Jul 23 '24 23:07 laurentopia

Hummmm, so you mean, the MCUnityRelay can be used in different situations, in some case the Unit is in parents, some are not.

And if it's not, and when it's been manually assigned, the error message looks redundant, do I understand correctly?

TylerTemp avatar Jul 24 '24 03:07 TylerTemp

Well, GetComponentByPath has argument which uses EGetComp.ForceResign | EGetComp.NoResignButton to achive this feature. This is not implemented on other GetComponent* yet.

I think I might do this when I have some spare time

TylerTemp avatar Jul 24 '24 06:07 TylerTemp

And if it's not, and when it's been manually assigned, the error message looks redundant, do I understand correctly?

that's right. since the attributes are used as a helper, not a nanny, the error message is overreaching.

laurentopia avatar Jul 24 '24 20:07 laurentopia

Hi,

this is now possible in 3.4.0:

[GetComponentInParents] public SpriteRenderer notInParents;
[GetComponentInChildren] public SpriteRenderer notInChildren;

// no button at all
[GetComponentInParents(EXP.Silent | EXP.NoPicker | EXP.NoResignButton)] public SpriteRenderer notInParentsNoButton;
[GetComponentInChildren(EXP.Silent | EXP.NoPicker | EXP.NoResignButton)] public SpriteRenderer notInChildrenNoButton;

image

The config is kinda tedious. It might be optimized on a later version.

Note: This update might contain bugs.

TylerTemp avatar Oct 14 '24 14:10 TylerTemp

amazing! thanks I'll live with the complex flags as I think your choice of X when overriden is a perfect default

laurentopia avatar Oct 31 '24 09:10 laurentopia