Skip to main content

For Developers

This page intends to give a brief summary of how you may programmatically extend the Flox package


The AbstractBoidManager class is the base abstract class for interacting with Flox.

This class contains the bare minimum for setting up a BoidManager. Simply inherit from this class and fill out a few methods to create your own overriding BoidManager with your own behaviour.

Take CPUBoidManager2D implementation for example:

public class CPUBoidManager2D : AbstractBoidManager
private BoidData2D[] boidData;

protected override int ComputeBufferSize => BoidData2D.Size;

protected override void InitializeBoidData()

public struct BoidData2D : IBoidData
public Vector2 position { get; set; }
public Vector2 forward { get; set; }
public Vector2 raySteer { get; set; }
public float steering { get; set; }

public static int Size => (sizeof(float) * 2 * 3) + sizeof(float);

To successfully implement a BoidManager the following need to be implemented:

  1. ComputeBufferSize - Getter for compute buffer size. This should be the sizeof your data.
  2. InitializeBoidData() - This is called after Awake() and should contain any custom initialization code.
  3. Update(), FixedUpdate() or equivalent - Once initialized, you should put any custom logic in your Update (or equivalent) function. This logic should handle the functionality of your Boids, for example, movement updates and collisions.