Skip to content

EntityLinkManager getting started

Daan van Yperen edited this page Sep 24, 2016 · 4 revisions

Managed entity references

Setup

  1. Register EntityLinkManager.class with the World/WorldConfiguration.
  2. (Recommended) Setup artemis-odb-plugin to avoid slow reflection calls.

Usage

Components with fields referencing other entities will be automatically managed.

@PooledWeaver
public class Anchor extends Component {
    @EntityId public int target = -1; // managed
    public Entity target2; // managed
}

Set target and target2 like you would normally. Whenever the entity referenced by target is removed it will automatically be set to -1 (or null for Entity).

Clone this wiki locally