- Home /
Question by
SteamIDHere · Feb 23, 2014 at 09:58 AM ·
cameraguiguitexturedisplay
Displaying multiple GUITextures On One Camera
Within my game scenario I am collecting items placed around the world. When the player collides with the item, it gets destroyed and a HUD should appear on the screen indicating the type of item they just collected. However, I cannot seem to display any, yet alone multiple GUITextures on the screen when the player collides with the item.
I currently have this script which is attached to the MainCamera of the FirstPersonController:
public var compassHUD:GUITexture;
public var torchHUD:GUITexture;
public var gunHUD:GUITexture;
public var compassTexture:Texture2D;
public var torchTexture:Texture2D;
public var gunTexture:Texture2D;
function Start() {
compassHUD.enabled = false;
torchHUD.enabled = false;
gunHUD.enabled = false;
}
function Update () {
if(!String.IsNullOrEmpty(rotatePrefab.collisionObj)){
switch(rotatePrefab.collisionObj){
case "compass":
Debug.Log("Compass ENABLED");
guiTexture.texture = compassTexture;
compassHUD.texture = compassTexture;
compassHUD.enabled = true;
break;
case "gun":
Debug.Log("Gun ENABLED");
guiTexture.texture = gunTexture;
gunHUD.texture = gunTexture;
gunHUD.enabled = true;
break;
case "torch":
Debug.Log("Torch ENABLED");
guiTexture.texture = torchTexture;
torchHUD.texture = torchTexture;
torchHUD.enabled = true;
break;
}
rotatePrefab.collisionObj = null;
}
}
Comment