I want to know if it’s possible to change an in game GUITexture with Texture2D using JavaScript or if there’s a simpler/more efficient way to do this.
An example of what I’m trying to do is replace a blue circle GUITexture with a red circle that is a Texture2D in the script.
Example code…
//this is purely an example...
var circle01 = GUITexture; //blue circle
var circle02 = Texture2D; //red circle
function Start() {
//circle01 to change to circle02 here!
}
As I said, that code is purely an example to see if it will work…
Don’t worry, I just solved it, and I am aware that Texture2D is an asset.
//This is an example to save me from posting a huge script...
var baseCircle : GUITexture; //a black circle
var circle01 : Texture2D; //a blue circle
var circle02 : Texture2D; //a red circle
var circle03 : Texture2D; //a green circle
function OnGUI () {
baseCircle.texture = circle01;
}