Skip to main content

General Setup

Installation

Errant Instance Interaction plugin can be downloaded from the "License Info" page.

It is available only after purchasing any of the Errant Worlds plugins and is not included in the trial. This is because the plugin does not contain any built-in license checks.

The plugin needs to be installed the same way as other Errant Worlds plugins and enabled in Unreal Engine.

EII World Subsystem

Converting instances is managed by the Errant Instance Interaction World Subsystem aka Eii World Subsystem.

Registering Instanced Static Mesh (ISM) components

Using the provided HISM/ISM classes

The easiest way to register a HISM/ISM component to EII is by using the example classes we provided with the plugin - UEiiHierarchicalInstancedStaticMeshComponent/UEiiInstancedStaticMeshComponent as your meshes. Those classes automatically register/unregister to EII and have properties that allow configuring to which actor class they should convert to.

image

However, you cannot use the provided classes directly for meshes spawned by Errant Biomes or Errant Paths. Instead, you need to create new classes that derive from Errant Biomes/Paths ISM classes, and add registration/unregistration to EII in them. Similarly, if use your own ISM class with custom logic, you can add registration/unregistration to EII in that class.


Adding registration to EII in an ISM class

If you are using your own ISM class, you must register it in the Eii World Subsystem using the RegisterInstancedComponent function. This should be called from the ISM component’s BeginPlay and OnRegister functions (preferably both) as these functions are called whenever a component is spawned or streamed in. Unfortunately, only BeginPlay is directly overridable in Blueprints.


RegisterInstancedComponent params

The RegisterInstancedComponent function takes three parameters:

  • InstancedComp – The ISM component being registered to EiiWorldSubsystem.
  • DefaultActorClassToConvertTo – The default actor class to spawn when converting a mesh instance, used when no matching entry is found in the mapping (next parameter).
  • MeshToActorClassMapping – a EiiMeshToActorMapping DataAsset that stores a mapping between the mesh assets and the actor classes to which they should convert to. The image below shows a mapping we used in our examples.

image

You can use a single EiiMeshToActorMapping DataAsset for all ISM components or assign different mappings as needed.

This mapping also serves as a way to restrict conversions to specific assets. If DefaultActorClassToConvertTo is omitted, only meshes explicitly listed in the mapping will be converted.

Alternatively, you can omit MeshToActorClassMapping and rely solely on DefaultActorClassToConvertTo for all conversions.

Simplified setup for basic use-cases

Imagine a small pole or a road sign that breaks off as a single piece when hit by a car. In such cases, there is no need to create multiple unique actor classes for each mesh asset. Such straightforward scenarios can be handled by a specialized class: EiiMeshActor.

Pass EiiMeshActor (or its custom subclass) in the DefaultActorClassToConvertTo parameter. EiiMeshActor is recognized by EiiWorldSubsystem which automatically calls its SetMeshAsset right after the conversion. This function receives the original mesh asset from the instance, allowing the actor to dynamically assign the correct mesh asset to its MeshComponent. Crucially, SetMeshAsset call also works in multiplayer.

To finalize the setup, make sure the actor class has a MeshComponent and implement the SetMeshAsset event in the actor’s Blueprint and assign the provided mesh to its MeshComponent. The actor can also include additional components or custom logic as needed.

Unregistering ISM components

When an ISM component is destroyed, it should be unregistered from the EiiWorldSubsystem to free the data associated with that component. This can be done by calling UnregisterInstancedComponent in the component’s Destroyed function.

note

Since Destroyed is not called when a component is streamed out by World Partition, streaming out will not cause the EiiWorldSubsystem to forget the conversions that have been performed.