I have an actor in my scene with a custom scene component, let’s call it EffectComponent. This EffectComponent has different properties that I want to show or hide based on if the actor has a specifiv other component. E.G. If the actor has a FireComponent, I want to enable UProperties on the EffectComponent without having the game running. Is this in any way possible? Thank you!
If i got your question right, the thing you looking for is the EditCondition metaproperty of uproperty
I can’t provide much info about it, but here is usage example from my project: UPROPERTY(EditAnywhere, meta = (EditCondition = "InitMode == EMyEnum::EnumValue", EditConditionHides))
Where
InitMode is a enum member field defined in the same class as a member covered by this uproperty;
Afaik, in EditCondition you may put any valid boolean expression. I’m not sure what extents of its power, but probably you will be able to put something like “if my owner has a component of type i need” here;
Just the EditCondition will disable field editability, EditConditionHides will hide it completely.
actually the EditCondition was my first attempt. I tried to do something like this:
meta = (EditCondition = "IsValid(GetOwner()->GetComponentByClass(UFireComponent::StaticClass()))")
but it didn’t work out. At the moment I have a boolean that can be toggled and shows/hides the associated properties, but I find it strange to have this boolean eventhough the actor might not have the corresponding component.