Unity学習メモ(3) - レイ、マルチスレッド、コルーチン、デリゲート

  1. Unity での光線と光線検出

https://blog.csdn.net/weixin_43147385/article/details/124179148

  1. マルチスレッド、コルーチン

private void Start()
    {
        Thread thread1 = new Thread(new ThreadStart(fun1));
        Thread thread2 = new Thread(new ThreadStart(fun2));
        Thread thread3 = new Thread(new ThreadStart(fun3));
        thread1.Start();
        thread2.Start();
        thread3.Start();
    }

    void fun1()
    {
        Debug.Log(1);
    }
    void fun2()
    {
        Debug.Log(2);
    }
    void fun3()
    {
        Debug.Log(3);
    }
public void Show(string name,JsonData jds)
    {
        gameObject.SetActive(true);
        this.name.text = name;
        this.desText.text = jds[0]["title"].ToString();
        //使用协程
        StartCoroutine(GetImage(jds[0]["item_cover"].ToString()));
    }
//定义协程
IEnumerator GetImage(string url)
    {
        WWW www = new WWW(url);
        yield return www;
        Sprite sprite = Sprite.Create(www.texture, new Rect(0, 0, www.texture.width, www.texture.height), Vector2.zero);
        this.image.sprite = sprite;
    }
  1. 任せる

https://learn.microsoft.com/zh-tw/dotnet/api/system.action-1?view=net-7.0

https://www.cnblogs.com/LipeiNet/p/4694225.html

おすすめ

転載: blog.csdn.net/ximi2231/article/details/129520139