Unity Animation Plays In Preview But Not When Playing Game - animation

I made a simple animation for a sword gameobject to constantly slowly move up and down while the player character is standing still.
My sword has an Animator component attached:
The Animator Controller is also very simple, with this animation being attached to my default state:
The animation plays just fine in the preview mode of the Animation window. But when I run my game, the animation does not play at all, the sword just stands still instead of moving.
What is the cause of this problem?

I finally solved the problem. It turns out that all I needed to do was turn off "Apply Root Motion" on my Animator for it to work properly.

In case you are testing out on an Android Device I would suggest you to go to Build Settings > Player Settings > Other Settings > Uncheck "Static Batching". Build and deploy apk on your phone. Animations should work smoothly now.

Related

Cant edit animation once created in Unity?

Im having a very weird/frustrating problem, cant find anyone who's found a solution but I know I'm not the only one. After creating animations in unity, I'm unable to edit/change them. Only create new ones.
I have created an animation and attached the animation to a game object. The game object also has an animator attached, but I don't use it for running the animation. I run it by code.
I have tried clicking the game object and opening the animation window, double clicking the animation, opening animation, everything but all I get is:
I cant go back to one animation. How can I do this?
My inspector looks like

Unity Animations on HoloLens not working

I have created a HoloLens app using Unity 3D. In the app I want to show a text canvas with some animation on click of a button. I have done this with Animator control and script to open an Animation state on click of a button. This is working fine when I try on Unity Preview. However when I try the same app on HoloLens emulator or on device the animation doesn't work. The canvas opens up simply without any animation after some delay (I think delay of animation to be completed). This is not the case for Unity Game Preview.
Please let me know what else we do to support Animations made in Unity on HoloLens.
I have fixed the issue. Not sure what was the exact problem but the cube object was mashed off as added some components, which might not actually needed.
Freshly re-designing the cube and animations worked.

XCode, SpriteKit: How do you add buttons?

I've created a game using Sprite Kit. The game runs just like the iOS game Pop The Lock. I've already got a lot of code within my touches began. Because of this, whenever I try and add a Button to the scene and tell it to do something, all it does is start the game as I've told it to do that my touches began and it doesn't run what I tell it to. How do I add a image as a button that once I tap, it runs only that and not the other things in the touches began? I understand this is very broad but I'd like to see how people add buttons to the scene without affecting anything else. Cheers!

Unity: GUI button with event trigger as virtual control pad on Android phone

Let's say I have two GUI buttons with EventTrigger as virtual key. The expectation is whenever a button is pressed, the camera will rotate until the button is released.
At the beginning, I used the pointer Down and pointer up function. It works, but it extremely sensitive, the camera rotation didn't stop at the moment when I release my finger. I've solved this problem by using drag function (whenever dragging is detected, the camera stop rotating something like that).
However, there is still a bug that I couldn't solve, that is if I swipe the button instead of touch&release, the button doesn't release. eventually the camera just keep rotating until I touch the button again. I've tried all the event trigger function such as pointer exist, end drag etc.
I just want the touch input works as perfectly as the keyboard input.
This problem doesn't shown when I debugging on unity remote, only when I build it on my phone. So is that hardware issue? (I'm using mi3)
Thanks for having time to read my broken English.
I'm so sorry that I've asked a stupid question, since I'm still kind of beginner. The problem is somehow it didn't update when I installed it in my phone. It actually works fine.

How to make panorama start-up animation like default windows phone panorama app

I just wondering how to make panorama start-up animation like music+video or picture app. Notice the sliding 3d animation when we open music+video/picture/marketplace app.
When I create panorama project using VS 2010 Express, the animation is just from right to left.
How do i make that animation?
If I understand you correctly - take a look to Wp7 silverlight toolkit - page transitions
The animations are there, but if you have too many things running on the UI thread, the animation will be hard to see since loading will be choppy. To test this, just make a new page with a default panorama inside it and observe the animation while its empty. Zune app will always be faster, its run on native code from my understanding.

Resources