Build fails because "Library\Bee\artifacts\....dag\Assembly-CSharp.dll failed to produce updates"???

error is:

“Script updater for Library\Bee\artifacts\someRandomnumber.dag\Assembly-CSharp.dll failed to produce updates.txt file”

and then throws some errors about not finding “Animations”, ‘AnimatorController’, ‘ChildAnimatorState’

what this could be? version is 2022.3.27f1

I will update the editor tomorrow maybe this version is broken.

nevermind the scripts logic is broken, it references stuff from the those classes are Editor only (really unity???) and then when you try to build it gets "ohh , whaaat? you want those scripts in your game?? let me start throwing unrelated errors about not being able to write a text file

Are you sure this is the ONLY error in the console you are getting?

If there’s an editor-only API being used in a script the build will fail with a corresponding “type or namespace not found” message.

Deleting the Library folder may also help.
(Make a backup just in case)

I’m writing all this maybe someone in the future has the same error and was trying the same setup. It doesn’t matter for the topic of the thread. it is some random error unity gives but it also gives some related errors. I didn’t used unity as intended so I this is not a bug just the feedback from unity that is not clear. so one can skip the text bellow if it one has anything better to do than read stuff on forums.

I needed to find out at runtime how long an animation is inside the Animation Controller WHEN the animation name is NOT THE SAME as the state name.

The idea is to have controllers on different prefabs that share the same state structure BUT the animations clips will be different for each prefab. These animations clips will also have different lengths.

Then by C# script I can ask the controller to play a state AND get the animation length using a few lines of code.

private AnimatorController animCtrl;
private ChildAnimatorState[] animatorStates;

animCtrl = animator.runtimeAnimatorController as AnimatorController;
animatorStates = runtimeAnimCtrl.layers[0].stateMachine.states;

I have only one layer inside the controller so I just need to get all the states from that layer.

After this just need to loop trough states and get the clip length from whatever state I need.

//when stateName is "Attack" for example
foreach (var state in animatorStates)
{
    if (state.state.name == stateName)
    {
        var stateClip = state.state.motion as AnimationClip;
                return stateClip.length;
    }
}

This off course works perfectly fine inside the editor but will not work at runtime because ChildAnimatorState and AnimatorController are part of UnityEditor.Animations

And will not work at runtime because the UnityEditor stuff is not included in the game

Ok so finally unity will try to build the project but because it finds these lines of code it fails the build. The error I’ve got about not being able to write a text file was misleading. It is offcourse a error on my side not paying attention of what libraries can be used or not.

For the solution on how to get the animation length at runtime I’m trying to find it right now but each I see is not “satisfactory”

First I could use the code in the editor to populate some list attached to a prefab that has all the clips names attached to each prefab. Which could work, maybe, but then I need to remember to run this script for each prefab I will have, I also don’t trust unity saving stuff in the editor because prefabs or scriptable objects will sometimes get their data wiped out at random by unity.

There is also manual way of attaching events to an animation timeline which will fire when the animation reaches that point BUT these will not let me know in advance WHEN this animation point will be reached to plan around this before the animation will start playing. So I can react when the animation will end but I will not know how long the animation is.

There are also Animator Behaviors with scripts attached to each state. I don’t know if it gives me the animation length

philosophically It is idiotic to do all these steps when the AnimationController should give me this info when I need it.

“How long is the animation attached to the state Attack?”

“It is 2.5 my lord.”

But nope, we can’t have that at runtime.

1 Like

I got the same error and your post helped me figure out the solution. I replaced all references to “AnimatorController” with “RuntimeAnimatorController” and also deleted any “using UnityEditor.Animations”

all still applies but since then revised the project to not depend of the animation length when controlling the game

this was intended for me to control a character animation and trying to asking unity for information was a bad idea.

so instead of trying to figure out how long the animation is by always asking how long an animation is which got me to all the problems above, I just don’t care about that and I’ve ended controlling the timing using a setup where you have a state machine pattern and then in each state I can decide when to get out of that state and when entering a new state I can change the animation.

This allowed me to find the quick “feel” of the character then after that I can tweak the animations to match the timing that feel good.

you can learn more about unity patterns in this book