我正在尝试制作一个改变GameObject纹理的GUI按钮......任何想法?
我制作了这段代码,但是球体变白了,它没有显示纹理
using UnityEngine;
using System.Collections;
namespace Vuforia
{
public class GUI_Button : MonoBehaviour
{
GameObject Pokeball;
Texture3D texture = (Texture3D) Resources.Load ("Resources/clouds1024");
private void OnGUI()
{
if (GUI.Button (new Rect (5, 15, 100, 25), "Pokeball")) {
Pokeball = GameObject.Find("Pokeball");
Pokeball.GetComponent<Renderer>().material.mainTexture = texture;
}
}
}
}