Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ManagerBridge : ScriptableObject
- {
- public Manager instance { get; set }
- }
- class ManagerUser : MonoBehaviour
- {
- public ManagerBridge manager; // filled in automatically in Unity
- public void Update()
- {
- if(manager.instance != null)
- manager.DoSomething();
- }
- }
- public class Manager : MonoBehaviour
- {
- public ManagerBridge bridge;
- public void Awake() // called when the manager is created by Unity
- {
- bridge.instance = this;
- }
- public void DoSomething() { }
- }
Add Comment
Please, Sign In to add comment