Warning: "Setting scale failed, ignoring request." ?

Has anyone ever gotten a warning in Unity, “Setting scale failed, ignoring request. Please check all scaling axes are non-zero.”?

I’m getting this error. The axes are non-zero, the exact line is below. None of the object’s parents are zero-scale either. This is weird though, setting scale to zero is usually fine anyway.

Exact error message:

Setting scale failed, ignoring
request. Please check all scaling axes
are non-zero.
UnityEngine.Transform:set_localScale(Vector3)
EditorUI:LoadLibrary(Libraries,
Environments, Environments, Boolean,
Int32) (at
Assets/Scripts/LevelEditor/EditorUI.cs:322)
EditorUI:LoadLibrary(Libraries,
Environments) (at
Assets/Scripts/LevelEditor/EditorUI.cs:155)

Exact code from the line:

selectedTile.transform.localScale = new Vector3 (0.2f, 0.0002f, 0.0002f);

Any insight? 99% of the time this code works perfectly, it just infrequently generates this error. Thanks!

Yes I did. I started seeing this in Unity 5.4.1f1 and Unity 5.4.2f1. I had an object with MeshRenderer and MeshCollider. Mesh in both of them contained 0 vertices.

Fix: disable MeshCollider and MeshRenderer before calling SetParent.

Hope this can help you somehow )