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
2
Question by headkit · May 11, 2010 at 01:39 PM · guiguitexturelayout

Layouts with GUITextures

Hi there!

I want to create a GUI with GUIText and GUITexture. I created a simple pad in photoshop and made it to a GUITexture. Now I want to chane its width by code, it has to get the width of the screen. I also want to place GUIText always 5 Pixel left from the roght upper corner.

How could I achieve that? THX!

Comment
Add comment · 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 headkit · Jun 11, 2010 at 07:21 AM 0
Share

the important part of my question was how to place the GUI element allways 5 pixels left from the left upper corner, independent from the screen size.

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by qJake · May 11, 2010 at 04:36 PM

You don't want to use GUIText and GUITexture as they're somewhat "outdated" (I use that term loosely).

The thing you should be looking at instead is the relatively-new Unity GUI, specifically, GUI.Texture, and GUI.Label.

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
avatar image
0

Answer by khalil · Jun 09, 2010 at 10:16 PM

You could also just create buttons and windows to your liking with each texture and then independently render them on GUI. You actually get a much better look to your GUI if you do things this way. You don't need Skins.

First in your scene create an empty game object, then attach this script to it..

in Java.

<<>>

var icon: Texture2D; //this is your texture.

function OnGUI(){
GUI.Button(Rect(10,10,100,100),GUIContent(icon)));

} //this creates a variable space in the inspector where you drag and drop your texture.

<<>>

Attach this script to your empty object, and you are done without using skins.

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 qJake · Jun 09, 2010 at 10:29 PM 0
Share
  1. He means "UnityScript" aka Javascript, not Java. -- 2. Please format your code when posting it, by hilighting it and clicking the "Code Format" button in the toolbar.

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

No one has followed this question yet.

Related Questions

Reduce Draw call for Multiple GUI Textures with same Texture 1 Answer

How will i get animated gif images in scene? 6 Answers

GUI texture touch input problem 1 Answer

Why GUI doesn't appear? 1 Answer

Scaling a guitexture hierarchy and maintaining layout in code 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