How can I make this work. I have set up 4 states in animator default being idle.
I want the clicks to only work on this object…not on the others in the scene.
So I figured TAGS?
Please point me in the right direction.
Thank you.
Here’s my code.
using UnityEngine;
using System.Collections;
public class A_BlueFishScript : MonoBehaviour
{
private Animator animator;
private int State = 0;
void Start ()
{
animator = this.GetComponent<Animator>();
animator.SetInteger ("State", 0);
}
void Update ()
{
if (Input.GetMouseButtonDown(0) && gameObject.tag == "A_BlueFish")
Debug.Log("Pressed left click for Rotate.");
animator.SetInteger ("State", 1);
if (Input.GetMouseButtonDown(1) && gameObject.tag == "A_BlueFish" )
Debug.Log("Pressed right click for Zoom.");
animator.SetInteger ("State", 2);
if (Input.GetMouseButtonDown(2) && gameObject.tag == "A_BlueFish")
Debug.Log("Pressed middle click for Move.");
animator.SetInteger ("State", 3);
}
}