Jump to content
  • Advertisement
Sign in to follow this  
povilaslt2

Unity Compiling

This topic is 2642 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,i want to ask how to fix this issue.When i compiled game and opened game my all GUITextures, GUI and GUIText is scattered through all screen... This is image of issue:

unledwcr.png

Share this post


Link to post
Share on other sites
Advertisement
I imagine it does exactly what your gui code tells it to do. Post it and we might be able to point out why...

It might also help to tell us what you actually want it to do.

Share this post


Link to post
Share on other sites
There is not any code for GUIImage and GUIText,but there is a single code for GUI:

function OnGUI () {
GUI.Box (Rect (180,250,180,80), "");
if(build == false)
{
if (GUI.Button (Rect (180,240,80,20), "Buildings")) {
if(Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), hit) )
{
house2 = Instantiate(house,hit.point,Quaternion.identity);
GameObject.Find("Main Camera").GetComponent(UnitSelection).enabled = false;
}
}
if (GUI.Button (Rect (270,240,80,20), "Walls")) {
}
} else {
if (GUI.Button (Rect (180,240,80,20), "Build Unit")) {
StartBuild(10);
}
}
}

Share this post


Link to post
Share on other sites
The Unity GUI system uses pixel co-ordinates rather than normalised view co-ordinates, which poses a few problems when using different resolutions.
My guess is you've laid out everything perfectly when in the editor, but the editor is a different resolution to your game when running standalone. (It looks like you're running at 800x600 when built, but I doubt the editor Game View can be that size and fit the rest of the editor on screen.)

I tend to prefer to roll my own simple GUI system (Buttons, sliders, checkboxes etc) using meshes and the OnMouse* events rather that use the Unity built in system to get around this sort of thing and allow for a lot more optimisations. (i.e. The UnityGUI doesn't allow for batching of draw calls, whereas mine does)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!