Question by
MrKowaski · Sep 25, 2015 at 05:56 PM ·
gameobjectactivationgetkeydowncs
Enable or disable a gameobject with a buttonpress
Hi I want to make a script that enables o disables an object pressing a key, this is my script but it does anything
using UnityEngine;
using System.Collections;
public class changetool : MonoBehaviour {
// Update is called once per frame
void Update ()
{
if(Input.GetButtonDown("o"))
{
GameObject.FindWithTag("Pick").SetActive(true); //this is a pickaxe
GameObject.FindWithTag("Arma").SetActive(false); //this is a weapon
}
}
}
Comment