1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

リセットボタンの付け方

Posted at

Create>UI>Buttonから作ります。そのあとCaNvasからButtonを選択しInsoectorの名前をResetに変えます。
Resetの▼を押しTextをクリック、Resetの表示名を変更できます。
次にスクリプトを作るためにcreate>FolderからScriptsを選択します。名前の表示をResetScriptsにしたほうが見やすくなります。次にこのようにコードを打ちましょう。

void Update () {
    if (Input.GetMouseButtonDown(0))
    {
        
    }

}
public void RestartButton()
{
   PlayerScript.score = 0;
   SceneManager.LoadScene("main");
}

このように打てばおそらくResetができるはずです。
作ったResetのオブジェクトにScriptsを当てはめて終わりです。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?