I’m a beginner trying to develop a basic endless runner game (like the unreal tutorial one), but when adding some coins on the area to be collected by the player, some problems occur.
The variable I promoted from the cast doesn’t seem to work.
Error Accessed None ‘CoinRef’ from node Move Coins to Player in graph ‘EventGraph’ in blueprint BP_Floor
where is the problem?
I tried the spawnActor method but always the same problem, coins don’t appear.
If I use the “Add child component” , coins appear but then, the function I call afterwards don’t execute ( a function to move the coins to player’s location like they’re magnetized.
Here is the “move Coins To Player” function
Because it is probably just that.
Coin Class - this is just class that tells what to spawn
Then you spawn actor which is of coin class
Return value is pointer to spawned actor, You spawn 5 of them in loop, each time you overwrite old pointer with new one
So when loop is finished your variable “coin ref” remembers just last spawned coin pointer.
Also what value “coin class” has? It should be exactly same class as “BP_Coin”
I changed some things now and instead of using Spawn Actor and class, I used add child Actor component and it works better as coins now appear. I put coins in an array and try to call the function for each one. But the coins don’t move at all.