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'.



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
    • unity3D | Example Projects
    • unity3D | Scripts
    • unity3D | Shaders
    • unity3D | Tutorials
    • 3D models
    • Animated 3D Models
    • Graphic design
    • Textures
    • Sounds
    • Other
  • FREE FPS PROJECT
    • FPSKit Download
    • FPSKit Modifications/Tutorials
    • FPSKit WIP/Showcase
    • Discussions / Bug reports
  • SELL | REQUEST
    • Sell
    • Request
  • Photon's Tutorials
  • Busy People's Introductions
  • Mars' Modular Multiplayer Photon FPS Kit's Topics
  • Mars' Modular Multiplayer Photon FPS Kit's Reviews
  • Photon's Photon General
  • Photon's Showcase
  • Mars' Modular Multiplayer Photon FPS Kit's Updates
  • Mars' Modular Multiplayer Photon FPS Kit's Tutorials

Categories

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

Calendars

  • Community Calendar

Facebook URL


Twitter URL


IndieGoGo URL


Kickstarter URL


IndieDB URL


GreenLight URL


Location:


Interests

Found 48 results

  1. Hey ArmedUnity forum, I'm working on a cool game with the awesome Unity engine and now I need help with one thing. I wan't to change the "Avatar" from my player to a other "Avatar" by a GUI button click. My question is, how can I do that? Thanks;) Screenshot: [1]: https://image.ibb.co/j8bzW7/Change.png
  2. Hello! As you can see it is really easy job, but I have a problem becasue... Never done that: I have code: void Update(){ updateGUIDimensions(); if (Input.GetKeyDown(KeyCode.I)) { //_open = !_open; } } And added new "if" that looks: if (Input.GetKeyDown(KeyCode.Escape)) { !_open; } But there is no working "!_open" lonelly command, so... how can I make it, to only "close" inventory when click "escape"? Of course the !open code looks: public void toggleState() { _open = !_open; } Thank you, and I will use that knowledge to other projects in future.
  3. Hello! I am a noob, with no formal education, so, I really appreciate these free FPSKits! They're great for learning, awesome for noobs like myself. I'm using the FPSKit v1.3.5 written in Unity Javascript. The issue I'm having is with the GUI elements. (ex. health, ammo, score, etc.) I simply want to move them to the top center of the screen. But, the only GUI experience I have is with the new Unity GUI Canvas etc. I think I have to change the "Rect Width/Height values". But, I'm not sure where?? Any help is greatly appreciated. Thanks.
  4. Show GUI OnTrigger C#

    Hi guys, fisrt of all, i have to say that i am learning C# so please dont be mean D: I was searching for a C# script to show an image while you are on a trigger. I have searched, but i only find JS tutorials. Please help
  5. my first menu :)

    I'm still learning Script (DropBox Link) Script provided was not written by me its a free script from Unity.Wiki site. The script is in C# script works both 2d and 3d menu's. What I did for a 2D Menu Have Camera Lighting Canvas - On canvas right click -> UI -> Button You have now created you're first button!. Repeat as many times you want for more buttons. Each button uses Sprites. To convert image on unity to a sprite image, click the image and on drop-down choose sprites. with the sprites you can now change the button shape. For free fonts please visit dafonts.com
  6. Hey guys just wanted your opinion on my new main menu for my game in development (i'll release information in a week or two, but for now i can only let you know that its a game based around jumping lol). It feels a bit to simple in my opinion and wanted some help making it a bit nicer . Thanks guys...
  7. Hey guys thought i'd showcase an idea my friend made. It is for a hunting game. When the player 'looks at' the animal it will display the animals stats, health, hunger, age, size, etc. Take a peak at this video and tell us what you think! (Thumbs up for the dank music) And be sure to subscribe to her/us for weekly project downloads(Free). https://www.youtube.com/watch?v=0GVtu3PPYGM Dank Memes?
  8. Converting it can be simple. Lets take something like void string guitext; void OnGui(){ GUI.Label(new Rect(Screen.width/2 - 75, Screen.height - 100, 300, 30), guitext); } Now while this will show what you want, it would definitely be more efficient to use the new UGUI. Now at the top of your script it will say using UnityEngine; using System.Collections; we want to add a new addition to this. I'll explain next why we do this. We are going to make it now say this using UnityEngine.UI; using UnityEngine; using System.Collections; Now we add UnityEngine.UI because now we can reference our UGUI components. Now to the fun part. We are going to change our code to reference the text of our new UGUI text. We have to add a couple of new variables. So at the top of the script after the name of the class , we are going to add public Text newgui; Before if you were to try that, Text wouldn't be able to be referenced and the script would throw back errors. Now before we move on, be sure you place you UGUI text where you want it to appear on the screen. Now in the Void Update we are going to add this. void Update(){ newgui.text=guitext.ToString(); } What this will do is whatever your string is, it will replace the text component of your UGUI. This doesn't have to be strictly kept to string components. Say you have a countdown variable using INT instead. The same rules would apply and instead public int guinumber; public Text number; void Update(){ number.text=guinumber.ToString(); } This can work in conjunction with public GameObject text; void OnTriggerEnter(){ text.SetActive(true); } as to set up say a timer, where the text only shows up when you want it to. Since UGUI can be treated as a GameObject it is amazingly easy to set up the perfect timer, warning screen, ammo counter, anything. I hope this very short tutorial helped you learn some new tricks.
  9. Mobile 2D Game GUI Controller

    Hi everyone ! I have a problem ... I tried everything i was able to try ... I also used GUI buttons ... but when I was pressing right and left arrows ... the player was just facing in that direction ... but no move ... and about jump button ... my player jumps that many times that I press the jump button... If I'm using the Pc controls, "A" "D" and "Space", everything works fine ... What is the problem ? So how I can add GUI controls ? Here is my Script : using UnityEngine; using System.Collections; public class Player : MonoBehaviour { private bool _isFacingRight; private CharacterController2D _controller; private float _normalizedHorizontalSpeed; public float MaxSpeed = 8; public float SpeedAccelerationOnGround = 10f; public float SpeedAccelerationInAir = 5f; public bool IsDead { get; private set; } public void Awake(){ _controller = GetComponent<CharacterController2D>(); _isFacingRight = transform.localScale.x > 0; } public void Update() { if (!IsDead) HandleInput(); var movementFactor = _controller.State.IsGrounded ? SpeedAccelerationOnGround : SpeedAccelerationInAir; // Resharper disable ConvertIfStateToConditionalTernaryExpression if(IsDead) _controller.SetHorizontalForce(0); else _controller.SetHorizontalForce(Mathf.Lerp(_controller.Velocity.x, _normalizedHorizontalSpeed * MaxSpeed, Time.deltaTime * movementFactor)); } public void Kill() { _controller.HandleCollisions = false; collider2D.enabled = false; IsDead = true; _controller.SetForce(new Vector2(0, 20)); } public void RespawnAt(Transform spawnPoint) { if (!_isFacingRight) Flip(); IsDead = false; collider2D.enabled = true; _controller.HandleCollisions = true; transform.position = spawnPoint.position; } public void HandleInput() { if (Input.GetKey(KeyCode.D)) { _normalizedHorizontalSpeed = 1; if (!_isFacingRight) Flip(); } else if (Input.GetKey(KeyCode.A)) { _normalizedHorizontalSpeed = -1; if (_isFacingRight) Flip(); } else { _normalizedHorizontalSpeed = 0; } if (_controller.CanJump && Input.GetKeyDown(KeyCode.Space)) { _controller.Jump(); } } private void Flip() { transform.localScale = new Vector3(-transform.localScale.x, transform.localScale.y, transform.localScale.z); _isFacingRight = transform.localScale.x > 0; } }
  10. Which GUI framework to choose?

    I'm at a point now where I need to start creating some guis - textfields, buttons etc, and I would like to hear if anyone has any preferences here. I'm considering OpenGUI and Unitys own uGui but since I have 0 experience with either I'm not sure what to choose. I am pretty sure though that I don't want to use basic OnGUI() because I would prefer an object/component oriented way of working - and would much rather subscribe to events than poll for input. Has anyone here tried any or both of these - any impressions good or bad? If you were to start again - which would you choose?
  11. GUI help !

    Hi guys ... This script was supposed to show me a "Level UP!" message when a certain amount of coins was reached ... But idk why it doesn't works ... can any1 help me ? Here is my script : using UnityEngine; using System.Collections; public class LevelPop : MonoBehaviour { private int coins = 0; public GUISkin levelPopSkin; // Use this for initialization void Start () { coins = PlayerPrefs.GetInt("Coins", 0); } // Update is called once per frame void Update () { } void FixedUpdate () { PlayerPrefs.SetInt("Coins",coins); } void OnGUI() { DisplayLevel (); } void DisplayLevel() { GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity,new Vector3(Screen.width / 480.0f, Screen.height / 320.0f, 1)); GUI.skin = levelPopSkin; Rect coinIconRect = new Rect(200, 150, 32, 32); //LEVEL SHOW ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ string skillLevel = " "; if(coins >= 7500){ StartCoroutine(ShowMessage("LEVEL UP !", 2)); } else if(coins >= 6900){ StartCoroutine(ShowMessage("LEVEL UP !", 2)); } else if(coins >= 5600){ StartCoroutine(ShowMessage("LEVEL UP !", 2)); } else if(coins >= 4500){ StartCoroutine(ShowMessage("LEVEL UP !", 2)); } else if(coins >= 2300){ StartCoroutine(ShowMessage("LEVEL UP !", 2)); } else if(coins >= 1600){ StartCoroutine(ShowMessage("LEVEL UP !", 2)); } else if(coins >= 800){ StartCoroutine(ShowMessage("LEVEL UP !", 2)); } else if(coins >= 400){ StartCoroutine(ShowMessage("LEVEL UP !", 2)); } else if(coins >= 200){ StartCoroutine(ShowMessage("LEVEL UP !", 2)); } else if(coins >= 100){ StartCoroutine(ShowMessage("LEVEL UP !", 2)); } else if(coins >= 0){ StartCoroutine(ShowMessage("LEVEL UP !", 2)); } Rect labelRect = new Rect(coinIconRect.xMax, coinIconRect.y, 60, 32); GUI.Label(labelRect, skillLevel); } IEnumerator ShowMessage (string message, float delay) { guiText.text = message; guiText.enabled = true; yield return new WaitForSeconds(delay); guiText.enabled = false; } }
  12. help with gui

    hello i want to do when i click GUI.button it gives me options like when you right click a folder. can u help me start thanks
  13. Is this even possible?? (Unity GUI)

    Hello there, I know a lot on how to script just a normal GUI framework in Unity3D, but the following issue is so frustrating that I even don't if this is technically possible. So, at the moment I'm just stucked with a very basic script to show the Ammo of the current weapon and looks like: Well, what I'm trying to achieve is a (NON-SHADER-ON-OBJECT-EDITION) circular progress 'bar' (GUI), written in C#. Here's an example: The darkblue part of the circle should display how many bullets there are left in the current magazine of our weapon. I don't know where to start with this and I'd really like to implement this in my current project. It is so frustrating that all this circular-stuff is trying to get me dizzy, literally.
  14. Help with Inventory UI

    public List<ItemClass> playerInventory = new List<ItemClass>(); void DrawInventory(int windowID) { for (int i = 0; i < playerInventory.Count; i++) { if (GUILayout.Button(playerInventory.itemIcon, GUILayout.Width(100), GUILayout.Height(100))) { Debug.log(playerInventory.itemName + " Used"); } } } this is my inventory window function what i want to do is the first 6 items will be in one line the the next 6 items in a difrent line and so on... i have 2 questions: 1.can i use the new 4.6 UI system to do this? 2.how can i do this using GUILayout.BeginHorizintal("");?
  15. GUI Error

    hello i have a problem with my script heres my OnGUI function and my window functions: void OnGUI() { GUI.skin = GUISkinToUse; Rect windowRect = new Rect(Screen.width/3.5f, Screen.height/15, Screen.width/2, Screen.height/1.2f); Rect windowRect2 = new Rect(Screen.width/1.27f, Screen.height/15, Screen.width/5, Screen.height/1.2f); if(Network.peerType == NetworkPeerType.Disconnected) { windowRect = GUI.Window (1, windowRect, DrawServersWindow, ""); windowRect2 = GUI.Window (2, windowRect2, DrawHostServerWindow, ""); } } void DrawServersWindow(int windowID) { GUILayout.BeginHorizontal(""); GUILayout.Label(" server name", GUILayout.Width(Screen.width / 2.5f), GUILayout.Height(Screen.height / 25)); GUILayout.Label("players", GUILayout.Width(Screen.width / 20), GUILayout.Height(Screen.height / 25)); GUILayout.EndHorizontal(); scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(Screen.width/2.04f), GUILayout.Height(Screen.height/1.2f)); for(int i = 0; i < hostData.Length; i++) { GUILayout.BeginHorizontal(""); if(GUILayout.Button(hostData.gameName, GUILayout.Width(Screen.width / 2.5f), GUILayout.Height(Screen.height / 25))) { connectedServerIP = hostData.ip; Network.Connect(hostData); } GUILayout.Box(hostData.connectedPlayers + "/" + hostData.playerLimit, GUILayout.Width(Screen.width / 20), GUILayout.Height(Screen.height / 25)); GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); if(GUILayout.Button("Refresh", GUILayout.Height(Screen.height / 26))) { refreshHostList(); } } everying is OK i get no errors but when when i hit play i get this 3 errors: 1 NullReferenceException: Object reference not set to an instance of an object ServersMenu.DrawServersWindow (Int32 windowID) (at Assets/Network/ServersMenu.cs:100) 2 GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced) 3 ArgumentException: Getting control 0's position in a group with only 0 controls when doing Repaint Aborting can someone help me fix this thanks
  16. How do you find the screenspace position of a SelectionGrid element that is clicked?( inform of a rect)
  17. display for inventory

    alright so i am making an inventory system but cant figure out how to display gui button in next line once it displays 9 buttons..i can only make them horizontally ,but not make them vertically.. what should i do to make them appear like this - http://4.bp.blogspot.com/-HYkJVpt8S5w/USi8nSESrLI/AAAAAAAAFVc/x6oVlUBQzao/s1600/gw2inv7.jpg function OnGUI(){ if ( shwinvtry ){ for ( var i = 1; i< 9 ; i++ ){ if( inventory[i].name == "" ){ inventory[i].icon = defaultbox ; } if ( i > 8 ) y ++; if ( GUI.Button(Rect( Screen.height/4 + ( 60 * i ) ,Screen.width / n + ( y * 2 ) , 60,60),inventory[i].icon)){ } } } }
  18. Hey guys, I thought I might share with you a GUI transition script that is similar to the one in my game. It works by manipulating the GUI origin to achieve animated effects. To keep things simple, I will shows you how to create an horizontal transition between two Text Areas using a couple of buttons. Unity allows us to change the matrix by manipulating the GUI.matrix values. So, the script requires a Matrix4x4 object. Also, to make the code more readable, a Vector3 is going to be created, also making it easier to translate the GUI system origin. Here’s the script: Here's the detailed explanation:
  19. gui hover problem

    ok , so i fouind this script online but it doesnt seem to work.. ive created a guitexture gameobject and want it to change its texture when mouse hovers over it.. but i get nothing... var normalTex : Texture2D; var hoverTex : Texture2D; function OnMouseEnter () { guiTexture.texture = hoverTex; } function OnMouseExit(){ guiTexture.texture = normalTex; } function OnMouseDown(){ Debug.Log("clicked"); }
  20. Select Map Script

    Hey guys i made a script that allows you to select maps using UnityEngine; using System.Collections; [System.Serializable] public class map{ public string name; public Texture2D mapTexture; } [System.Serializable] public class SelectMap : MonoBehaviour { public Rect windowRect = new Rect (Screen.width / 2-300, Screen.height / 2-200, 600, 400); public int currentMap; private int nextMap; public map[] maps; void Start () { windowRect = new Rect (Screen.width / 2 - 300, Screen.height / 2 - 200, 600, 400); } void OnGUI(){ windowRect = GUI.Window (1, windowRect, MapSelection, "Select Map"); } void MapSelection(int id){ GUILayout.BeginArea (new Rect(75, 100, 500, 500)); if(currentMap > 0) GUI.DrawTexture (new Rect(0, 40, 125, 75),maps[currentMap-1].mapTexture); if (currentMap > maps.Length-1|| currentMap > maps.Length-1) currentMap = 0; GUI.DrawTexture (new Rect(135, 0, 200, 125),maps[currentMap].mapTexture); if(currentMap != maps.Length-1) GUI.DrawTexture (new Rect(345, 40, 125, 75),maps[currentMap+1].mapTexture); GUILayout.EndArea (); GUILayout.BeginArea (new Rect(200, 100, 200, 500)); GUILayout.Space (200); GUILayout.BeginHorizontal (); if(GUILayout.Button("<<") && currentMap > 0) currentMap--; GUILayout.Box ("" + maps [currentMap].name); if(GUILayout.Button(">>")){ if(currentMap < maps.Length) currentMap++; else if(currentMap == maps.Length-1) currentMap = 0; } GUILayout.EndHorizontal (); if (GUILayout.Button ("Select")) { //Whatever you want to happen when you select a map put here; } GUILayout.EndArea (); } } Heres an image of it being used in my personal game
  21. GUI Layout - HELP

    Ok , i have a problem and i don't really know how to explain it... So i will try to describe it ... I want using a foreach / for (int i ... ) loop to add gui buttons. Ok that's easy i just did this GUILayout.BeginHorizontal(); foreach (GameObject go in currentItems) { GUILayout.Button(go.name, GUILayout.Width(100),GUILayout.Height(100)); } GUILayout.EndHorizontal(); The result is this What i want is to make lines of 4 buttons. I mean i want to add 4 buttons like above and the next 4 buttons to be bellow the others. I can do it manually but since it's based on an array length i want to do it automatically since the array might have 4 items might have 56 items. So i want to make automatically something like this. Thanks in advanced.
  22. Hi all! I'm completely new for Unity, yet I'd like to learn on the go. I'm using a PieMenu component with 3 different buttons. The default value for these buttons are: One Two Three (in an array named "command") There is a script for this in the project file: using UnityEngine; using System.Collections; public class MenuItemActions_3 : MonoBehaviour { void OnSelect(string command) { Debug.Log("A Left Menu Command Received: " + command); } } I want it work like if I click one of the buttons, a jpeg file appears for GUI. I also have a script for get a jpeg on GUI after click an object. But the above one is C# and this is javascript: var popupTexture : Texture2D; private var paperPopup : PaperPopup; function Start () { paperPopup = FindObjectOfType(PaperPopup); if (popupTexture == null) { popupTexture = renderer.material.mainTexture; } } function OnMouseDown () { paperPopup.Show(this); } Anyone could help me? It should open 3 different jpeg-s on the GUI. Thank you!
  23. NOT AVAILABLE FOR FREE ANYMORE!
  24. Scale GUI in Android

    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"); } } } }
×