Prefab main actor

In Hology Engine, a Main Actor allows you to define the primary identity of a prefab. By designating a specific actor within a prefab as the "Main Actor", the prefab itself effectively adopts that actor's type.

This concept creates an "is-a" relationship between the prefab and its main actor. For instance, a complex SciFiSlidingDoor prefab containing meshes, sounds, and particle effects can be designated to be a DoorActor.

Why use a Main Actor?

Setting a main actor provides two major benefits for gameplay engineering and level design:

1. Referencing in the Editor

When a prefab has a main actor, instances of that prefab can be assigned to component parameters that expect the main actor's type.

Example: Imagine you have a PressurePlate actor in your scene that has a property target of type DoorActor.

  • Without Main Actor: You cannot reference the SciFiSlidingDoor prefab instance in the target parameter because the engine sees it merely as a generic prefab or group.

  • With Main Actor: If the SciFiSlidingDoor prefab has its internal DoorActor actor set as the Main Actor, you can reference the SciFiSlidingDoor instance directly into the PressurePlate's target parameter. The engine resolves this reference to the internal DoorActor actor automatically.

2. Parameter Overrides

Parameters on the Main Actor become exposed on the prefab instance in the scene editor.

This allows level designers to tweak gameplay values (like OpenSpeed or Locked) directly on the prefab instance without needing to dig into the prefab hierarchy to find the specific logic actor.

How to set a Main Actor

  1. Open the prefab you want to edit.

  2. In the Outliner, find the actor that represents the core logic or identity of the prefab.

  3. Right-click the actor and select Set as Main Actor.

Unsetting

To remove the association, right-click the current Main Actor in the Outliner and select Unset Main Actor.

Last updated