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 SirGive · Dec 28, 2011 at 03:04 PM · androidguiguitexture

Unity GUI with Android

I'm adjusting GUI for a finished app for Android, and the previous developer used Unity's GUI. I'm adjusting the ratio's for position and scale; however, the relations are not the same on the build as what I assign in the inspector. Does Unity Android have an extremely bugged out version of the GUI? (Using GUITexture). I'm just wondering if anyone else has used this and gotten correct proportional placement by setting the position and pixel inset.

I really don't want to re-do the system.

EDIT:

Using Unity's GUITexture:

alt text

The problem with this specific texture is that it is pushed off screen when deployed to android.

Comment
Add comment · Show 4
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 SirGive · Dec 28, 2011 at 05:38 PM 0
Share

Any reply?

avatar image jahroy · Dec 28, 2011 at 06:07 PM 0
Share

I don't understand the question.

What do you mean when you say "adjusting the ratio's for position and scale."

If you want to scale your GUI, you need to scale the rectangles used to draw the controls in your code.

We use Unity's GUI to build resolution independent GUIs for $$anonymous$$ac, Windows, Web, iOS, and Android. We've never had any issues with Android.

avatar image SirGive · Dec 29, 2011 at 01:11 PM 0
Share

using Unity's GUITexture components. The elements are static, so I don't modify size or scale through code.

I've used Unity's GUI through code, but UIToolkit works much better for me. I'll be going that route if adjusting the position (from a value from 0~1 considering position is based off of screen size) doesn't work.

avatar image SirGive · Dec 29, 2011 at 02:58 PM 0
Share

Bumpity. No direct answer? I'm just curious as to whether using only GUITexture is possible to correctly position textures on different devices

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by SirGive · Dec 30, 2011 at 02:40 PM

From what I can tell, basic placement with GUITexture doesn't keep its relative position when building to Android. I don't know if this is a bug or what, but the best solution I can find is to place GUI elements through code and position them with ratio's based off of the screen height and width.

So if anyone else has this problem, then yes:

  • You are going to need to re-do the system using code.

Comment
Add comment · Show 2 · 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 cmauceri · Jan 13, 2012 at 01:52 PM 0
Share

I'm having some problems with GUITextures on Android as well, and I was wondering if it might be related. When you were having trouble with placement, did you also experience that the GUITexture.HitTest() function returned weirdly offset positions?

avatar image SirGive · Jan 23, 2012 at 01:07 PM 1
Share

Yes, that was the exact same problem that I was having. I ended up using UIToolkit and completely redo-ing the system from scratch

avatar image
0

Answer by ina · Dec 29, 2011 at 01:22 PM

Taking a guess at your question...

1) The default GUI Skin may be setting some unexpected offset and size differences. Workaround: create a new gui skin, set all the borders, etc to 0.

2) Some things are in screen resolution coordinates and other things are reduced to a 0 to 1, where 0 is either the leftmost or topmost, and 1 the respective extreme

Comment
Add comment · Show 2 · 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 SirGive · Dec 29, 2011 at 01:25 PM 0
Share

Thanks, I'll try that. and the 0's are intentional as well as the 1's. Top left corner, with a constrained 50x50 texture. Then move the the texture down 50 pixels. This would snap it to the top left, which works in the editor. Not in deployment.

avatar image SirGive · Dec 29, 2011 at 01:32 PM 0
Share

I fear that creating a new gui skin won't be much of an effective workaround. I'm not using any scripts for the texture creation or positioning, just Unity's built in GUITexture.

That is unless there is a way to access the default gui skin that is used by Unity (as I'm having quite some trouble finding it).

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

7 People are following this question.

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

Related Questions

Android Resolution Problem 1 Answer

GUITexture with Sphere Collider 2 Answers

GUITexture and GUIText on android 2 Answers

Android tablet 10.1 and guiTexture gui placement with unity 0 Answers

Unity 2d mobile android GUI texture button 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