//TODO: Fix the animation initialization public void initColor(bool color) { colorState = color; //Inizialization of ignoring layers //Set the animation to the Black or White Sprite if (color) { groundState.setWallMask(neutralWallMask + blackWallMask); playerAnimator.SetTrigger("SetBlack"); } else { groundState.setWallMask(neutralWallMask + whiteWallMask); playerAnimator.SetTrigger("SetWhite"); } Physics2D.IgnoreLayerCollision(gameObject.layer, 9, !colorState); Physics2D.IgnoreLayerCollision(gameObject.layer, 10, colorState); }