# Conversion method types(void to bool)\[SOLVED\]

**URL:** https://discussions.unity.com/t/conversion-method-types-void-to-bool-solved/69195
**Category:** Questions & Answers
**Created:** [April 22, 2013, 4:53am UTC](https://discussions.unity.com/t/conversion-method-types-void-to-bool-solved/69195 "2013-04-22T04:53:21Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![RafaelCN](https://avatars.discourse-cdn.com/v4/letter/r/9de053/32.png) [@RafaelCN](https://discussions.unity.com/u/RafaelCN)
#### Post date: [April 22, 2013, 4:53am UTC](https://discussions.unity.com/t/conversion-method-types-void-to-bool-solved/69195/1 "2013-04-22T04:53:21Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Chronos-L](https://avatars.discourse-cdn.com/v4/letter/c/e36b37/32.png) [@Chronos-L](https://discussions.unity.com/u/Chronos-L)
#### Post date: [April 22, 2013, 5:04am UTC](https://discussions.unity.com/t/conversion-method-types-void-to-bool-solved/69195/2 "2013-04-22T05:04:49Z")

</div>

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

```
