Add Dynamic Texture2D

Dynamic Texture2D in UnityUI

Create Texture2D and assign image to it through a script

//需要在最上级Asset folder下建一个Resources folder,然后里面放要dynamic attach的texture

using
UnityEngine; using System.Collections; public class TearApartControl : MonoBehaviour { public Texture2D handCursor; // Use this for initialization void Start () { { handCursor = (Texture2D)Resources.Load("HandIcon"); } } }

原文地址:https://www.cnblogs.com/shawnzxx/p/2880817.html