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 Jeroen_ · Apr 18, 2016 at 02:30 PM · androidandroid buildz-axis

Positioning on Z-axis messed up in Android build

(Aaaaagh, I just typed this whole question and then I signed in and lost all the text. Really frustrating.)

I have a scene with a Background quad (Z = 0) which is darkgrey, and a parent GameOver Screen with some sprites which makes up a Game Over screen. (Also some other GO's, but they aren't relevant)

To toggle the GameOver screen, I simply change the Z value of it to hide it behind the Background quad if I don't need it. In the editor with the Standalone as platform, it is working fine and I have no problems whatsoever. However, if I change the platform to Android, the GameOver screen appears in front of the Background, see this image:

zaxisproblem

This is also the case if I deactivate all the scripts, and it was also the case when I wrote a script attached to the GameOver screen which said:

void Update () { transform.position = new Vector3(0, 0, 20); }

The GameOver screen appears in front of the background, while it shouldn't. What is causing this?

zaxisproblem.jpg (190.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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by M-Hanssen · Apr 18, 2016 at 02:36 PM

Changing Z positions is into the way to build UI's in Unity.

At least not when using Camera render mode in you Canvas.

In default Canvas renderMode the Z order as you describe it, is simply controlled by the order inside the hierarchy. Try to move background below GameOver screen :-)

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 Jeroen_ · Apr 18, 2016 at 08:28 PM 0
Share

Thanks for your answer. However, changing the order inside the hierarchy didn't help. Also it might be worth noting that the GameOver Screen isn't a canvas, it's just an empty GameObject with sprite Objects as children.

I solved the Game Over screen problem by simply positioning it at x = 15; y = 15 to keep it out of the way. However, I ran into a different problem which is that two spheres - the objects controlled by the player - should appear in front of some obstacle quads. They do in the editor when I run it.

However, they do not appear in front of the obstacles on my Android device. They will appear behind some of the obstacle quads (they are prefabs, but I checked that they have the same Z value), while still in front of others.

I'm sure that I could figure it out somehow if I knew what was causing this, but I don't actually know. On the editor, everything works as normal, but on the Android device, only some objects appear behind others. Do you have any idea, or should I post this in a seperate question?

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Unity2D quads not appearing in front of other quads in Android build 1 Answer

Android app: app icon appears in game screen; please help!!! 0 Answers

How to define which Android API level should I target for Minimum and Target? 1 Answer

Android build not working properly 0 Answers

How to port game on android wear ? 2 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