void Register () {
if (registered) return;
registered = true;
//Clamp area, upper limit isn't really a hard limit, but if it gets much higher it will start to interfere with other stuff
area = Mathf.Clamp (area,-1,1 << 25);
Renderer rend = renderer;
Collider coll = collider;
if (rend == null && coll == null) throw new System.Exception ("A renderer or a collider should be attached to the GameObject");
MeshFilter filter = GetComponent<MeshFilter>();
if (rend != null && filter == null) throw new System.Exception ("A renderer was attached but no mesh filter");
//Default to renderer
if (rend != null) {
bounds = rend.bounds;
} else {
bounds = coll.bounds;
}
_dynamic = dynamic;
if (_dynamic) {
dynamicMeshObjs.Add (this);
} else {
tree.Insert (this);
}
}