Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Last updated: May 30, 2023 21:40:52

Entity Linker

Table of contents

  1. Creating a new link
  2. Deleting a link
  3. Usage

TimberAPI adds a custom EntityLinker Monobehaviour class to all buildings in the game. The EntityLinker class can be used to link two entities with eachother. A new link creates a new instance of EntityLink which is stored in both the linker and linkees EntityLinks property.

var linker = gameObject.GetComponent<EntityLinker>();
var linkee = otherGameObject.GetComponent<EntityLinker>();
linker.CreateLink(linkee);
var linker = gameObject.GetComponent<EntityLinker>();
linker.DeleteLink(linker.EntityLinks.First());

Usage

The use of these links is left to the modder. See the EntityLinkerExample on the TimberAPI Examples for an example implementation.