public void Start() { ui = UIManager.Instance; var r = new System.Random(); name = GetRandomName(ref r); _coll = GetComponent<SphereCollider>(); _cam = Camera.allCameras[0]; VStart(); }
void Awake() { _instance = this; // Initialise C# things _objects = _objects ?? (_objects = new Dictionary<string, RectTransform>()); _canvas = _canvas ?? (FindObjectOfType<Canvas>()); _icons = _icons ?? (_icons = new Dictionary<string, Sprite>()); _quickPops = _quickPops ?? (_quickPops = new Queue<QuickPopScript>()); //Obtain icons var iconArr = Resources.LoadAll<Sprite>("UI/sprites"); for (int i = 0; i < iconArr.Length; i++) { _icons.Add(iconArr[i].name, iconArr[i]); } var uiResources = Resources.LoadAll<GameObject>("UI"); for (int i = 0; i < uiResources.Length; i++) { _objects.Add(uiResources[i].name, uiResources[i].GetComponent<RectTransform>()); } }