- Home /
Color Game Help: Movement, Score, and Game Over Script Problem
I was doing quick Project (my target due in 3 days left), some kind of (color game, where you score points for dropping colored ball on the same floor color) but i got stuck because a certain problem:
The Ball still score points when it drops on different Color,
and i cant move the ball, the moment i put my game over in my Game Manager Script(on the "else if section") can you help me why this is happen?
Answer by rossadamsm · Jan 02, 2019 at 01:02 PM
@BuzzardRaze765 Hi, your code looks like it would work at first glance however without seeing more it is very difficult to say what the issue may be. It could be the size of your colliders on your scoring boxes are to big or you have attached the same BlueMovementBall script to all the different color balls? If you could share the game I could perhaps help more. My advice is to just double check you have assigned all your scripts correctly (I make that mistake often).
Thx for the answer, and Sorry for the Late Reply, but here's what i meant: Every Ball$$anonymous$$ovement Script was actually same, i just put a different gameobject name on each OnTriggerEnter, which means i put name Yellow on Ball$$anonymous$$ovementYellow Script's OnTriggerEnter, right here void OnTriggerEnter(Collider other){ if (other.gameObject.name =="Yellow") { Destroy (gameObject); ScoreText.ScoreValue += 1; }else if (other.gameObject.name != "Yellow"){ hasStopped = true; FindObjectOfType<Game$$anonymous$$anager>().EndTheGame(); } }
Sorry that i can't share the game. i've tried everything but the size was still too big,
@BuzzardRaze765 I tried to "reproduce" the basics of your game (the movement doesn't really work but you can drag the spheres in the scene to see that you get the desired scoring behaviour). Perhaps just look at how I set it up and you will be able to spot your problem
https://drive.google.com/open?id=1skcDsk5UebbVC-r1kYBxbUmL9xpH6xb3
Your answer
![](https://koobas.hobune.stream/wayback/20220612184931im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Is there a reason why Unity would be able to read one variable in a script and not another? 1 Answer
Why isn't my instance of an object moving? 1 Answer
Left side panel in monodevelop 1 Answer
Why don't I get access to current context with wglGetCurrentContext (OpenGL) 1 Answer
How to prevent an object from instantiating inside another object? 1 Answer