Hello! I am still practicing with Unity and doing tiny things just to learn.
I was trying to do a random transform for a prefab. It is ok for position and scale, but I have a little problem with rotation.
Some assets (or prefabs) have a plane in their mesh. I was trying to make that if they have a plane in it’s mesh do not touch the X and Z axis so the player will still can see it from his point of view.
I managed to do it with the next:
if (item.GetComponent<MeshFilter>().sharedMesh.ToString () == "Plane (UnityEngine.Mesh)")
Debug.Log ("I am a Plane");
else
Debug.Log ("I am not a plane!");
It works, but I am not sure if it is the better way to do it. I mean… Could a mesh be a plane but not be part of UnityEngine.Mesh?
Thanks so much for your help!