基本上我在遊戲中製作了一個變量,當玩家通過碰撞機時它會顯示所顯示的消息。不過,如果有人能幫助我,我會犯一些錯誤。我不確定我到底發生了什麼,它變得非常令人沮喪。布爾變量和小編碼錯誤
using UnityEngine;
using System.Collections;
public class showMessage : MonoBehaviour {
GameObject player;
private bool startLap;
void OnTriggerEnter (Collider other ){
if(other.tag == "Player") {
bool = true;
}
}
void OnGUI(){
if(bool == true) {
if(GUI.Button (new Rect(100, 100, 500, 40), "Help! I lost my car. Find it through this maze for me?")) {
Debug.Log("Door Works!");
bool = false;
}
}
}
}
好固定的BOOL布爾剛纔看到:\
我得到的錯誤是:
(10,30):錯誤CS1525:意外的符號
=', expecting
',?',
[',<operator>', or
標識符'(15,26):錯誤CS1525:意外符號
==', expecting
。' 錯誤CS1525:意外符號=', expecting
。'錯誤CS8025:分析錯誤
「我有一些錯誤」 - 他們是? –
如果你包含你得到的錯誤,這將有所幫助。 –
@MitchWheat貼這些對不起! – user2980622