- Home /
Animate Objects in UI
Hi.
I would like to animate an object (not an UI object) in my UI. It is a 3D Model which I want to rotate around, instead of just standing still.
RenderTextures seemed to be a good thing, but appearently it's not possible to display the object without it's background.
So my other idea was to create a spritesheet for the animation (which is pretty logical, since it is only for UI).
So I would like to know, is there a better way to do this? And if not, is it possible to create a spritesheet from my animation / object with unity, or do I have to do this manually?
3d object in UI can be animated pretty much as you can do in your game. Using a special sprite sheet animation seems unnecessary.
Answer by Eudaimonium · Apr 01, 2016 at 11:22 AM
Set your Canvas as Screen Space with a Camera.
Set your 3D object in the same layer as the camera. It'll show up on the UI.
Screen space -Camera doesn't seem possible to me. I want to use this for a HUD in a third person view. With Screen Space - Camera, some objects are closer to the camera than the UI itself, thus overlapping it.
It's not world space - the HUD canvas is not actually within reasonable scope of your scene. In my screenshots, the first shot is of the HUD canvas - as you can see it's far out of bounds of the scene, but it will still render over everything that the main camera captured.
Simply make a new camera and assign that to the canvas, don't use your actual main camera. Then on the new camera, make sure to assign: Clear: Depth only
I used my main camera for the HUD, that was my problem. Thank you, works!