• 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 TheShinx93 · Nov 16, 2014 at 01:39 AM · c#imagebackground

help for the background image

Hello everyone I have a problem I can not solve I almost put a background image in a guibox, so that (using special script and running) will resize according to the screen resolution used. I tried to do so:

 public Texture2D Wallpaper;
 
 void Start () 
 {
 Wallpaper = Resources.Load ("Wallpaper/image1") as Texture2D;
 }
 
 void OnGUI()
 {
 GUI.Box(new Rect(0,0,Screen.width,Screen.height),Wallpaper);
 }

but the result is this ...

alt text

I tried it with GUILayout.box but the 'image is slightly shifted from the coordinates x=0 and y=0 and largest of the game screen ...

 public Texture2D Wallpaper;
     
 void Start () 
 {
 Wallpaper = Resources.Load ("Wallpaper/image1") as Texture2D;
 }
     
 void OnGUI()
 {
 GUILayout.Box(Wallpaper);
 }

alt text

I'm shooting for hours, but I found it on anything that can help me ... how can I do?

PS: sorry for my english

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

0 Replies

· Add your reply
  • Sort: 

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

how to make the camera straigth when following my object ??? 2 Answers

Object reference not set to an instance of an object (Raycast) 1 Answer

Distribute terrain in zones 3 Answers

for Loops c# 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges