Ignition / ObjectCounter

Namespace Playniax.Ignition

Inherits from MonoBehaviour

Script can be found in Assets/Playniax/Framework/Ignition/Scripts (MonoBehaviour)/ObjectCounter.cs

Class ObjectCounter

Description

The ObjectCounter keeps track of the number of GameObjects enabled in the scene.

In order for this to work you will need to add the ObjectCounter component to the GameObject that need to be included in the count.

Example can be found in Assets/Playniax/Framework/Ignition/Examples/01 - Framework/ObjectCounter.unity

Example script can be found in Assets/Playniax/Framework/Ignition/Examples/01 - Framework/Scripts (MonoBehaviour)/ObjectCounter_Example.cs
using UnityEngine; using UnityEngine.UI; using Playniax.Ignition; public class ObjectCounter_Example : MonoBehaviour { public Text text; void Awake() { if (text == null) text = GetComponent<Text>(); } void Update() { // Get and display the number of objects. text.text = ObjectCounter.count.ToString(); } }