ToniC
ToniC
CC#
Created by ToniC on 8/28/2023 in #help
Can't make my scoring thing work, maybe it's script? help
in PlayerColor script, all those methods are buttons (TurnRed, TurnBlue, TurnGreen, TurnYellow), except for DestroyPreviousCheck(), when any of those buttons are pressed, player changes to it's color, and instantiates a circle without sprite renderer, only a collider to check which color is active for it to then react and get a score if both collors are correct, which is now on the script called NewIfColor, it checks if the color of the player and the color of the object that's falling are the same, if so, then get a point (points are in GameManager script), if not, destroy the character(for now, later I'll make game over screen), and this is where the problem is, even though the colors are the same player does get the point, but he also loses, I don't know why, and also, even when the colors aren't matching, he will get a point and still lose, and I don't know why that is happening, why do I get this error: "NullReferenceException: Object reference not set to an instance of an object IfColor.OnTriggerEnter2D (UnityEngine.Collider2D otherCollider) (at Assets/Scripts/IfColor.cs:51)" I get the same error but for different colors. And spawn script is just a script that spawns the falling objects
2 replies