Download

How come some component float variables can only be set in Construction Script (and Not Event Graph)

It seems that some float variables from some components can only be set in the construction script. Is this true or am I missing something? I attached a quick example of the initial speed variable in a ProjectileMovement component. In construction script it updates the speed correctly, in event graph it does not do anything.

ConstructionScriptWorks.png

db690c021f1a6f78e7a2a4444ff86f917230f322.png

Even if I create another float variable and use that to set the initial speed variable, it works as long as it is in construction script but editing that variable in event graph does nothing.

15fc973ec3a62743a27a1e0b27899eb2c2d07be0.png

3177ef2d1dd15aff08545ea24ec72dfabbd5dfa9.png

I am confused because there is numerous other places in my projects where I have set the float variables on components in event graph with no problem. Any insight into this is appreciated.

Thanks

Im not 100% sure on this but…

The Construction Script is called when you create the Actor befor he does anything while Begin Play is called when you start the game or directly after spawning the Actor.
So its AFTER you initialized the projectile speed, which has no effect because its too late.
That means its has something to do when the actor uses the given variables and not about float.

Again im not sure about this.

Hmmm that may be right. A couple notes to that:

  1. The projectile is spawned like a gun being shot. So the projectile isn’t in the game until it is spawned (when Begin Play has started for that actor). So it’s not a projectile that is sitting in the level from the start of the game.

  2. I agree with you that it doesn’t seem like it is related to being a float. I don’t see how that would be relevant at all but I mentioned it because I can call Vector variables and Rotator variables from the “RotatingMovement” component (attached to Begin Play) and they all function fine. It seems to only be the floats that only work in Construction Script. I am missing something obvious or thinking of it the wrong way I am sure. It’s just a bit confusing, especially since I have other cases where setting float variables from Begin Play works fine.

I guess I am probing whether this is a normal thing and I am not understanding something fundamental about blueprints or if my personal file has some weird code stuff going on where it is canceling it out somehow.

Any insight?