- Home /
Crosshair Fade on Zoom
Hello, I'm working on a FPS survival game, and I want to make a Zoom function were I use Field of View with a Weapon-Zoom animation. But how would I fade away the crosshair one MouseDown? Also why won't my animations work?
//attach this script to the object you want the animations to play on when
//clicking the Left mouse button.
//Remember the name of your animations!
function Update ()
{
if (Input.GetButtonDown("Fire1"))
{
animation.CrossFade ("Shot");
}
else if (Input.GetButtonDown("Fire2"))
{
animation.CrossFade ("Zoom_In");
}
else
{
animation.CrossFade ("Idle");
}
}
Does your object have the Idle, Zoom_In, and Shot animations attached to it?
What is the crosshair? Is it a plane with a material on it? Is it made with Unity's OnGUI? Or is it something else?
Yes I do have the animations attached to it, and I'm trying to make a iron sight ins$$anonymous$$d.
Your answer
Follow this Question
Related Questions
Shooting with a locked camera position 1 Answer
Zooming part of the screen without Render to texture 2 Answers
Different crosshairs for different weapons ? 2 Answers
(Easy question)What am I doing wrong making my cross hair transparent? 1 Answer
How to change the sensitivity on right click (when zoomed in) 2 Answers