I have an issue with the current build and run operation on a project I'm making, where the default animation of a "scene" animator wont play, while in the editor in the same build, it does play.
This question that has a related title doesnt apply for my issue.
Unity Default Animation Not Playing
Moreover, just after I check play on the editor to check if everything works properly, I press ctrl+b to build and run, and in-game this default animation wont play, for no apparent reason.
Everything is set properly, , the speed of the animation, the animator, etc; everything works well in the editor and inside the editor's game window, even the game's sounds run in the background. But for a reason I can't seem to find, it will not play in the build. I'm not affecting anything else than a image component to make this "scene"
animation.
Detail of the animation issue: The animation is just a sliding diagonally-rotated black image, occupying all the game screen, that gradually moves to the right until it cant be seen in the screen. For some reason, this is not playing, making the screen be pitch black.
Any ideas will help, the game is an exam.
Problem: I was using an animator override controller, in version 2019.2.17f1.
Looks like the animation override controller had unsolved bugs for that version that are not visible in the editor; or something may have got set incorrectly, despite my repeated checks on this simple animator window.
Solution: I attempted to switch back to the normal animator component just to test, and everything works perfectly as intended; the animation plays.
Any comments/critiques regarding the problem/solution are very much welcome
Related
I have a 3D game, and I added a trigger that loads the next level with a small animation when the player goes through it. It all works fine in Unity editor, but when I build the game it does not load the next level, neither it shows the animation. Any ideas what could be wrong? Thank you!
Hard to say without more detail, but in general it boils down to one of two things. Either the trigger is not firing, or there's a problem with the script.
Try attaching something else to the trigger, maybe something that will enable a disabled GameObject in a position that would be visible when you're hitting this trigger. If that doesn't show up, that tells you the problem is with the trigger.
Otherwise, you have a script issue. The most likely cause is that you're trying to load a scene that isn't listed in the project's Build Settings. Double-check that the scene for the level you're loading is in there, or it won't get built into the project. If the call to LoadScene/LoadSceneAsync is in your script before the call that is running the animation, then if it errors out due to the scene not being available, it would never reach the point where it plays the animation, which would explain what you're seeing.
I tried to transition into a scene with a fade in/fade out animation. Basically just changing the alpha value of an Image.
As reference: I followed the tutorial of Brackeys here https://www.youtube.com/watch?v=CE9VOZivb3I - However it did not work for me.
So I tried to do step one which is blending into a scene when started on my own.
I set up a SceneLoader with an Image:
I animated the alpha value change for a StartScene animation and added the Controller to the Canvas:
The Animator looks as following:
It worked a few times but stopped working suddenly. I'm pretty sure I did not change settings of the object.
When I prefabed it and put it on other scenes, it also did not work accordingly.
I have multiple UI Elements in my scenes, so I put the SceneLoader at the very bottom of the Hierarchy.
Any idea what I'm doing wrong here?
I suggest you not to use the canvas but the panel instead. You can create 3 animations in the panel, one for fading in, one for fading out, and one for idle ( with transparent panel). Once you have done this you can set the fade-in for the first state and add a transition for the idle one without conditions with "Has exit time" with the duration of your animation. Then you can set a transition from idle to fade-out with a trigger. In the code, you will simply animator.SetTrigger(fading); and it should work like that. Remember to uncheck the loop in fading animations and check it in the idle one.
I'm trying to play sprite animation in unity, it is playing but when ut is playing the animation is flickering
How to solve this issue
I had a sprite animation on layer 0 placed on top of a background sprite image and got the flickering as well.
Change the sprite "order in layer" property to 1 (and leave your background sprite set to "order in layer" zero.
Flashing went away.
I had same problem. I fixed mine by adjusting the sorting layer. The flickering is caused by overlapping sprite.
So, your post came up in the searches. I was having a similar issue. For me, the animation would play, but there was a couple of bad frames/sprites that would be there as far as 'in' the animation, but they just weren't showing on screen. I could click on the frame image and it would show, but during animation it would disappear, causing the flashes.
But, by having the pop-out animation window open that can play frame by frame, I could figure out where the flash was. (Again, everything appears correct. Double-checked that it was set up the same as all others.) If you also watch the inspector window with the object selected, you can see the name of each animation frame as it goes by. So I did the frame-by-frame and saw that in two spots it said 'Sprite Missing'.
I figured they were just corrupted so I deleted them. But, the problem was still there (indicating that it wasn't an image issue.) Surprisingly though, when I tried dragging just those two images back in, everything worked fine. Who knows why 🤷♂️
Anyway, mine at least was a simple fixed once I kind of figured out where the issue was at. so, hopefully this might help someone else out at some point.
Hi my idle animation is not working as intended. When the character is idling, it slowly moves out of place. I checked that the movement is not caused by the script.
It seems to be related to physics because when I turned on kinematics and turned off the character's collider the idle animation did not cause the character to drift. I scoured the web for similar problems, and can only think that my problem has to do with movement caused by the animation itself.
When I imported the animation from Blender I checked 'Baked Animation'. In Unity I also set 'Root Node' to None for the imported animations. From what I read, setting root node makes the animation interact with its surroundings (and move) whereas baked means the animation is purely visual. However, none of this solves the problem of the drifting idle animation. I am running out of ideas and would really appreciate your help.
I could manually freeze the position via script, but this seems like a workaround. Interestingly, when I first enter game view and the idle animation plays there is no drifting. However, after exiting a walking animation and playing the idle animation again I see the drifting behavior.
Looks like you just need to uncheck 'Apply root motion' in animation import settings (in the inspector when you clicked on animtion file).
Root motion is the main reason why a 3d model moves away from its pivot without the help of a script. uncheck it from the import settings.
I am trying to make a loading animation while using LoadLevelAsync to load the next scene.
The loading animation is a loading circle that continuously rotates in the middle of the screen, and I use LoadLevelAsync("NextScene") in the code. The problem is that every time right before the scene switch happens the circle will freeze for a few milliseconds before the next scene appears.
I do know that the less things the next scene contains, the shorter the freeze is, but I thought that LoadLevelAsync's purpose was for letting the user experience no lag during scene transitions. My next scene contains a background sprite, some buttons, scripts, and a 3MB audio file. The screen will always freeze for half a second before showing the next scene.
I am using Unity 4.6.3 with Pro feature. I'm also testing the results on a device. I have also tried out the AsyncOperation.allowSceneActivation with Coroutines, and unfortunately they don't work.
If anyone has a solution, or has any suggestions on smooth scene transitions, I would greatly appreciate them.
Thanks in advance.