Search Issue Tracker
Won't Fix
Votes
1
Found in [Package]
1.1.10
Issue ID
ADDR-1293
Regression
No
[Addressables] Overriding Animation Controller fails when used on a Prefab which was instantiated from an Asset Bundle
How to reproduce:
1. Open the attached project
2. Open the repro scene ("MechArmsScene")
3. Build Player Content (using "Existing Build" mode)
4. Enter Play Mode
5. Press keyboard key "1" to load and override the animation
6. Press keyboard key "2" to start the animations
Expected results: The animations are overridden and played successfully
Actual results: The override fails and animations are reset to empty fields
Reproducible with: 2018.4.15f1, 2019.2.17f1, 2019.3.0f4, 2020.1.0a18
Reproducible with package version 1.1.10, 1.5.0
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
- Channel remapping dropdown in the Terrain Layer does not open when clicked on the title
- The Editor freezes indefinitely when a large number of elements are entered in the Subgraphs or Categories lists
- Some Visual Effects package Assets links to documentation are not working
- Heatmap asset’s documentation button in the Inspector window leads to “Sorry... that page seems to be missing!” page when clicked
- Crash on MonoBehaviour::CallMethodIfAvailable when performing various actions
Resolution Note:
the customer note about equal clips not being recognized as equal is correct. The issue is that the engine code that tracks animation overrides uses actual equality, but in this case, there are two identical animations built into the build. So even though the source asset was the same, the resulting asset is not. The workaround is to change the user code in AnimationClipOverrides.cs
adding this new method:
private AnimationClip GetMatchingClip(AnimationClip clip)
{
foreach (var clipPair in Controller.clips)
{
if (clipPair.originalClip.name == clip.name)
return clipPair.originalClip;
}
return clip;
}
provides a way to take a passed in clip, and find the clip on the current object that has a matching name. Then the [] operator in that same file becomes:
public AnimationClip this[AnimationClip clipKey]
{
get
{
AnimationClip val;
var clip = GetMatchingClip(clipKey);
_overridden.TryGetValue(clip, out val);
return val;
}
set
{
if (clipKey == null) {
Debug.LogError($"Trying to assign clip {value?.name} to null key.", Controller);
return;
}
var clip = GetMatchingClip(clipKey);
if (value == null) {
_overridden.Remove(clip);
} else {
_overridden[clip] = value;
}
}
}
With these changes, the game works.