Skip to main content
Bumped by Community user

Does unityUnity animation event send a message to every object which ownowns it?

first of all, sorry for my english.

I made game objectobjects A, B. andAnd each has animtoranimator, and it has the same animation. andAnd they are inherited class of Base class.

iI trigger animation on A object, and the animation has callback and invoke it when the animation endends. theThe callback setsets bool value true.

myMy expectation was, the callback will only change bool value in A. butBut bool value in B was changed. itIs this natural?

 public class BaseClass
    {
        public bool triggered;
    }

    public class A : BaseClass
    {
        public void OnAnimEnd()
        {
            triggered = true;
        }
    }

    public class B : BaseClass
    {
        public void OnAnimEnd()
        {
            triggered = true;
        }
    }

Does unity animation event send message to every object which own it?

first of all, sorry for my english.

I made game object A, B. and each has animtor, and it has same animation. and they are inherited class of Base class.

i trigger animation on A object, and the animation has callback and invoke it when the animation end. the callback set bool value true.

my expectation was, the callback will only change bool value in A. but bool value in B was changed. it this natural?

 public class BaseClass
    {
        public bool triggered;
    }

    public class A : BaseClass
    {
        public void OnAnimEnd()
        {
            triggered = true;
        }
    }

    public class B : BaseClass
    {
        public void OnAnimEnd()
        {
            triggered = true;
        }
    }

Does Unity animation event send a message to every object which owns it?

I made game objects A, B. And each has animator, and it has the same animation. And they are inherited class of Base class.

I trigger animation on A object, and the animation has callback and invoke it when the animation ends. The callback sets bool value true.

My expectation was, the callback will only change bool value in A. But bool value in B was changed. Is this natural?

public class BaseClass
{
    public bool triggered;
}

public class A : BaseClass
{
    public void OnAnimEnd()
    {
        triggered = true;
    }
}

public class B : BaseClass
{
    public void OnAnimEnd()
    {
        triggered = true;
    }
}
Bumped by Community user
Source Link
Hree
  • 125
  • 8

Does unity animation event send message to every object which own it?

first of all, sorry for my english.

I made game object A, B. and each has animtor, and it has same animation. and they are inherited class of Base class.

i trigger animation on A object, and the animation has callback and invoke it when the animation end. the callback set bool value true.

my expectation was, the callback will only change bool value in A. but bool value in B was changed. it this natural?

 public class BaseClass
    {
        public bool triggered;
    }

    public class A : BaseClass
    {
        public void OnAnimEnd()
        {
            triggered = true;
        }
    }

    public class B : BaseClass
    {
        public void OnAnimEnd()
        {
            triggered = true;
        }
    }