Description
The OnMapLoaded
property is an event handler that is invoked when a map has been successfully loaded in the MapInstance
component. This property allows you to define custom actions that should occur immediately after a map is loaded, such as initializing game elements or updating the user interface.
Usage
To use the OnMapLoaded
property, assign a method to it that matches the System.Action
delegate signature. This method will be called automatically when the map loading process is complete.
Example
// Example of using the OnMapLoaded property
MapInstance mapInstance = new MapInstance();
// Define a method to be called when the map is loaded
mapInstance.OnMapLoaded = () => {
// Custom logic to execute after the map is loaded
InitializeGameElements();
UpdateUI();
};
// Method to initialize game elements
void InitializeGameElements()
{
// Initialization logic here
}
// Method to update the user interface
void UpdateUI()
{
// UI update logic here
}