Cant seem to get my ToolTips working most accurate i get is the full list showing and not on what button my mouse is hovering.
any solution?
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Wmenu : MonoBehaviour{
private GUISkin SubMenu;
// knoppen
public float buttonWidth = 250;
public float buttonHeight = 30;
public float closeWidth = 20;
public float closeHeight = 20;
private float yOffset = 10;
private float Spacing = 25;
private float Gap;
private bool SUBMENU = false;
private bool pressed = false;
private const int SubMID = 0;
private Rect SubMRect = new Rect(10, 10, 280, 300);
private Rect ViewerRect;
private GameObject[] Locations;
public Transform Char;
private Vector2 Slider = Vector2.zero;
private string Warp = "";
private string Info = "";
private int infoIndex;
int WarpIndex;
void Start ()
{
Locations = GameObject.FindGameObjectsWithTag("Locaties");
}
void OnGUI()
{
if(SUBMENU)
{
SubMRect = GUI.Window(SubMID, SubMRect, Smenu, "SubMenu");
//=============== calling the guibox where i want the info to show ==================\\
GUI.Box(new Rect(70, Gap, 150, buttonHeight), new GUIContent(Info));
}
}
void Update ()
{
if(Input.GetKeyDown(KeyCode.M) && SUBMENU == false && pressed == false)
{
pressed = true;
SUBMENU = true;
MouseLook.canControl = false;
}
if(Input.GetKeyDown(KeyCode.M) && SUBMENU == true && pressed == false)
{
SUBMENU = false;
pressed = true;
MouseLook.canControl = true;
}
if(Input.GetKeyUp(KeyCode.M))
{
pressed = false;
}
if(Input.GetKeyDown(KeyCode.N)&& SUBMENU == true &&pressed == false)
{
pressed = true;
}
if(Input.GetKeyUp(KeyCode.N))
{
pressed = false;
}
}
// Warp Menu
public void Smenu(int id)
{
ViewerRect = new Rect(10, 20, 250, 270);
Slider = GUI.BeginScrollView(new Rect(ViewerRect), Slider, new Rect(0,25,0,Gap - 40));
Gap = yOffset + Spacing;
for(int i = 0; i < Locations.Length; i++)
{
Warp = i.ToString();
infoIndex = i;
//=============== caUpdating the info string to show the button info =================\\
Info = Locations[infoIndex].name + infoIndex.ToString();
//====== The array of buttons which update when a location is added or removed ======\\
if(GUI.Button (new Rect (25, Gap, buttonWidth, buttonHeight),Warp))
{
Char.transform.position =
new Vector3(Locations*.transform.position.x,*
_ Locations*.transform.position.y + 2,*_
<em>_ Locations*.transform.position.z); *_</em>
<em>_* } *_</em>
<em>_* Gap += 55;*_</em>
<em>_* }*_</em>
<em>_* GUI.EndScrollView();*_</em>
<em>_* GUI.DragWindow(); *_</em>
<em>_* }*_</em>
<em>_*}*_</em>
<em>_*```*_</em>
Where in there are you using tooltips? Or are you talking about custom ones, not the ones built into the GUI system?
– syclamothNo, you're definitely not using the builtin ones. Have you thought about using those?
– syclamothNothing you are doing queries GUI.tooltip. Look up in the documentation- it makes it clearer than I can.
– syclamoth