I’ve tried looking at docs, but it only gives examples in javascript. I have an int called “currentState” which is equal to 1. I want to set this variable though an Animation Event, but I don’t understand how. This is what I’ve tried (doesn’t work):
using UnityEngine;
using System.Collections;
public class cubeState : MonoBehaviour {
public int currentState = 1;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
Debug.Log(currentstate); //only displays 1, even though I set "2" in animation event
}
//I call animationState function from the Animation Event with value of "2"
public int animationState(int currentState ){
return currentState ;
}
void animationStateReset(){
currentState = 1;
}
}