Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by rbazzi · Jan 19, 2017 at 07:57 PM · unity 5cameracanvasuser interface3d models

Canvas is hiding my 3D model, can I place the model in front of the canvas?

So I have a Canvas with several elements on it and a 3D model (robot) which is not part of the canvas.

There is one camera in the scene so far and it is pointing at the robot. So when I run the game, it looks something like this (I have replaced the actual model with Unity objects for now):

alt text

The canvas render mode is set to "Screen Space - Overlay".

Here's the problem, I am using a panel for the background and its alpha is set to 0 which is why you can see the model in the picture. However, as soon as I add a background, the model disappears and sits behind the canvas like in this picturealt text

So now I am wondering if I should be using a second camera or if there is a way around it.

What do you guys think?

ui2.png (454.6 kB)
ui.png (119.5 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by James2Games · Jan 19, 2017 at 08:45 PM

In situations like this I like to use multiple cameras to separate the layers of what we can see. For this I would use 1 camera for the UI and 1 for the model and controls the background.

Another option is to use a third camera for the background in case you want to add things that can only be seen in the background and can mean you can change the background to what you like without effecting the model or UI.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image rbazzi · Jan 19, 2017 at 10:34 PM 0
Share

Thank you for the reply.

Quick question, what do you mean when you saud "and controls the background"?

Another thing, the main camera is assigned to the robot and the new camera is assigned to the Canvas. How do you blend both worlds together in this case? Do you have to control the depth of the cameras? Are there layers I need to switch on/off? A hierarchy of some sort?

Thanks again!

avatar image James2Games rbazzi · Jan 19, 2017 at 11:50 PM 1
Share

A way to think of it is what the 3 cameras would represent how the world is presented.

The ui camera shows what happens in front of the model. The model camera only shows the model and only the model. The background camera shows what happens behind the model. So when you change what the background camera sees. It will change what is seen behind the model.

It's tedius to setup and understand at first but afterwards it gets easier.

Ui camera -

Set depth to 3

Set clearing type to 'don't clear'

$$anonymous$$odel camera

Depth = 2

Clearing type = don't clear

Background camera

Depth = 1

Clearing type = sky or solid color

Extending this so you don't get the model viewed multiple times or the background looking funky. You can change the culling on the camers to render certain layers. Example ui camera should only have the ui tag set.

Edit:

The '$$anonymous$$ain Camera' tag is only used when trying to find a camera via code. Camera.main looks for a camera with the '$$anonymous$$ain Camera' tag and returns that.

So the way you have it set up is the main camera is the model camera in my description above

The order of cameras in the hierarchy doesn't effect how they are seen in-game. That's all done through the Cameras options.

avatar image rbazzi James2Games · Jan 20, 2017 at 01:11 AM 0
Share

Thank you for the answer. I will try it out and get back to you!

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

The camera doesn't match with canvas 1 Answer

How to Adjust Size of objects/Camera's size for different resolutions 1 Answer

How to render canvas with screen space - camera on top of canvas with screen space - overlay? 2 Answers

I can't see my button in Game View! 3 Answers

Why use different Canvas Render Modes 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges