API - All Accessible Events
Most of the Easy Grid Builder Pro 2 classes comes with useful events that you can easily subscribe to. In this part of the guide we will quickly go through all these events. However, for a deeper understanding and find out about all the Public Setter and Getter functions each class provide, It is highly recommended to go through the rest of the API documentation.
Events in Grid Manager Class
Here’s an example of demonstrating how to access and use one of the events in Grid Manager class:
using UnityEngine;
using SoulGames.EasyGridBuilderPro;
public class APIDocumentationClass : MonoBehaviour
{
private GridManager gridManager;
private void Start()
{
gridManager = GridManager.Instance;
// Subscribe to the OnActiveEasyGridBuilderProChanged event
gridManager.OnActiveEasyGridBuilderProChanged += OnActiveEasyGridBuilderProChanged;
}
private void OnDestroy()
{
// Unsubscribe from the OnActiveEasyGridBuilderProChanged event to prevent memory leaks
gridManager.OnActiveEasyGridBuilderProChanged -= OnActiveEasyGridBuilderProChanged;
}
/// Callback method triggered when the active EasyGridBuilderPro system changes
private void OnActiveEasyGridBuilderProChanged(EasyGridBuilderPro activeEasyGridBuilderProSystem)
{
// Example: Log the active EasyGridBuilderPro name to the console
Debug.Log($"Current Active EasyGridBuilderPro system is: {activeEasyGridBuilderProSystem.name}");
}
}On Active Easy Grid Builder Pro Changed
On Is Mouse Pointer On Grid Changed
On Active Camera Mode Changed
On Active Grid Mode Changed
On Active Buildable SO Changed
On Active Vertical Grid Changed
On Cell Object Value Changed
On Buildable Object Placed
On Buildable Object SO Added
On Buildable Object SO Removed
Internal Supporter Events
These events are used internally within the Easy Grid Builder Pro 2 grid systems. However, they are accessible if needed. Let’s quickly review these events.
Events in Easy Grid Builder Pro Class
Most of the key events have been relocated to the Grid Manager class for better accessibility and simplicity. The only exclusive event remaining in the Easy Grid Builder Pro class is the OnGridSystemCreated static event. This is how you access it:
On Grid System Created
Events in Buildable Object Destroyer Class
This class is responsible for destroying built objects on the grid. Below is an example of how to access one of its events:
On Buildable Object Destroyed
On Buildable Object Hover Enter
On Buildable Object Hover Exit
Events in Buildable Object Selector Class
This class is responsible for selecting built objects on the grid. Below is an example of how to access one of its events:
On Buildable Object Selected
On Buildable Object Deselected
On Buildable Object Hover Enter
On Buildable Object Hover Exit
Events in Buildable Object Mover Class
This class is responsible for moving built objects on the grid. Below is an example of how to access one of its events:
On Buildable Object Start Moving
On Buildable Object End Moving
On Buildable Object Hover Enter
On Buildable Object Hover Exit
Events in Grid Heat Map Manager Class
This class manages painting and reading values on grid heatmaps. Here's an example of how to access one of its events:
On Grid Heat Map Read All Values
On Grid Heat Map Read Value
Last updated