In a scenario as core as possible to my problem, I have a sphere colored with the Shader Editor hovering in my scene that either goes onto the floor below or into the nearby wall, animated in Pose Mode and separated with the Dope Sheet. I want to keyframe the color to change from red to green with the floor animation and keyframe from red to blue if it's the wall animation.
The problem is the fact that the Shader Editor's keyframes appear to be "global" instead of tied to the Pose Mode animations. In the below picture, the sphere has already been keyframed to turn green at the floor. It works as intended.
Changing to the wall animation in the Dope Sheet, the sphere now goes towards the wall. The color still changes to green, so I go to the Shader Editor and keyframe the color to be blue instead.
Finally, returning to the "floor" animation in the Dope Sheet, the sphere goes back to the floor animation, but its color still turns blue. I can keyframe it to green again, but then it'll be green yet again on the "wall" animation.
If the context helps, I'm exporting the rig with these animations into a game engine, so it can't be fixed on a per-render basis, both need to be possible at the same time. Any fixes or alternatives?