ZoeAppClass/Assets/Scripts/Games/Image_FakeStart_Control.cs

39 lines
857 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Image_FakeStart_Control : MonoBehaviour
{
public string resourceName; public bool isImage;
// Start is called before the first frame update
void Start()
{
StartCoroutine(waitForResources());
}
IEnumerator waitForResources()
{
yield return new WaitForEndOfFrame();
GamesResourcesFinder finder = GamesResourcesFinder.instance;
while (!finder.gameReady)
{
yield return new WaitForEndOfFrame();
}
FakeStart();
yield break;
}
void FakeStart()
{
if (isImage)
{
Image img = GetComponent<Image>();
img.sprite = GamesResourcesFinder.instance.AskForImage(resourceName);
}
}
}