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
1
Question by nakanotatuma · May 17, 2018 at 12:08 AM · uiculling mask

Camera Culling Mask for UI Elements not working

Hello, I am trying to use culling mask for UI elements that are in world space. I have a layer named "360" and I want to use culling mask to render only UI elements that are in "360" layer. It seems like culling mask are all ignored for UI... Does anybody know how to fix this? Thank you in advance,

Edit: I haven't solved this problem yet but I founded out odd thing. Even I assigned a different layer to the UI object, culling mask works as UI. Although the layer was not "UI" layer when I checked the script...

alt text

unity-201741f1-personal-64bit-mainunity-so-0542-ps.png (52.3 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

4 Replies

· Add your reply
  • Sort: 
avatar image
4

Answer by sisse008 · Sep 16, 2019 at 11:56 AM

I know this is old but it took me a while to figure it out and there's really nothing on this any where I looked. So if you change the layer of a certain UI element and set a camera's culling mask to render only that layer, it wont work. The layer of the canvas (parent of the UI element) will determine if you see the children (ALL the UI elements) or not.

a work around it to add the "Canvas" component to the UI elements with the unique layer.

Comment
Add comment · 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
3

Answer by auhfel · Dec 01, 2019 at 06:43 PM

I thought this was a bug for a while but it is not. Yes, the culling layers do not work on any UI if that UI is on a canvas that is marked 'Screen Space Overlay'. They do not work because of how screen space overlays(SSO's) work. With SSO what happens is this -- The camera decides what to render based on it's culling layers, then renders it to the screen. Then, the UI is drawn and overlaid upon the screen (hence the name Screen Space Overlay). So, the UI doesn't even exist in the camera's rendering system, and the camera's sorting layers wouldn't matter for SSO Canvas UI because it simply doesn't exist until after that camera has been rendered.

This can be solved by marking the canvas "Screen Space - Camera". This is functionally different than SSO, as now any image effects and antialiasing and whatnot will affect the UI if it exists on the Camera, and also the UI now is a plane with some distance between it and the camera.. so if you set that distance too high, game objects will be drawn over the UI if they are closer.

Anyways, there you have it. It's actually not a bug because of how it is designed, and here's how you can fix it. Change the canvas it is on to 'Screen Space - Camera', set the camera, and tweak the plane distance to something preferable (probably a value that is just a tiny fraction larger than the camera's near plane, so it doesn't z-fight with the camera near plane but still renders over everything else) and now you can use layers.

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 JoeJoe · Dec 14, 2019 at 01:24 AM 0
Share

Thanks for the insight auhful. This was driving me bats.

avatar image nolwenn_bigoin · Dec 18, 2019 at 11:18 AM 0
Share

I have my Canvas Render$$anonymous$$ode set to ScreenSpace - Camera, a camera with Culling $$anonymous$$ask as RenderCamera, but it doesnt' work. The only layer that the camera will cull correctly is the one of the root Canvas GameObject (tried on 2019.1.9 and 2019.2.5).

avatar image Alejandro-Martinez-Chacin · Dec 23, 2019 at 04:06 AM 1
Share

@nolwenn_bigoin Correct. For an UI in Screen Space - Camera mode, the camera culls based on ONLY the Canvas’s layer at least on 2019.1 and 2019.2 and not a fully fledged functional layer system like it seems to be implied on the answer. What was answered only was that SS-Overlay doesn’t allow the use of layers (there’s no camera interface to do the culling) and that SS-Camera does allow the use of layers. However the limitation is still there... changing the layer of canvas’s child UI element to a supposedly invisible one to the camera will still result in that UI element to be visible.

avatar image
0

Answer by JonPQ · May 17, 2018 at 12:19 AM

Its not ignored, but for Ui with a parent object that has a 'Canvas' component, look at the Canvas component, check the "Sorting layer" setting on that component. Also check on the same component, variable "Render Camera" make sure that it is set to the Camera that you are rendering with.

Comment
Add comment · Show 1 · 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 nakanotatuma · May 23, 2018 at 09:24 PM 0
Share

Thank you for your answer. I believe sorting layer is not same layer system as the layer system that used in culling for cameras. If you are talking about "Event Camera", I already set up.

Culling working for other objects but not for any UI Object. Such as gameobjects that have Text or Image component. I want to use culling for those UI object. Does anybody know how to fix this?

avatar image
0

Answer by Alejandro-Martinez-Chacin · Oct 29, 2019 at 03:07 PM

Just stumbled upon this same issue. Culling layers do not work on Canvas's children elements, the camera will only cull the layers based on the base 'Canvas' object's layer. Is this the expected/designed behavior?

Comment
Add comment · 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

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

145 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Second UI camera only works when I refresh Clear Flags setting 1 Answer

Canvas layer overrides child layer in light culling mask - Expected behavior? 0 Answers

I can't hide a RawImagen in a camera view 1 Answer

UI with layer always displaying 0 Answers

How can you hide Canvas objects using Camera Culling Mask? 1 Answer


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