问题
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 :
- Put your object in a specific layer (called MyLayerfor the sake of the example)
- Set the Culling maskof a new camera to render only this specific layer
- Uncheck the MyLayerin theCulling maskof your main camera in order to prevent the latter to render your model
- Set the Clear flagstoDepth onlyof the camera to prevent the latter from rendering the skybox
- Create a new Render texture in your project, and drag & drop it in the Render Texturefield of your new Camera
- Add a new Raw Image to your UI canvas and assign the render texture in the Texturefield
- Run your 3D animation
Your camera will render the animation into the image on your UI
来源:https://stackoverflow.com/questions/46889822/how-to-play-3d-animation-on-a-2d-canvas-in-unity