0 votes
by (8.2k points)

How to create a reset button On-screen space.
error CS1061: 'Button' does not contain a definition for 'OnClick' and no accessible extension rnethcxi 'OIClick' accepting a first argument (are you missing a using directive or an assembly reference?)


 

1 Answer

0 votes
by (8.2k points)

It's onClick not OnClick.

using System. Collections;

using System. Collections.Generic;

using UnityEngine;

using UnityEngine.SceneManagement;

public class Reset: MonoBehaviour

{

  void Start()

  {

    Buttm Button = this.GetComponent<Button>().onClick.AddListener(Reset);

  }

}

TechXR runs courses in AR / VR / Metaverse / Game Development. Some of the popular Q&A in our courses are available here for easy discovery.

113 questions

117 answers

8 comments

99.7k users

...