- Home /
Conversion method types(void to bool)[SOLVED]
Hello everyone! I've have created a function that creates a button for me:
public void createBox(float left, float top, float width, float height, string content) {
GUI.Box(new Rect((screenX-screenX)+left, (screenY-screenY)+top, width, height), content);
}
Just to be more easier to create buttons, but when i try to make an if with this button he shows me a implicit conversion types, that's obviously. I call my method inside of other script in a void OnGUI() {} Well, i just wanna know if i can do this in otherwise, create a method which will create a button for me, and later i put an if and it'll works fine :D.
Thanks.
Can you write it in pseudo code so we can understand what you mean? Thanks
Answer by Chronos-L · Apr 22, 2013 at 05:04 AM
You need to return a boolean value for it to work with a GUI.Button
,
public bool createButtonx(float left, float top, float width, float height, string content) {
return GUI.Button(...);
}
Your answer
Follow this Question
Related Questions
GUI RepeatButton can only be clicked once 2 Answers
Unity GUI Style with if Statements 1 Answer
Button Input 1 Answer
If button clicked statement? 1 Answer