liveBook · Manning

Logic data

As explained in High Performance Unity Game Development

Data representing the state and rules of a game's simulation independently of its visual representation.

A pooled enemy’s visibility is not the same as whether it exists in the simulation. Keep its state in logic data, separate from the GameObject used to display it. This lets saves, server-side checks, and balance tests use simulation data without relying on visuals. section 3.3.4

For enemies, EnemyData stores position, direction, velocity, and an Alive flag in arrays. Spawning finds an unused slot and marks it alive; removing an enemy clears that flag and deactivates its GameObject. When unpausing, reactivate only enemies marked alive. section 3.3.4

Listing 3.12 Our EnemyData class with the alive boolean array
public class EnemyData
{
    public int NumEnemies;
    public Vector2[] Position;
    public Vector2[] Direction;
    public float[] Velocity;
    public bool[] Alive;
}

EnemyData holds simulation values and alive state without storing the visual GameObject pool. section 3.3.4

How High Performance Unity Game Development covers it

How deep it goes
Defines EnemyData arrays and demonstrates spawning, removal, and pause handling, while deferring fuller treatment of the separation.
Examples
Uses pooled enemies with position, direction, velocity, and alive arrays, plus spawn, remove, and pause operations.
What you can do after
Apply separate alive state and visual activation when managing pooled enemies.
How it connects
Connects object pooling with game saving, server-side simulation, and game-balance testing.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of High Performance Unity Game Development. The section links point to the parts of the book it draws on.