Quantcast
Channel: Latest Questions by Kerihobo
Viewing all articles
Browse latest Browse all 74

GUI.SelectionGrid for multiplayer?

$
0
0
I'm a little confused about how I can make this usable for multiplayer (up to four players). using UnityEngine; using System.Collections; using System.Collections.Generic; public class GameManager : MonoBehaviour { public int selGridInt = 0; private string[] available_chars = new string[] {"Regan", "Peter", "Max", "Tim"}; public static string[] char_selection; void Update () { //if press left if (Input.GetKeyDown(KeyCode.LeftArrow) < 0 && selGridInt > 0) { selGridInt -= 1; } //if press right if (Input.GetKeyDown(KeyCode.RightArrow) > 0 && selGridInt < s_available_characters.Length-1) { selGridInt += 1; } //if press enter if (Input.GetKeyDown(KeyCode.Return)) { char_selection = available_chars[selGridInt]; } } void OnGUI() { selGridInt = GUI.SelectionGrid(new Rect(10, 10, 100, 100), selGridInt, s_available_characters, 4); } } As it behaves at the moment, and as far as i can tell, I can only have one selection active, how does this work when I want multiple people to be able to select a character? this is what I'm aiming for: [http://i.ytimg.com/vi/bAnML8mJ2mw/maxresdefault.jpg][1] [1]: http://i.ytimg.com/vi/bAnML8mJ2mw/maxresdefault.jpg

Viewing all articles
Browse latest Browse all 74

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>