Created
February 8, 2022 07:50
-
-
Save farukcan/c2e9104d7802d9d3fc72fb8b9333c93a to your computer and use it in GitHub Desktop.
Run static function when unity game is loaded
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a non-MonoBehaviour class which displays | |
// messages when a game is loaded. | |
using UnityEngine; | |
class MyClass | |
{ | |
[RuntimeInitializeOnLoadMethod] | |
static void OnRuntimeMethodLoad() | |
{ | |
Debug.Log("After Scene is loaded and game is running"); | |
} | |
[RuntimeInitializeOnLoadMethod] | |
static void OnSecondRuntimeMethodLoad() | |
{ | |
Debug.Log("SecondMethod After Scene is loaded and game is running."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment