- Home /
error with GUI in c sharp
GUI.Box(new Rect(10.0, 10.0, Screen.width (2.5/6.55), Screen.height (1.0/6.3)),"Welcome "+ loginArray[1]); it shows error CS1502: The best overloaded method match for UnityEngine.Rect.Rect(float, float, float, float)' has some invalid arguments</p> <p>error CS1503: Argument <code>#3' cannot convert</code>double' expression to type <code>float' error CS1502: The best overloaded method match for</code>UnityEngine.GUI.Box(UnityEngine.Rect, string)' has some invalid arguments error CS1503: Argument <code>#1' cannot convert</code>object' expression to type
UnityEngine.Rect'
errors help me sort out this
Answer by Mike 3 · Mar 10, 2011 at 05:32 PM
The problem is you're giving the function doubles instead of floats
Change all the 10.0 etc values to 10.0f and it should work
Answer by XUNITY4K · Aug 18, 2015 at 09:33 PM
public void OnGUI () { GUI.Box (new Rect (0, 0, 250, 50), maxSpeed); transform.Translate(0,0,maxSpeed * Time.deltaTime);
}
Your answer
Follow this Question
Related Questions
Asset Bundle export script 'Cannot convert' error 1 Answer
Whats wrong with my script? GUI C# 2 Answers
Targetting script errors 1 Answer
Distribute terrain in zones 3 Answers