I tried to spawn an actor and then assigned it to an object reference variable in construction script. But when I use this variable. It’s invalid
Hi QuerryGL,
You aren’t really meant to be spawning actors in the construction script - in blueprint it will fail. It’s to stop accidentaly adding thousands of actors to a level.
There are ways around it:
- Create ChildActorComponents in the construction script instead (down side is too many are slow)
- Spawn them from begin play or somewhere else
- Use a loop hole (google ue5 spawn construction loophole)
- Create StaticMesh Instances instead of actors and control them all from your 1 actor
- Use a managed spawn system that handles those created actors.
If you’re interested in options 4) or 5) - I have a plugin on the marketplace that can make those two things much easier, fast and safe. search for rdInst if that is an option for you.