Search Unity

Player clips behind/in front of objects during its idle animation

Discussion in '2D' started by GreenPuppy14, Jun 6, 2017.

  1. GreenPuppy14

    GreenPuppy14

    Joined:
    Jun 6, 2017
    Posts:
    3
    Hopefully I'm posting my question in the right place!

    So while my character animates, it clips in front of/behind objects as it bobs up and down in its idle animation and I'm not sure why. In all the instances, the player is meant to be in front of the objects. Said objects are all platforms that can be walked in front of but also jumped on top of. Here's a video of what's going on (the quality is seriously embarrassingly terrible and I'm so so sorry)

    I'm not quite sure what further information is needed so here are some scripts that may or may not be relevant:

    Player Script (C#): https://pastebin.com/gmJq2Ntd
    Collision Trigger Script (C#): https://pastebin.com/uEAC62uV
     
  2. LiterallyJeff

    LiterallyJeff

    Joined:
    Jan 21, 2015
    Posts:
    2,807
    Double check that your sorting layers are correct, and that you didn't accidentally animate the sorting order or Z position or something that could cause it to clip in the Idle animation.
     
  3. GreenPuppy14

    GreenPuppy14

    Joined:
    Jun 6, 2017
    Posts:
    3
    Thanks so much! Fixed my problem!
     
    LiterallyJeff likes this.