Hey community, I have a scene that has an empty GameObject with children Cube GO’s and 12 Unity Planes with the nightTime simple water Material and script as its children. so as a total with transorm.countChildren, that’s 9990 objects. I dragged the parent GO into a prefab so i could set some variables in the editor at runtime.
Of course it’s still making the prefab, so i was wondering… is unity really filling the prefab, or will it crash?
the script on the cubes are:
using UnityEngine;
using System.Collections;
[AddComponentMenu("Controls/Spawn Opject 1 Unit Above transform")]
//[ExecuteInEditMode]
public class ClickDestroy : MonoBehaviour {
Vector3 pos;
GameObject var;
void Update() {
pos = transform.position;
pos.y +=1F;
Mats.CompareMaterials(transform,"ClickDestroy");
}
void OnMouseOver() {
if(Input.GetKeyDown(KeyCode.Mouse0)) {
var = Instantiate(SpecOps.curcube,pos,Quaternion.identity) as GameObject;
var.rigidbody.AddForce(0,1000,0);
}
}
}
I’m working on an iMac 12,2 with an intel core i5; Mac OS X 10.6.8 (10K540)
So from my observation, it doesn’t matter (to a reasonable point) how many objects an object has as it’s children, it can be made into a prefab. It just might take a little while. For future reference for anyone else, it will work as long as those x amount of children don’t have a too complicated script or material or mesh on it.