- Home /
Trouble using C# tooltips
I am trying to make a part menu for my game, and I'm getting 3 errors:
Assets/Scripts/PartMenu/PartMenu.cs(12,94): error CS0119: Expression denotes a type', where a
variable', value' or
method group' was expected
Assets/Scripts/PartMenu/PartMenu.cs(12,21): error CS1502: The best overloaded method match for UnityEngine.GUI.Button(UnityEngine.Rect, string)' has some invalid arguments Assets/Scripts/PartMenu/PartMenu.cs(12,21): error CS1503: Argument
#2' cannot convert object' expression to type
string'
Here is my code: using UnityEngine; using System.Collections;
public class PartMenu : MonoBehaviour {
// Use this for initialization
void OnGUI () {
GUI.Box(new Rect(0, 0, Screen.width * (0.25f), Screen.height * (0.70f)), "Part Menu");
GUI.Button(new Rect(0, 25, Screen.width * (0.125f), Screen.height * (0.1f)), GUIContent ("Small Plate Of Plastic", "Test"));
GUI.Label(new Rect(0, 50, Screen.width * (0.125f), Screen.height * (0.1f)), GUI.tooltip);
}
}
Comment
Best Answer
Answer by AeonIxion · Nov 18, 2013 at 08:27 PM
Just a small mistake. On this line:
GUI.Button(new Rect(0, 25, Screen.width * (0.125f), Screen.height * (0.1f)), GUIContent ("Small Plate Of Plastic", "Test"));
you forgot the 'new' keyword in front of GuiContent.