Boxcollider does not support negative scale

Hello, unity tell me this, and when my player go up, this move withouth use it. I change the size a positive numbers but not working, now I have this.
How I can fix?

thanks.

Did you check all of the scene objects with the same name? Is there a corresponding prefab with a negative scale or transform?

It literally tells you in the error what is wrong, what object it is, and how to fix it.

Thanks LaneFox, I was trying change the number, for not take more things in the game, but what you say, it’s working, thanks.
Kdgalla, yes, all corresponding a prefab and all have some negative number.

If your prefab instance’s X scale is negative, then make the box collider’s X scale negative also, and it will quash the warning. This is pretty common in art assets, where they only give you the left-handed version of some prefab but then they make a scene with left- and right-handed instances.

public static void FixNegativeBoxCollider(BoxCollider box)
{
    Vector3 lossy = box.transform.lossyScale;
    Vector3 flip = new Vector3(
        Mathf.Sign(lossy.x),
        Mathf.Sign(lossy.y),
        Mathf.Sign(lossy.z));
   Vector3 sign = new Vector3(
        Mathf.Sign(box.size.x),
        Mathf.Sign(box.size.y),
        Mathf.Sign(box.size.z));
    if (flip != sign)
    {
        Undo.RecordObject(box, "Fix Negative Box Collider");
        box.size = Vector3.Scale(box.size, flip);
    }
}
1 Like

Thanks, It’s working