C♯
1using System.Collections.Generic; 2using UnityEngine; 3using UnityEngine.UI; 4 5public class DORAcoin : MonoBehaviour 6{ 7 public Text scoreText; //Text用変数 8 private int score = 0; //スコア計算用変数 9 10 void Start() 11 { 12 score = 0; 13 SetScore(); //初期スコアを代入して表示 14 } 15 16 //cube同士での衝突+100 cube以外との衝突+100 17 void OnCollisionEnter( Collision collision ) 18 { 19 string yourTag = collision.gameObject.tag; 20 21 if( yourTag == "Cube" ) 22 { 23 score += 150; 24 } 25 SetScore(); 26 } 27 28 void SetScore() 29 { 30 scoreText.text = string.Format( "Score:{0}", score ); 31 } 32 }
このvoid SetScoreの初期化の方法がわかりません。
図々しいのはわかっているのですが、どなたか教えて下さい。
お願いします。
https://teratail.com/questions/61263 と重複