enum MouseState {Left, Right, Middle}
public class PlayerManager : MonoBehaviour
{
void Update ()
{
if(Input.GetButtonDown(MouseState.Left))
{
Debug.Log("Left Clicked");
}
}
I am using enum for the first time. Here the value of enum variables shhould be Left =0, Right =1, Middle =2.
But when I am writing Input.GetButtonDown(MouseState.Left) it gives an error saying that cannot convert ‘MouseButton’ expression to type string.
From what I have learned MouseState.Left should be = 0.
Am I Wrong? Is there any other solution for this?
And in addition it should be Input.GetMouseButtonDown because Input.GetButtonDown only takes a string parameter and it should be the name of a virtual input defined in the inputmanager.
– Bunny83Oh and btw: When you use <a href="http://docs.unity3d.com/Documentation/ScriptReference/Input.GetKeyDown.html">Input.GetKeyDown</a> you can use [Keycode.Mouse0][1] up to [Keycode.Mouse6][2] [1]: http://docs.unity3d.com/Documentation/ScriptReference/KeyCode.Mouse0.html [2]: http://docs.unity3d.com/Documentation/ScriptReference/KeyCode.Mouse6.html
– Bunny83Thanks for your answer.... it helped me a lot
– united4lifeMark it as correct if it is so.
– Chronos-L