Button seems unresponsive. c#
When I click my Button, nothing seems to happen, not even a click. I want it to generate a new Grass prefab in front of the camera.
My canvas (which i cant re position) has Z level of 90. My Panel has Z level of 0. My Button has Z level of 10.
My _Manager object has a script: MakeNew with a function Generate.
My Button has as onClick, MakeNew.Generate from _Manager.
my public GameObject is a grass tile prefab.
My Camera is at(0, 0, -10).
Code in _Manager:
public class MakeNew : MonoBehaviour {
public GameObject grass;
public void Generate () { Instantiate(grass, new Vector3(0, 0, 0), Quaternion.identity); }
Answer by hexagonius · Mar 12, 2017 at 08:35 AM
make sure your button is child of a canvas and you have an EventSystem and GraphicsRaycaster component in the scene.
Your answer
![](https://koobas.hobune.stream/wayback/20220612113012im_/https://answers.unity.com/themes/thub/images/avi.jpg)