• 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
Question by Radetic · Feb 23, 2015 at 07:31 PM · uishaderguimaterial

Applying materials to the new UI elements (4.6)

Hello everyone,

I've been working with the new UI system and got myself a problem. In this specific project (standalone), whenever the user clicks any two spots in the screen, a ruler appears and the distance between points is given. The first version of this in game tool was made with procedural meshes, 3dText and a few other components. Now we think it's about time to migrate to the new UI.

When using a Canvas element with Render Mode set to World Space, the ruler itself is an image element and the measurement is presented as a text element, both as child objects to the canvas. After getting information from the mouse clicks, the canvas is positioned via script (so far, so good).

However, when there's an obstacle between the points, part of the ruler gets occluded. With a custom ShaderLabs shader applied to a material, it was possible to have a MeshRenderer always visible, but applying the material to UI elements doesn't seem to work.

Any ideas as to how can we keep a WorldSpace canvas always visible without needing a second camera to render only it's layer with clear flags "depth only"? How are shaders in materials applied to the new UI elements?

Thanks in advance

Comment

People who like this

0 Show 1
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 spiceboy9994 · Feb 23, 2015 at 11:39 PM 0
Share

Is that obstacle another UI Element or any game object provokes this behavior?, sometimes the issue is the order of the UI elements within the scene. The order on how the New UI are rendered is directly related to its order on the scene hierarchy. Try running the game and moving the rule game object (or its container) within the hierarchy to check if that helps.

1 Reply

  • Sort: 
avatar image
Best Answer

Answer by gfoot · Feb 24, 2015 at 03:10 AM

Check out DanSuperGP's answer here, and vote it up because it works like a charm:

http://answers.unity3d.com/questions/878667/world-space-canvas-on-top-of-everything.html

Comment
Radetic
DanSuperGP
oatssss
patrusfarr

People who like this

4 Show 0 · 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

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How to improve shader to render UI text correctly / DOF Cam / 0 Answers

GUI materials 3 Answers

Material doesn't have a color property '_Color' 4 Answers

How to Create Material Preview in Custom Editor 0 Answers

Set unity_GUIZTestMode in UI Shaders? 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