コード例 #1
0
 public static AssetBundleLoadingIndicator FindInstance()
 {
     if (_instance == null)
     {
         AssetBundleLoadingIndicator[] assetBundleLoadingIndicator = FindObjectsOfType(typeof(AssetBundleLoadingIndicator)) as AssetBundleLoadingIndicator[];
         if (assetBundleLoadingIndicator.Length > 0)
         {
             _instance = assetBundleLoadingIndicator[0];
             if (_instance.dontDestroyOnLoad)
             {
                 DontDestroyOnLoad(assetBundleLoadingIndicator[0].gameObject);
             }
         }
     }
     return(_instance);
 }
コード例 #2
0
 // Use this for initialization
 void Start()
 {
     if (_instance != null && _instance != this)
     {
         if (_instance.dontDestroyOnLoad)
         {
             Destroy(this.gameObject);
         }
         else
         {
             _instance = this;
         }
     }
     else
     {
         _instance = this;
         if (this.dontDestroyOnLoad)
         {
             DontDestroyOnLoad(this.gameObject);
         }
     }
 }