Advertisement

Hi all. I need help with my C# script on Unity 5.

Started by December 01, 2016 07:57 PM
12 comments, last by Eulagrief 8 years ago

Hi ferrous.

I have tried a couple of things.

Manually re-doing the ball.

Manually re-doing deleting and placing all colliders.

Ball does not collide with paddle when the scene start. Ball will only move up on left mouse click and start colliding with paddle after.

At the time of "game over" or when it trigger the collision, the ball is still on top of the paddle. If you take a look at the last picture, the ball is on top of the paddle, not colliding or triggering the game over scene (which is the bottom of the screen) but it still trigger the game over scene. It's like there is an invisible collider colliding with the losecollider.

I am quite sure I am doing something wrong but I can't find out what it is.

:(

Try this:

- There's a toggle button on Unity's console window called "Error Pause". Enable it.
- Put a Debug.LogError in your OnTriggerEnter2D and comment out the LoadScene.

When the LogError executes, it will suspend the game on that frame. Switch to Unity's scene view and examine everything in your scene hierarchy to find out what happened.
Advertisement

Omg. I am so dumb. :(

I knew I did something wrong.

The default setting for RigidBody2D was Dynamic.

All I had to do was change it to Kinematic and the problem goes away!

Try this:

- There's a toggle button on Unity's console window called "Error Pause". Enable it.
- Put a Debug.LogError in your OnTriggerEnter2D and comment out the LoadScene.

When the LogError executes, it will suspend the game on that frame. Switch to Unity's scene view and examine everything in your scene hierarchy to find out what happened.

I will give it a try later.

Thank you everyone for the help.

My pure carelessness. :(

Ding! Ding! Ding!

Zesi has worked it out!

I've been working through the code, and trying to suss it. I was going for a null start position being below the LoseCollidor<some vector being zero or null>

Pah!

This topic is closed to new replies.

Advertisement