現在チョコレートでクッキーを破壊するゲームを作っていて、以下のようなコードを書いたんです。
C#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4using UnityEngine.UI; 5 6public class ok : MonoBehaviour 7{ 8public int points = 0; 9 10 // Start is called before the first frame update 11 void Start() 12 { 13 14 } 15 16 // Update is called once per frame 17 void Update() 18 { 19// Debug.Log(points); 20 this.GetComponent<Text>().text = "割ったクッキー数" + points.ToString + "枚"; 21 } 22} 23
というコードをhttps://qiita.com/JunShimura/items/864054bb9710b63c1a3bを参考にして書いたのですが
Assets\ok.cs(20,42): error CS0019: Operator '+' cannot be applied to operands of type 'string' and 'method group'
というエラーが出て実行できません。
いちおうthis.GetComponent<...みたいなところを消すと治るんですが、当然ですがテキストにうつすことができなくなって、戻すとやっぱりできなくなるというループです。
30分以上調べて試してを繰り返してみたんですがやはりできませんでした。
できれば解答お願いしますm(_ _"m)
追記
google翻訳の「文字列」および「メソッドグループ」タイプのオペランドとは何なのでしょうか? (y_waiwaiさんがやってくれました。ありがとうございました。)
初心者ですいません。できるだけ努力はしてみます!!
回答2件
あなたの回答
tips
プレビュー