BP_Slow seen on the screenshot is an ActorComponent.
It has a variable called SlowingDownStrength. Everything works fine, when I set variable on Add [ComponentName] node’s Details panel. But if I try to set this value from exposed node (here - using Literal Float), it seems to be ignored and value from Details takes effect instead.
Is this a bug or am I doing something wrong? Is there any workaround to this problem?
Any updates on this? Running into a similar issue, seems to ignore pins completely.
After looking around, I wonder if the expose on spawn is only meant to be used on actors and not components since there is no construction script?
I ran into the same issue here. I have two variables exposed on spawn. One works, the other doesn’t. I suspect some internal issue. I will fiddle with it and see if I can get it to work for both variables.
I found the answer in this post: Values of Expose on Spawn variables of Component are not set when doing BeginPlay - Blueprint - Unreal Engine Forums
To summarize: expose on spawn is not equivalent concept or part of the constructor of the actor/component/blueprint as one could think. In other words the events/begin play node may execute before the exposed on spawn variables are set. Workarounds include but not limited to:
- Add a small delay after your begin play node which will allow the exposed on spawn variables to be set.
- Use an initialize function after creation.
- Delegate the initialization responsibility to another actor (if architecture allows).
I feel this should resolve the issue here. However I do agree with the reports it is counter intuitive.
Some interesting follow-up questions could be:
- Why is this constraints? What benefits does it allow the engine? Concurrency?
- Could this behavior be changed to fall under the constructor idiom in blueprints?
- Is this improvement prioritized? Is there a tracker for it?
yes, this is absolutely the right decision.
If it doesnt help, watch your game logic, something can nullify your variable.