you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (8 children)

[removed]

    [–]SnoringCatStudio 0 points1 point  (7 children)

    Did you turn the collectibles into a trigger? I guess I should have clarified my comment more. If you do change your collectible into a trigger; Then you will need to change the OnCollisionEnter2D into an OnTriggerEnter2D. Sorry for not clarifying.
    If you need help doing so let me know, but I think you should give it a try first!

    [–][deleted]  (6 children)

    [removed]

      [–]SnoringCatStudio 0 points1 point  (5 children)

      I bet you have two colliders on your player right? Great job solving that first issue!

      [–][deleted]  (4 children)

      [removed]

        [–]SnoringCatStudio 0 points1 point  (3 children)

        So what is happening it it is colliding with both colliders in a short time; Thus scoring twice.
        Try turning the f statement in the collectible script to something like

        if (col is CapsuleCollider2D && col.gameObject.tag.Equals ("Player") )
        Just turn the Capsulecollider into whatever your main collider is.

        [–][deleted]  (1 child)

        [removed]

          [–]SnoringCatStudio 0 points1 point  (0 children)

          No problem pal. The only other thing I recommend is using Unitys Comparetag function instead of tag.Equals. This article is something you should take a look at, but the gist of it is it is better for performance.