void VisitToCreateMesh_r(GameObject go) { if (go.GetComponent <Renderer>()) { var mesh = ComponentHelper.GetMesh(go); if (!containerTable.Contains <MeshContainer>(mesh.GetInstanceID())) { var c = new MeshContainer(mesh); containerTable.Add(c.InstanceId, c); } } for (int i = 0; i < go.transform.childCount; i++) { VisitToCreateMesh_r(go.transform.GetChild(i).gameObject); } }
public override void Initialize <T1>(T1 comp, INodeTable <int> containerTable) { base.Initialize(comp, containerTable); // find mesh & material if (Value is MeshRenderer || Value is SkinnedMeshRenderer) { var mesh = ComponentHelper.GetMesh(Value.gameObject); Mesh = containerTable.Get <MeshContainer>(mesh.GetInstanceID()); // TODO material이 여러개인 경우는? var mtl = Value.sharedMaterial; Material = containerTable.Get <MaterialContainer>(mtl.GetInstanceID()); } else { throw new NotImplementedException("unknown renderer " + comp.GetType().ToString()); } }