I can get the corner coordinates of a game object, but when I instantiate the prefab (that is when I convert the game to an object), the corner coordinates are not correct. I thought it might be because the prefab has more than one child. For example, I want to get the corner coordinates of a bed. Therefore, I think it is sufficient to get the corner coordinates of the footed foundation body (child) of the mattress. But how can I do that?
Also, how can I get the width and length values of the prefab?
Thank you everyone in advance for the help.
I’m not sure what you mean by corner coordinates, could you please elaborate? Is you prefab a cube or?..
To get the width and length of a prefab is actually quite easy.
//put this script into the prefab of the object you want the length and width of
private float width;
private float length;
void start()
{
width = transform.position.x; // returns a copy of the width of the prefab
length = transform.position.y; // returns a copy of the length of the prefab
}