Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

Search the Community

Showing results for tags 'gui texture'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GENERAL
    • Introduce yourself
    • Discussions
    • Showcase
    • Need help?
    • Seeking team members?
    • Offtopic
  • RESOURCES
    • Example Projects
    • Scripts
    • Shaders
    • Unity Tutorials
    • FPS Kit Tutorials
    • 3D models
    • Animated 3D Models
    • Graphic design
    • Textures
    • Sounds
    • Other
  • SELL | REQUEST
    • Sell
    • Request
  • Mars' Modular Multiplayer Photon FPS Kit's Topics
  • Mars' Modular Multiplayer Photon FPS Kit's Reviews
  • Mars' Modular Multiplayer Photon FPS Kit's Updates
  • Mars' Modular Multiplayer Photon FPS Kit's Tutorials
  • Busy People's Introductions
  • Photon's Tutorials
  • Photon's Photon General
  • Photon's Showcase

Categories

  • Free Projects
  • Free Assets
  • Game Demos
  • Photon's Files

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


YouTube URL


Facebook URL


Twitter URL


IndieGoGo URL


Kickstarter URL


IndieDB URL


GreenLight URL


Location:


Interests

Found 1 result

  1. Hi everyone, My GUI is on my android phone really small and on a other phone much bigger. I know its because of the resolution and I already read many forum post about this problem but none of the solutions workt for me. So I want that the GUI is on every phone the same size. But I really have no idea how to do this. This is my script that creates the GUI: using UnityEngine; using System.Collections; public class GameManager : MonoBehaviour { // The score that the player currently has [HideInInspector] public int curScore; // The highest score the player has reached (saved) private int highscore; // Reference to our custom gui skin public GUISkin skin; // Values defining the width and height of our game over screen public Vector2 losePromptWH; // Boolean to check if we need to end the game or not [HideInInspector] public bool showGameOver; void Start () { // Grab the last saved highscore from the player prefs file highscore = PlayerPrefs.GetInt("Highscore"); } void Update () { // If the bird died and our current score is greater than our saved highscore if (showGameOver && curScore > highscore) { // Set the highscore to our current score highscore = curScore; // Now save the score as our new highscore PlayerPrefs.SetInt("Highscore", highscore); } } void OnGUI() { // Set the GUI's skin to our custom skin GUI.skin = skin; // Show our current score value at the top center of the screen // (note: it uses the custom Score style in our skin) GUI.Label (new Rect(Screen.width/2 - 100,100f,200,200), curScore.ToString(), skin.GetStyle("Score")); // If the bird died, show the game over screen if (showGameOver) { // Define the screen space for the game over window Rect currentGameOver = new Rect(Screen.width/2 - (losePromptWH.x/2), Screen.height/2 - (losePromptWH.y/2), losePromptWH.x, losePromptWH.y); // Generate a box based on the game over window rectangle GUI.Box (currentGameOver, "Game Over", skin.GetStyle("Game Over")); // Draw our current score within the game over window GUI.Label(new Rect(currentGameOver.x + 15f, currentGameOver.y + 250f, currentGameOver.width * .5f, currentGameOver.height * .25f), "Score: " + curScore.ToString()); // Draw our highscore within the game over window (if the highscore was beaten, it will show your current score) GUI.Label(new Rect(currentGameOver.x + 150f, currentGameOver.y + 350f, currentGameOver.width * .5f, currentGameOver.height * .25f), "High score: " + highscore.ToString()); // Draw a replay button on screen and check to see if it was clicked if (GUI.Button (new Rect(currentGameOver.x + (currentGameOver.width - 110), currentGameOver.y + (currentGameOver.height + 250), 330, 160), "", skin.GetStyle("Play"))) { // If it is clicked, reload the level Application.LoadLevel("5 Level"); // Load the highscore from our save file highscore = PlayerPrefs.GetInt("Highscore"); } if (GUI.Button (new Rect(currentGameOver.x + (currentGameOver.width - 520), currentGameOver.y + (currentGameOver.height + 250), 330, 160), "", skin.GetStyle("back"))) { // If it is clicked, reload the level Application.LoadLevel("1 menu"); } } } }
×
×
  • Create New...