//This method calls the custom firebase object when the object is initialised void Awake() { // Setting up the reference. GameObject FireBase = GameObject.Find("Canvas"); item = FireBase.GetComponent <CustomFirebase>(); }
//This method finds the instance of custom firebase private void Awake() { // Setting up the reference. GameObject FireBase = GameObject.Find("Canvas"); item = FireBase.GetComponent <CustomFirebase>(); if (instance == null) { instance = this; } else if (instance != null) { Debug.Log("Instance already exists, destroying object!"); Destroy(this); } }