Search Issue Tracker

Fixed in Unity 5.4.0

Votes

32

Found in

4.5.2f1

Issue ID

624764

Regression

No

Overridden virtual functions cannot be used as Animation events

Animation

-

-

Priority: 7Not yet prioritized for a release

-

Severity: 3Secondary functionality broken

To Reproduce:

1.Write an overridden virtual function just like Event4() in Arrow.cs and ArrowBase.cs, in the attached project.

2. Create a new event on the ScaleUp animation, which is being played on the Arrow object, notice that 'Event4' which overrides a virtual function cannot be used as an event handler (Event1 & 2 from the same script work fine).

3. It's possible to workaround this by first assigning the function in the event and then changing in to an overridden virtual function (as Event3 in this case) and it seems to work fine.

Repro: 4.3.4f1, 4.5.2p2, 5.0.0a19

Comments (11)

  1. 1e442121883893bd67d7810e5223dd65?d=mm

    UDN_99df3bc5-2caf-4681-b933-918de8e0ff74

    Aug 05, 2016 07:43

    is it fixed yet??? come on unity...

  2. Bc2fcf2c41abbf2a47ccdaf7ebd0d04b?d=mm

    Denggoon

    Nov 13, 2015 03:13

    STILL HASN'T FIXED THIS YET!?!?! C'MON UNITY........ WHAT A LAME

  3. 5135d51118e2f936cba394c4ea8d1e2c?d=mm

    Peaj

    Nov 12, 2015 13:32

    Ok I was wrong. Does not work because the base type method will be called instead of the derived one.

  4. 5135d51118e2f936cba394c4ea8d1e2c?d=mm

    Peaj

    Nov 12, 2015 10:19

    Overriding did not work for me (in UI Events). Even the overriden methods wont show up.
    I found a workaround to have a non virtual method in the base class that calls the virtual method.
    Its just som kind of wrapper and you can forget about it in the derived types.

  5. 70e773b73a617b1e73a1050e8f147c22?d=mm

    MiguelJD23

    Jul 07, 2015 15:09

    I'll be trying this workaround because it's REALLY annoying to break all the OO we had so much work on doing T_T

  6. 4d30c5f676e9e3441483f17ce7dd35c5?d=mm

    Thromshall

    Jun 30, 2015 01:44

    Just ran into this one... super annoying. Please fix asap.

  7. D748093f708010d2abc30e5825d27a77?d=mm

    Trungdv

    Jun 16, 2015 16:14

    This bug is really really annoying. Hope they will fix it soon.

  8. 2a0df41d197707bcf0563ad153471656?d=mm

    rndrobin

    Jun 10, 2015 19:13

    We just rewrite the functions in the derived classes and reuse the base functions.

    Base class:
    public virtual void DoAnimationEvent()
    {
    }

    Derived class:
    public override void DoAnimationEvent()
    {
    base.DoAnimationEvent();
    }

  9. Bcd5a04e36be67c06da49dddcbd54770?d=mm

    Sarseth

    May 12, 2015 20:21

    How long can we wait for such a simple issue?

  10. A81f63f99f2b34e33b919c6203327358?d=mm

    phasiclabs

    Apr 23, 2015 16:02

    Another workaround is to use another function that can be selected, then modify the anim file in a text editor to use the correct function (assuming you serialize assets as text).

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.