Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Tion-Gaming · Jun 28, 2015 at 06:44 PM · uitextclear

Make a text visable only through an object

Is it possable to make a UI text only able to be seen through a clear object and when it moves away you cant see the text any more?

Comment
Add comment · Show 2
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 fafase · Jun 29, 2015 at 11:55 AM 0
Share

What is a clear object? Is it a UI in world space or on screen? You would have to elaborate a little what you want to get.

avatar image Pangamini · Jun 29, 2015 at 12:04 PM 0
Share

As i understand, he might want to see some text in 3D space as if it was displayed on some sort of glass display. So the text is behind the glass, but it's "projected" on it... sort of like the display in the library of the movie The Time $$anonymous$$achine.. but i might be wrong :)

2 Replies

· Add your reply
  • Sort: 
avatar image
-1

Answer by KdRWaylander · Jun 29, 2015 at 11:27 AM

Hi,

What you can do is set a specific layer to your object, like "HiddenLayer", and make your camera not to see this particular layer. Whenever you have your object you want to see through in position or whatever event/trigger, you can change the layer of the text (e.g. set it back to default layer) so you will see it. When the object is out of position, you set back the text layer to the layer the camera(s) can't see !

http://docs.unity3d.com/ScriptReference/GameObject-layer.html

Comment
Add comment · Show 4 · 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 Pangamini · Jun 29, 2015 at 11:50 AM 0
Share

If toggling the object would be an option, it'd be much clearer to disable/enable object from camera render callbacks ins$$anonymous$$d of changing object layer.

avatar image KdRWaylander · Jun 29, 2015 at 12:06 PM 0
Share

That's a solution too indeed :)

avatar image Tion-Gaming · Jun 29, 2015 at 02:37 PM 0
Share

I dont want to toggle the object that would be easy

avatar image KdRWaylander · Jun 29, 2015 at 02:43 PM 0
Share

You're welcome :)

avatar image
0

Answer by Pangamini · Jun 29, 2015 at 11:53 AM

If toggling of object on and off is not an option (eg. you want to see part of the text and part occluded) you will need to play with shaders a bit. One option would be to play with stencil a bit, set it to some value where your "window" is, and then render the text with stencil check (so it's culled everywhere except for the "window"). If your window itself is a transparent object, you will need to render the text first (or last, as a result of transparent object depth sorting). In this case you have to render the window stencil separately as an opaque object, then render text and window as transparent objects (with text still doing the stencil check).

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 Tion-Gaming · Jun 29, 2015 at 02:36 PM 0
Share

Do you have any links that would better explain for example a tutorial because i didnt quite understand what you said

avatar image Pangamini · Jun 29, 2015 at 02:38 PM 0
Share

http://docs.unity3d.com/$$anonymous$$anual/SL-Stencil.html

avatar image Pangamini · Jul 01, 2015 at 11:27 AM 0
Share

BTW I just realized all of this can be done without a line of code, just use built-in Canvas to render your text and use $$anonymous$$ask to clip out the text to only be seen in your window/object

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

UI Text compression on android 1 Answer

Render Debug.Log as UI Text 2 Answers

What's your equivalent of old GUIStyle ? 0 Answers

Canvas is flipping, 2D game 0 Answers

Layout group children adjust to content 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