AddonsHandler.cs 485 B

123456789101112131415161718192021222324
  1. using UnityEngine;
  2. public class AddonsHandler : MonoBehaviour
  3. {
  4. [SerializeField]
  5. private GameObject _addons;
  6. private static AddonsHandler _instance;
  7. // Use this for initialization
  8. internal void Start () {
  9. if (_instance)
  10. {
  11. Destroy(gameObject);
  12. }
  13. else
  14. {
  15. _instance = this;
  16. var obj = (GameObject)Instantiate(_addons);
  17. obj.transform.parent = transform;
  18. DontDestroyOnLoad(gameObject);
  19. }
  20. }
  21. }