The scene has a lot of events that we can wire up. We will hook up to NodeAdded and NodeRemoved to determine when we need to send statistics information. Let's set this up by going through the following steps:
- In the WhackABox project, open the Game.cs file.
- In the Start() method, add the code that is highlighted in bold in the following code block:
protected override void Start()
{
scene = new Scene(Context);
scene.NodeAdded += (e) => SendStats();
scene.NodeRemoved += (e) => SendStats();
var octree = scene.CreateComponent<Octree>();
InitializeCamera();
InitializeLights();
InitializeRenderer();
Input.TouchEnd += OnTouchEnd;
InitializeAR();
}
Each time a node is either added or removed, a new message will be sent to the GUI.