Search Issue Tracker
Fixed in 5.4.0
Votes
32
Found in
4.5.2f1
Issue ID
624764
Regression
No
Overridden virtual functions cannot be used as Animation events
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
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
UDN_99df3bc5-2caf-4681-b933-918de8e0ff74
Aug 05, 2016 07:43
is it fixed yet??? come on unity...
Denggoon
Nov 13, 2015 03:13
STILL HASN'T FIXED THIS YET!?!?! C'MON UNITY........ WHAT A LAME
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.
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.
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
Thromshall
Jun 30, 2015 01:44
Just ran into this one... super annoying. Please fix asap.
Trungdv
Jun 16, 2015 16:14
This bug is really really annoying. Hope they will fix it soon.
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();
}
Sarseth
May 12, 2015 20:21
How long can we wait for such a simple issue?
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).