godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.71k stars 20.12k forks source link

Godot 4.2 can't find nodes that exist in the AnimationPlayer. #85598

Closed TheFoxKnocks closed 2 months ago

TheFoxKnocks commented 9 months ago

Godot version

v4.2.stable.official [46dc27791]

System information

Godot v4.2.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3080 (NVIDIA; 31.0.15.3623) - 12th Gen Intel(R) Core(TM) i9-12900KF (24 Threads)

Issue description

When transitioning my project from 4.1 to 4.2, my console is now spammed with errors like this:

get_node: Node not found "EnemyAppear:frame" (relative to "/root/level1d/Entities/EnemySlime")

_update_caches: AnimationMixer: 'Spawning/appear', couldn't resolve track: 'EnemyAppear:frame'.

The issue here is that the animation still plays just fine in-game. It also plays just fine in the editor. What it's complaining about not being able to find is not only there, but being used, so why is it complaining?

Context: The enemy (EnemySlime) is created in a scene (level1d) on the Entities layer. When being created, it plays an animation regarding it spawning in. This is where it's having a problem.

animframe

Yet it exists as it did in 4.1, it plays properly, everything works. What do I need to do to appease it?

Steps to reproduce

Unsure.

Minimal reproduction project

N/A

samuelware commented 9 months ago

I'm experiencing a similar problem. although I didn't import a pre-existing project into 4.2. I created my animations and they worked, and at some point I ended up deleting my AnimationPlayer's and recreating them in the same scene. The animations still work, but I'm getting similar errors, but with old node paths (that don't exist anymore). I think the old AnimationPlayer details could be lingering in the scene file, leading to the error.

EDIT: This is not a consistent error. It fixed itself when I closed and re-opened my project.

TokageItLab commented 9 months ago

Related by https://github.com/godotengine/godot/issues/85316

TheFoxKnocks commented 9 months ago

Issue persists with 4.2.1, though I don't know if the goal was to have it fixed that soon to begin with. Wanted to mention it is all.

Datiel124 commented 8 months ago

Definitely still persists with 4.2.1, Not sure if theres a fix?

chamons commented 7 months ago

I've tried to reproduce it in a smaller project and have failed.

I can share privately shared a moderate sized project that reproduces it 100% of the time (many times in a row) if that is helpful.

GGalizzi commented 7 months ago

Here's a minimal repro project, though unlike the OP, the animation does not play at all - v4.2.1.stable.official [b09f793f5]

Animation plays if I do it through animation player editor in-editor. But play project and you'll see the errors popup when the animation attempts to play.

AnimPlayerIssue.zip

E 0:00:03:0930   get_node: Node not found: "StatUI/increase:visible" (relative to "/root/Control").
  <C++ Error>    Method/function failed. Returning: nullptr
  <C++ Source>   scene/main/node.cpp:1638 @ get_node()
E 0:00:03:0930   _update_caches: AnimationMixer: 'pop', couldn't resolve track:  'StatUI/increase:visible'.
  <C++ Source>   scene/animation/animation_mixer.cpp:635 @ _update_caches()

edit: Fixes itself after I delete the AnimationPlayer node and recreate it (along with the animation)

TheFoxKnocks commented 7 months ago

This just spammed my console so hard it ran memory usage up to over 9,000MB and basically crashed my editor and most certainly totally lagged out the game I was playtesting. Seems like this issue can also happen live. Any news on when this might be fixed? Using 4.3dev2, so doesn't seem like it's going to be fixed there, either.

OmarRinaz commented 6 months ago

Here's a minimal repro project, though unlike the OP, the animation does not play at all - v4.2.1.stable.official [b09f793]

Animation plays if I do it through animation player editor in-editor. But play project and you'll see the errors popup when the animation attempts to play.

AnimPlayerIssue.zip

E 0:00:03:0930   get_node: Node not found: "StatUI/increase:visible" (relative to "/root/Control").
  <C++ Error>    Method/function failed. Returning: nullptr
  <C++ Source>   scene/main/node.cpp:1638 @ get_node()
E 0:00:03:0930   _update_caches: AnimationMixer: 'pop', couldn't resolve track:  'StatUI/increase:visible'.
  <C++ Source>   scene/animation/animation_mixer.cpp:635 @ _update_caches()

edit: Fixes itself after I delete the AnimationPlayer node and recreate it (along with the animation)

At first, I deleted the nodes that were missing on the animations so the track wouldn't pop up any errors, but this didn't fix the 3d animations and skeletons, so I tried to rebuild everything, and no more errors.

What I had to do was delete everything, and build it from scratch, animation imports, skeleton profiles, animation libraries, and animation players and it took out the errors, it seems that the retargeting wasn't working... or something weird happened jumping versions, from 4.1 to 4.2 is when it started popping like crazy.

joshuaandrewhoffman commented 4 months ago

The issue persists with 4.2.2 -- It seems the same for me as other commenters:

I tried poking at it with some basic things like:

Unless there's something cached somewhere that I couldn't find, I don't know of any other way to fix this besides deleting all of the animations and remaking them, as Omar suggests above.

akien-mga commented 4 months ago

@TokageItLab Did #86608 solve this issue for 4.3 by any chance? If so, should it be cherry-picked?

TokageItLab commented 4 months ago

Did https://github.com/godotengine/godot/pull/86608 solve this issue for 4.3 by any chance?

@akien-mga Yes, and probably cherry-pickable with https://github.com/godotengine/godot/pull/88557.

TokageItLab commented 2 months ago

Close as it should be fixed in 4.3.

sabslikesobs commented 2 weeks ago

I ran into this today in 4.3. Isn't there some better solution than "turn off the warnings?" Is the issue really closed with that as the fix?

TokageItLab commented 2 weeks ago

@sabslikesobs image

sabslikesobs commented 2 weeks ago

Yes, I know of the setting to turn off the warnings. What I mean is: do you consider "turn off the warnings" to be a long-term solution for the cache corruption issues?

TokageItLab commented 2 weeks ago

If the cache is actually corrupt and have a problem in-game, that is a different problem and you can send a new issue with MRP. What is reported here is a problem that is not really a problem in the game; It is fine just to disable the warning.

I know there are cases where there is a similar problem where you set a resource in AnimationMixer and try to change the value of that resource in the same frame and the path is not found, but it depends on the order of the Tracks that are cached first. If there is a ResetAnimation, it depends on the order of the Tracks in the ResetAnimation.

In that case, changing the order of the tracks would also solve the problem, but also you can handle update order in some extent with setting CallbackModeDiscrete to Recessive or Dominant, and set the track that sets the resource to Discrete and the others to Continuous (and set InterpolationType to Nearest if the track is originally Discrete).

sabslikesobs commented 2 weeks ago

Okay, so Godot can randomly fuck up any user's animations for mysterious reasons, incur a frustrating debugging session, and the permanent solution is to turn off the warnings that Godot's fuckup generates, thus losing whatever value the warnings had. Good to know.

For anyone discovering this thread since they want to fix the underlying problem instead of silencing the warnings -- I think I was able to clear out the issue by deleting the .godot folder in the project directory (hence why I was talking about a cache). On Windows, there is also more cache data in %APPDATA%/godot, but I don't think it was related to this at all.

TokageItLab commented 2 weeks ago

Since the cache in .godot should have nothing to do with the cache that AnimationMixer dynamically generates, I would expect that it is actually the importer that is the problem in your case.

As a hypothesis, is it possible that the loading order of resources for updated classes has been changed due to version changes, and that these resources are loaded after Animation? If this is the case, there is nothing we can do to fix it on the animation side. Then, you should send another issue: “The import order of .godot is changed before and after the update".

FYI, the main reason there is no warning prior to 4.1 is because the check was not actually present in AnimationPlayer.