Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Normally in Unreal, if you wish to spawn a an Actor at runtime, you would simply call “Spawn Actor From Class” in Blueprint, or UWorld::SpawnActor from C++, to make a new instance of it.

There are a couple of problems you run into when doing this in Cavrnus howeverThe CavrnusFunctionLibrary provides an API call that solves two of the main challenges doing this.

  1. The object spawned isn’t must be synchronized for everyone, so only your local client will see the new object.Even if it was synchronized, every instance would .

  2. Every instance should share the same property paths as the base prefab, so they couldn’t can behave individually.

Both of these problems are solved using the CavrnusFunctionLibrary API call SpawnObject.

...

The new root Container Name is returned synchronously from the SpawnObject call, and can immediately be used to post properties. Alternatively, any ValueSync scripts components on the object will function normally too.

...