This is from a pluralsight tutorial I am trying to figure out:
I have been struggling with this for some weeks, would like to check if is there something I am missing.
I want to get total of all pickable objects for each pickable type in a game level.
I have a base blueprint class for pickable objects and three types of pickable instances Blue, Pink and Key.
Defined a gunction to Get total Number of Pickables with variables TotalBluePickups, TotalKeyPickups, TotalPinkPickups.
I already checked all intances of the pickable blueprints in the level, are indeed blueprints child of pickup base class. But somehow the construction script is not properly updating the variable after running GetAllActorsOfClass function.
Any ideas of what might be happening?
construction script is for editor, not for gameplay needs (but im unsure)
i read somewhere that construction script is launched everytime you move with actor in editor or something like that… so i recommend you to move all logic to event graph…
The construction script / constructor is called when the game object (e.g. the actor, the game mode, etc) is getting created.
The game mode object will most likely be created before all other actors (not sure about that) - so the KeyPickup Actors are not there yet.
You shouldn’t access other objects in the constructor. The constructor should be used carefully with only class interna needed stuff.
You probably want to use BeginPlay in the Level Blueprint or Begin Play in the Game Mode Blueprint.
Indeed this is also bugging me, Because in the editor I have all Blueprints pickups placed, so it should work in the construction script. The tutorial I was following was made with UE4.3 and I am using 4.14, maybe the changed something regarding the construction script features, will check if I find something.
Thanks for the reply!