EntityLinkManager getting started - junkdog/artemis-odb GitHub Wiki
Managed entity references
Setup
- Register
EntityLinkManager.classwith the World/WorldConfiguration. - (Recommended) Setup artemis-odb-plugin to avoid slow reflection calls.
Usage
Components with fields referencing other entities are managed automatically.
@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).