get_enabled can only be called from the main thread

        ExecuteMain.Execute (   delegate() {
            StartUI.SetActive( false ) ;
            PrepareUI.SetActive( true ) ;
            lbList.text = str ;
        });

 

 

 

using UnityEngine;
using System.Collections.Generic;
using System.Collections;
using System ;
public class ExecuteMain : MonoBehaviour {

	List<Action>  funcs ;
	public static ExecuteMain  instance ;
	// Use this for initialization
	void Start () {
		instance = this;
		funcs = new List<Action> ();
	}
	
	// Update is called once per frame
	void Update () {
		if (funcs.Count > 0) {
			for( int i = funcs.Count-1 ; i >= 0 ; i --)
			{
				funcs[i]() ;
				funcs.Remove( funcs[i]) ;
			}
		}
	}


	public void  Add(  Action   func)
	{
		funcs.Add (func);
	}

	public static void  Execute(   Action   func)
	{
		instance.Add (func);
	}
}

 

相关文章:

  • 2021-04-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-21
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-16
  • 2022-12-23
  • 2021-05-24
  • 2022-12-23
  • 2023-03-10
相关资源
相似解决方案