Downloads

← Back Basic 3D example (Code generation)

About Code Generation

We use code generation in this example (and we strongly recommend you to use it too). The long story short - instead of using basic API like this entity.Set("gold", entity.Get<int>("gold") +1)); code generation allows you to use code like this entity.gold=entity.gold+1;. As you can see code generation provides huge benefit, you can learn more about code generation here .

To distinct database fields from normal fields we use f_, m_ or d_ field prefixes in the examples below. We use 2 types of code generation (for illustrative purpose), each prefix correspond to code generation type:

  1. BGE_ClassName and f_FieldName - Extension classes (instead of creating basic BGEntity class, the database populated with classes, which inherited from BGEntity and have all additional properties for all fields)
  2. BGM_ClassName and m_FieldName - MonoBehaviour generated classes (generated classes extends from MonoBehaviour and can be attached to GameObject)
← Back to Downloads