I’m creating an endless flyer in which prefabs are loaded and placed as the player flys further into the path.
Right now the prefabs all take up exactly 500 units of space and their spawn points are hard coded so that they simply spawn 500 points further along the z axis then the path prefab before them.
I’m attempting to make this system more flexible, allowing for different sized prefabs.
I have tried
GetComponent().bounds.size.z
GetComponent().bounds.size.z
GetComponant().(just about everything)
and all kinds of other options none of these return the real value of the prefab, and thus my paths build on top of one another.
The prefabs are empty game objects with no renderers as of now, I did add mesh renderers to them to try out the ().bounds… option but this returns with a value of 0.