Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Created November 8, 2017 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tsubaki/d59af36d887d216b4bf1151470ed0694 to your computer and use it in GitHub Desktop.
Save tsubaki/d59af36d887d216b4bf1151470ed0694 to your computer and use it in GitHub Desktop.
ランダムに値を変えるStateMachineBehaviour
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RandomBehaviour : StateMachineBehaviour
{
int hashRandom = Animator.StringToHash("random");
override public void OnStateMachineEnter(Animator animator, int stateMachinePathHash)
{
animator.SetInteger(hashRandom, Random.Range (0, 4));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment