Data Container

  

Data Container

This component is used to define custom properties for an entity. This is a dynamic object so properties can be added during runtime or in editor. This component is used heavily to build your game.

%STEP_TITLE%

This is pretty straight forward. Click the add button to add a new property. Double click on the name field to name the property, give it a type, and a value. You will see this component used in various tutorials to create things like dynamic list or when spawning a new entity you can copy a data components properties to the newly spawned entity. It is a good practice to set all of your changeable properties on a Data container and then pull values from it using property reference on other components. Doing it this way will provide a lot more flexibility.


Code Sample

var entity : IEntity = PBE.allocateEntity();

var props : DataComponent = new DataComponent();
props.playerName = "Player 1";
props.currentTime = 0;
props.collectedCoins = 10;
entity.addComponent(props, "Properties");

Follow Us For Updates