public static void Flash(string prefabLocationAndName, float duration = 0.1f, Sprite sprite = null, Color? color = null, bool forceReloadPrefab = false) { if(Prefab == null || forceReloadPrefab) { Prefab = Resources.Load<GameObject>(prefabLocationAndName); } if(Self == null || forceReloadPrefab) { if(Self != null) { Destroy(Self.gameObject);//remove previous one } var flashObject = GameObject.Instantiate(Prefab); Self = flashObject.GetComponent<CameraBorderFlasher>(); } Self.Setup(duration, sprite, color); }
public static void Flash(string prefabLocationAndName, float duration = 0.1f, Sprite sprite = null, Color?color = null, bool forceReloadPrefab = false) { if (Prefab == null || forceReloadPrefab) { Prefab = Resources.Load <GameObject>(prefabLocationAndName); } if (Self == null || forceReloadPrefab) { if (Self != null) { Destroy(Self.gameObject);//remove previous one } var flashObject = GameObject.Instantiate(Prefab); Self = flashObject.GetComponent <CameraBorderFlasher>(); } Self.Setup(duration, sprite, color); }