
르탄이가 비를 맞으면 점수가 올라가야하는데 어디서 코드가 꼬인 건진 모르겠는데
이런 오류 창이 뜨고 있습니다.

작성한 코드 및 에러 메세지
오류 발생 시, 작성한 코드 전체와 에러 메시지를 첨부해 주세요.
Tip 1) </> 아이콘을 눌러 코드박스를 만들어 보세요.
Tip 2) Ctrl+A(맥의 경우 Command+A) 단축키로 코드를 한 번에 선택할 수 있어요!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SocialPlatforms.Impl;
using UnityEngine.UI;
public class GameManager : MonoBehaviour
{
public GameObject rain;
public static GameManager I;
public Text scoreText;
int totalScore;
void Awake()
{
I = this;
}
// Start is called before the first frame update
void Start()
{
InvokeRepeating("makeRain", 0, 0.1f);
}
// Update is called once per frame
void Update()
{
}
void OnCollisionEnter2D(Collision2D coll)
{
if (coll.gameObject.tag == "ground")
{
Destroy(gameObject);
}
if (coll.gameObject.tag == "rtan")
{
GameManager.I.addScore(score);
Destroy(gameObject);
}
}
void makeRain()
{
Instantiate(rain);
}
public void addScore (int score)
{
totalScore += score;
}
public void addScore(int score)
{
totalScore += score;
scoreText.text = totalScore.ToString();
}
}
