Topic: 1.5 - Understanding Input Display
Hi All
One of the more common questions regarding 1.5 is turning the Input Display off. This is simple enough to do during the game, just pause it (ESC key) and you'll see the option to toggle it off. This is saved between sessions too, so for your own game builds just make sure you turn it off before publishing.
What's confusing to some people is that you can't turn it off from the Global Editor. This was deliberately left out of the Global options as it's not that hard to configure. In fact, everything is in the GUIScripts.cs file. If you have even just a little coding knowledge, then you should have no problems understanding it. I recommend stopping here and just looking through that file now if you want to figure it out yourself .
But some people might want some guidance anyway. So to save me repeating myself I decided to post some tips on it.
First, I'll show you the GUIScript.cs file and some changes you can make in that. Then if you're a Source owner, I'll show you how to add the option into the Global Config.
===== Editing the GUIScript.cs file =====
Open the .\UFE\Scripts\GUIScripts.cs file. Search for:
// Input Viewer
if (showInputs){
Inside this if statement is how the game is displaying the Inputs for each player.
Here, you can change the position and size of the inputs. Lets create double the inputs displayed just to Player 1.
Just below, find this code:
foreach(Texture texture in player1ButtonPresses[i]){
Rect iconPosition = new Rect(10 + (texture.width * distance),
120 + (texture.height * i),
texture.width,
texture.height);
GUI.DrawTexture(SetResolution(iconPosition), texture);
distance ++;
}
and change to:
foreach(Texture texture in player1ButtonPresses[i]){
Rect iconPosition = new Rect(10 + (texture.width/2 * distance),
120 + (texture.height/2 * i),
texture.width/2,
texture.height/2);
GUI.DrawTexture(SetResolution(iconPosition), texture);
distance ++;
}
All we did here was halve the texture size and position.
Play the game, and P1 should have half sized input display and also taking up half the space. But now we have lots of wasted space below, so lets double the history count so we can fill it up.
Near the top of the file, you'll see:
private List<Texture[]> player1ButtonPresses = new List<Texture[]>(12);
Change the 12 at the end to 24. This step is technically optional, but it's good practice .
Then look for this bit:
if (player == 1){
if (activeIconList.Count > 0) player1ButtonPresses.Add(activeIconList.ToArray());
if (player1ButtonPresses.Count >= 13) player1ButtonPresses.RemoveAt(0);
And change the 13 to 25.
Play the game to see the change. Feel free to do the same to 2P.
===== Icons =====
If you want to change the icons, just go into the Input Options and you'll have fields to add your own icons to each direction and button.
===== Global Options Toggle =====
Finally, if you have Source, you can create your own toggle inside the Global Options. We'll add it into GUI Options.
Open GlobalInfo.cs file, find:
public class GUIOptions {
Anywhere inside the class, add:
public bool showInputs;
Then open GlobalEditorWindow.cs file, and find:
EditorGUILayout.BeginHorizontal();{
EditorGUILayout.LabelField("Round Won Marker:", GUILayout.Width(160));
globalInfo.guiOptions.roundWonMarker = (Texture2D) EditorGUILayout.ObjectField(globalInfo.guiOptions.roundWonMarker, typeof(Texture2D), false);
}EditorGUILayout.EndHorizontal();
Below, add:
globalInfo.guiOptions.showInputs = EditorGUILayout.Toggle("Display Inputs:", globalInfo.guiOptions.showInputs);
Finallly, in GUIScript.cs file, find:
void OnGameBegins(CharacterInfo player1, CharacterInfo player2, StageOptions stage){
And anywhere inside this function add:
showInputs = UFE.config.guiOptions.showInputs;