Problem with client/server projectiles destroying each other on collision

I’ve been following along, and keeping pretty much to the project. I’m not sure why the collisions between the projectiles are triggering the DestroySelfOnContact.OnTriggerEnter2D(). The effect is that the projectiles spawn and destroy themselves instantly.

The project settings has projectile to projectile unchecked:
PhysicsChart
I have it debugging to check what’s triggering:

    private void OnTriggerEnter2D(Collider2D collision) {
        Debug.Log(gameObject.name + " DestoySelfOnContact with " + collision.name);
        Destroy(gameObject);
    }

I’m getting this in the console when I fire:
Error1

Both client and server projectiles are to have colliders, right? Is there a step that I possibly missed?

No, client projectiles should not have colliders. They are just the visual representation. The server side is what determines collision.


Wait, I’m wrong. Let me just quickly run through the lecture again

1 Like

OK, I am wrong. Haven’t done this part of the course in a while. The collider is on both. Make sure that both the client projectile and server projectile is on the Projectile layer

Is your screenshot of the Physics settings or Physics2D settings? I think it needs to be the Physics2D if you used 2D colliders like in the course.

1 Like

Thank you. I missed that these settings were in the 2D physics section in the video somehow. He had switched to the tab in 2D Physics. I didn’t see that the grid for 2D Physics is actually on another tab when I was double checking. Thank you.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms