I know that this is a common question here, but I’ve looked everywhere and I cannot find a solution anywhere. The exact error message is “The best overload for the method ‘SideWalls.ScoreSystem()’ is not compatible with the argument list ‘(String)’.”
The Code for Sidewall.js is
#pragma strict
function OnTriggerEnter2D (HitInfo : Collider2D) {
if (HitInfo.name == "Ball") {
var wallName = transform.name;
ScoreSystem (wallName);
}
}
function ScoreSystem() {
}
and ScoreSystem.js is
#pragma strict
static var Player1Score : int = 0;
static var Player2Score : int = 0;
public var wallName : String;
static function Score (wallName : String) {
if (wallName == "rightWall") {
Player1Score += 1;
}
else {
Player2Score += 1;
}
Debug.Log("Player 1: " + Player1Score);
Debug.Log("Player 2: " + Player2Score);
}