実現したいこと
Onclickのプログラムの関数を選択したい。
発生している問題・分からないこと
関数を選択しようとすると関数が選択出来ない。
該当のソースコード
C#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4using UnityEngine.UI; 5 6public class MonsterProgram : MonoBehaviour 7{ 8 9 //HPテキスト 10 public Text HpLabel; 11 12 //HP 13 private int hp; 14 15 //最大HP 16 private int maxHp; 17 // Start is called before the first frame update 18 void Start() 19 { 20 21 maxHp = 10; 22 hp = maxHp; 23 HpLabel.text = hp + "/" + maxHp; 24 25 } 26 27 public void OnClickMonster() 28 { 29 //ダメージを与える 30 hp -=1; 31 HpLabel.text = hp + "/" + maxHp; 32 33 } 34 // Update is called once per frame 35 void Update() 36 { 37 38 } 39} 40
試したこと・調べたこと
- teratailやGoogle等で検索した
- ソースコードを自分なりに変更した
- 知人に聞いた
- その他
上記の詳細・結果
teratailや本を参考にしましたが上手く行きませんでした。
補足
初心者なのでかみ砕いて説明すると有難いです。