Creating actor classes
Actors are implemented as classes in you project's code.
Creating a new actor class
The actor class is defined in a .ts
file in your code. A convention is to place these in the folder src/actors
. In the code below, we have a basic starting point for an actor.
This is all you need if you only intend to spawn the actor through you game.
Making actors available in the Hology Editor
In addition to defining your class, you need to export it. This is done in the index.ts
file. If this is not done, the editor will not be able to find your actor class.
Creating an actor class from the editor
An easier way to create the starting code for an actor is to do it through the editor. It will generate code for you with a given actor class name. Click the Add new button in the asset browser and select Actor class.
Hot reloading
The editor will monitor your code to find any new actor classes that can be instantiated as actor instance in your scenes. Also, if the actor code changes, actors in in your scene will be refreshed to reflect any visual changes.
Last updated