How to play 3D animation on a 2D canvas in Unity

2020-03-27 11:09发布

问题:

I like to play animation on a Canvas.

I made a canvas as shown in the following image.

I like to play a golfer animation on the green color canvas. Is it possible?

I have animation model as shown in the second figure.

I like to play that golfer animation on the canvas. How can I do that? I drag and put under canvas as child object, it doesn't work.

回答1:

As I explained in my comment, I would do as follow :

  1. Put your object in a specific layer (called MyLayer for the sake of the example)
  2. Set the Culling mask of a new camera to render only this specific layer
  3. Uncheck the MyLayer in the Culling mask of your main camera in order to prevent the latter to render your model
  4. Set the Clear flags to Depth only of the camera to prevent the latter from rendering the skybox
  5. Create a new Render texture in your project, and drag & drop it in the Render Texture field of your new Camera
  6. Add a new Raw Image to your UI canvas and assign the render texture in the Texture field
  7. Run your 3D animation

Your camera will render the animation into the image on your UI