I make a third persom game and one of the weapons is a rocket luncher that works like a sniper. To use that weapon, I need to click a key, aim with the keybord, and when I click on the same key again - the rocket fly to the enemy. When the sight works I should see only the sight's GUI texture and not the other gui textures and the drowen health/energy/progress (whatever) bars.
When I search in the forum I only found questions about making the zoom for the sniper but my question is different: How to activate the sight of the sniper, without zoom? I made a camera for the sight and the gui texture but I dont know how to activate it.
I asked the question before, I got a code but it don't works:
function Update ()
{
if (Input.GetKey ("p"))
{
GameObject.Find("Camera").GetComponent("Camera").active = false;
GameObject.Find("Sight").GetComponent("Sight").active = true;
//Change camera to the sight when you press P
}
}
When I use the code - the sight is work but I can't see nothing and I can't go back to the main camera.
Now for the real question: Can someone tell me how to create a sniper, without any zoom and other upgrades? (click a key, the sight works, aim with the keybord and not with the mouse, another click on the key - go back to the main camera and shoot).
Sorry for poor english as allways :)