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

–

1 Answer

1

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(...);   
}

helps me a lot, thankyou!

–