Unity Animator Problem

Discuss issues pertaining to the various game/web runtimes of Creature here.
Post Reply
SiThu
Posts: 2
Joined: Mon May 21, 2018 10:29 am

Unity Animator Problem

Post by SiThu » Mon May 21, 2018 10:48 am

Hi, I just testing Creature for our new 2d game. But i have one problem using with Animator in Unity. It doesn't change animation stage and stuck in animation stage set on CreatureRendener(scripts) --> Animation.

And I got this error,

"NullReferenceException: Object reference not set to an instance of an object
CreatureStateMachineBehavior.OnStateEnter (UnityEngine.Animator animator, AnimatorStateInfo stateInfo, Int32 layerIndex) (at Assets/Distro/CreatureStateMachineBehavior.cs:20)"

There are no other scripts in the unity project, just playing with demos and stuck in there :cry: Is there any thing i missed?

chong
Posts: 891
Joined: Thu Feb 19, 2015 2:21 am

Re: Unity Animator Problem

Post by chong » Tue May 22, 2018 12:54 am

Hello,

I just checked with a test case using MecAnim and it seems to be running fine.
The error seems to indicate that some reference to an object is null. What is null in this case?
If you run this in Visual Studio, what does the inspector say during debugging? Which variable/property is null?

SiThu
Posts: 2
Joined: Mon May 21, 2018 10:29 am

Re: Unity Animator Problem

Post by SiThu » Fri May 25, 2018 4:39 am

Sry Chong, i miss placed the animator to creature renderer instead of creature game controller. Now everything is Ok and i delete my old testing projects and Nullreference error gone too :D . Just want to ask one question, How can i change the speed of the animation stage? I just tried with local time scale and all the of animation stage speed change. I want to change the speed of the animation stage individually. :?

chong
Posts: 891
Joined: Thu Feb 19, 2015 2:21 am

Re: Unity Animator Problem

Post by chong » Fri May 25, 2018 5:03 am

Hello,

There is no support in the Unity plugin UI yet, but you can modify the code to do this:
https://github.com/kestrelm/Creature_Un ... eModule.cs

Look at the function:

Code: Select all

private void IncreAutoBlendRunTimes(float delta_in)

In it, it increments the animation runtime ( frame ) for each blended animation. You can easily adapt this to have a custom increment delta time based on your animation name.

Post Reply