How to hide and show ui buttons.

Hello… Im trying to make buttons hide and show when collisions i use SetActive but doesnt even work why?? Here’s my script…

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class rayCastCSHARP1 : MonoBehaviour
{
public GameObject _parent;
public GameObject _testObj;
public GameObject _parent1;
public Button btnPickUp;
public Button btnPlace;
public Canvas myCanvas;

void Start () {

	btnPickUp.gameObject.SetActive(false);

}

void OnGUI ()
{
	if(btnPickUp.SetActive(true))
    {
		pickUpDown();
    }
}

void OnCollisionStay (Collision col) {

	if(col.gameObject.tag == "pickup") {

		btnPickUp.SetActive(true);

	}
}

void OnCollisionExit (Collision col) {

	btnPickUp.SetActive(false);

}			

void pickUpDown () {

	_testObj.transform.parent = _parent.transform;

}

void placeDown () {

	_testObj.transform.parent = _parent1.transform;

}

}

You need to refer to the GameObject, the button component is attached to, so you use :

btnPickUp.gameObject.SetActive(true)

As you do in the Start() , also there is no point on having the

if(btnPickUp.SetActive(true))

it will be always false as SetActive has void return type.
Cheers.

Out of curiosity does that even get compiled?