Check if an actor was placed in editor, or spawned at runtime?
Hello, how can I tell if an actor was placed using the editor (a coin in the world), or spawned at runtime (from a killed enemy) from within the BeginPlay function?
I need this so the coin can set up it's parameters, such as to persist as a world coin, or to bounce around and face out.
Found a solution to my problem.
Lets you initialize variables on an actor before actually spawning it. This way you can set certain variables, before it runs it's BeginPlay.
If it was spawned in editor then the coin is visible with out hitting the play button. If it shows the moment you run the game then it was spawned by a blueprint (like the event begin play, you an event that was caused by your enemy dying, etc.)
answered Oct 14 '16 at 04:06 AM
All Actors have a variable called "bNetStartup" with the description "If true, this actor was loaded directly from the map, and for networking purposes can be addressed by its full path name".
I have been able to check if an actor was placed in the map or spawned by using this flag.
It is useful for if you play a sound on spawn in PostInitializeComponents() for instance and do not want to play the sound if the actor started spawned in the world.
answered Jan 19 '19 at 11:56 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here