Unity CS1002 expected hatası

C#:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class TOP : MonoBehaviour
{


public Rigidbody2D rb;
public float hiz;
public float gol_1,gol_2;
public Text gol1,gol2;


// Start is called before the first frame update
void Start()
{
hiz = 180f;

gol_1=0;
gol_2=0;
}
// Update is called once per frame
void Update()
{

}



public void OnCollisionStay2D(Collision2D temas) {

if(temas.gameObject.tag =="Oyuncu2") {
if(Input.GetKey(KeyCode.K)){
if(Input.GetKey(KeyCode.UpArrow)){
rb.AddForce(Vector2.up * hiz);
}

if(Input.GetKey(KeyCode.DownArrow)){
rb.AddForce(Vector2.down * hiz);
}

if(Input.GetKey(KeyCode.RightArrow)){
rb.AddForce(Vector2.right * hiz);
}
if(Input.GetKey(KeyCode.LeftArrow)){
rb.AddForce(Vector2.left * hiz);
}





}


}
if(temas.gameObject.tag =="Oyuncu1") {
if(Input.GetKey(KeyCode.Space)){
if(Input.GetKey(KeyCode.W)){
rb.AddForce(Vector2.up * hiz);
}

if(Input.GetKey(KeyCode.S)){
rb.AddForce(Vector2.down * hiz);
}

if(Input.GetKey(KeyCode.D)){
rb.AddForce(Vector2.right * hiz);
}
if(Input.GetKey(KeyCode.A)){
rb.AddForce(Vector2.left * hiz);
}





}


}

}
public void OnCollisionEnter2D(Collision2D kale_gol){
if(kale_gol.gameObject.tag=="Kale1"){
gol_1 += 1;
gol2.text = gol_1.ToString();

}



}








}


sıddık ben artık textmeshpro kullanmıyorum ona göre yaptım ama şu anda failed to find entry-points diyor bu kodda nolur bi el atsan
Unity sahnesini atabilir misin?
 
@fratalkanan Kodunu alttaki düzelt tuşuna basmadan tekrar at. Sahneyi de at. Hatanın tamamını da at. Basit hata aslında.
hocam normalde burada
1694460066453.png

top kaleye değince gol olması lazım ama sol alttaki hata diyor topun kodları da burada yardım nolur
C#:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class TOP : MonoBehaviour
{


   public Rigidbody2D rb;
   public float hiz;
  public float gol_1,gol_2;
  public Text gol1,gol2;


// Start is called before the first frame update
void Start()
{
hiz = 180f;

gol_1=0;
gol_2=0;
}
// Update is called once per frame
void Update()
{

}



public void OnCollisionStay2D(Collision2D temas) {

if(temas.gameObject.tag =="Oyuncu2") {
if(Input.GetKey(KeyCode.K)){
if(Input.GetKey(KeyCode.UpArrow)){
rb.AddForce(Vector2.up * hiz);
}

if(Input.GetKey(KeyCode.DownArrow)){
rb.AddForce(Vector2.down * hiz);
}

if(Input.GetKey(KeyCode.RightArrow)){
rb.AddForce(Vector2.right * hiz);
}
if(Input.GetKey(KeyCode.LeftArrow)){
rb.AddForce(Vector2.left * hiz);
}





}


}
if(temas.gameObject.tag =="Oyuncu1") {
if(Input.GetKey(KeyCode.Space)){
if(Input.GetKey(KeyCode.W)){
rb.AddForce(Vector2.up * hiz);
}

if(Input.GetKey(KeyCode.S)){
rb.AddForce(Vector2.down * hiz);
}

if(Input.GetKey(KeyCode.D)){
rb.AddForce(Vector2.right * hiz);
}
if(Input.GetKey(KeyCode.A)){
rb.AddForce(Vector2.left * hiz);
}





}


}

}
public void OnCollisionEnter2D(Collision2D kale_gol){
if(kale_gol.gameObject.tag=="Kale1"){
gol_1 += 1;
gol2.text = gol_1.ToString();

}



}








}
 
@fratalkanan Bir değeri null döndürüyor. Hatayı büyütüp kaçıncı satırda olduğuna bakar mısın? "gol1" ve "gol2" textlerini Componentler kısmından doldurdunuz mu? Unutmuş olabilirsiniz.
 
İlk başta temas edip etmediğini kontrol etmek için collisionstay ve enter içine debug.log yazar mısın? Eğer bir sıkıntı yoksa ki muhtemelen yok sıkıntı şurda text kısmında sıkıntı var. gol_1 ve 2 yi int tanımla float değil. Ve oyun içinde component kısmına texti ekledin mi? Topun içine eklediğin scripte bir bak gol2 dolu mu?
 
İlk başta temas edip etmediğini kontrol etmek için collisionstay ve enter içine debug.log yazar mısın? Eğer bir sıkıntı yoksa ki muhtemelen yok sıkıntı şurda text kısmında sıkıntı var. gol_1 ve 2 yi int tanımla float değil. Ve oyun içinde component kısmına texti ekledin mi? Topun içine eklediğin scripte bir bak gol2 dolu mu?
text kısmı dolu ne yapayım ben şimdi
 

Geri
Yukarı