resource.load上来一张贴图就行。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Start() {
		GameObject go = GameObject.CreatePrimitive(PrimitiveType.Cube);
		go.renderer.material.mainTexture = Resources.Load("glass", typeof(Texture2D));
	}
}

  详细可参看:unity圣典 “Resources 资源”、“Resources.Load 加载”相关篇幅介绍。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-29
  • 2021-08-05
  • 2022-12-23
猜你喜欢
  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
  • 2021-08-26
  • 2022-12-23
  • 2021-06-21
相关资源
相似解决方案