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 /
  • Help Room /
avatar image
0
Question by haruhi4 · Jul 07, 2016 at 02:43 PM · textlayerslayerpopup

How to work with Text component on multiple layers (one layer per popup)?

I'm creating a game on Unity. In my game, there a popup for each screen(i don't want to create lots of scenes). To create a popup, i do the following:

  • create a new layer for it, go to "edit layers... -> sorting layers" and add my new layer on a position that's after my last screen

  • Create a new canvas gameobject on the project. It's render mode is "screen space -camera" and sorting layer is my new popup layer and it's order in layer is 0

  • Create an empty gameobject inside my new layer(Let's call it EMPTYGAMEOBJECT) and put a sprite renderer on it. It's sorting layer is my new layer and it's order in layer is 0

  • Create all other gameobjects that should be in the popup and put them inside EMPTYGAMEOBJECT(just drag them to EMPTYGAMEOBJECT on the gui). Then, for each gameobject i put a sprite renderer on it, still at the same layer but now the order in layer is 1(or maybe 2, if some object is supposed to be above other)

  • When i want the popup to appear, i call a function that brings EMPTYGAMEOBJECT(and therefore all gameobjects inside him) back to it's original position. When i don't want the popup to appear, i call a function that moves EMPTYGAMEOBJECT(and therefore all gameobjects inside him) to a far far place on the screen


  • This method is working fine with simple gameobjects, but i'm currently having problems with text. I treat him like any other gameobject that should be inside EMPTYGAMEOBJECT, i even give him a sprite render althrough he already have a canvas renderer which i can't remove. Sometimes, the text appears normally, but other times, the text isn't showing anything. It looks like it's below all things or something.

  • My brother asked me to build a new canvas for the text. I did, and made the canvas on the same layer as the EMPTYGAMEOBJECT canvas but in a higher order(like, order in layer = 1). Still didn't work.

  • How do i treat text if i create my popups on different layers?

obs: I have discovered that sometimes the text doesn't appear because it's order in layer is not the other object + 1, but sometimes even changing the order seems like it doesn't do anything

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
0

Answer by haruhi4 · Jul 07, 2016 at 04:56 PM

I fixed it by doing these things: - The text was too small. I enlarged the area of the text(strangely, if the area is too small, even when the text is small it won't appear) - Moved the Text gameobject to a new canvas - Made the canvas which had the Text object have an order in layer that's larger than my old canvas with all the gameobjects except the text - Finally: made sure that some gameobjects from inside "my old canvas with all the gameobjects except the text" be reduced on order in layer(on the sprite renderer) - obs: Text doesn't need sprite renderer

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

59 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

Related Questions

Multiple interior collision spaces/pocket collision dimensions. 1 Answer

How to make UI elements behind game objects without using World Space Canavas 0 Answers

Prefab changes the layer automatically (how do I stop it?) 0 Answers

Ignore Raycast not working properly? 0 Answers

Animator Layers Bug - Can't change layer position 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