Last active
January 2, 2021 21:25
-
-
Save hidsh/dbbeec9012959dbd2c570a5adf7fff11 to your computer and use it in GitHub Desktop.
unity test: UnityのUIを作ってみよう https://dkrevel.com/makegame-beginner/ui-beginner/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class NewBehaviourScript : MonoBehaviour | |
{ | |
// Start is called before the first frame update | |
void Start() | |
{ | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
} | |
public void TestClick() | |
{ | |
// publicなメソッドなので、このファイル外から呼べる | |
Debug.Log("ボタンが押された!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
このスクリプトをなんかのゲームオブジェクトに貼り付けて、
インスペクタでボタンのOnClick() のところで+を押して、
そこにさっきのゲームオブジェクトをドラッグして、
その右上の No function のところで スクリプト名.cs > TestClick を選択