private static void CopyCat( EffectCategory copy, EffectCategory old, Dictionary<String, EffectCategory> catIndex ) { var copyObj = copy.obj.transform; var copyRoot = catIndex[rootName].obj.transform; foreach( var child in old.childLoop ) { var copyChild = copyObj.Find( child.name ); if( copyChild == null ) { Main.LogE( "Couldn't find child named: " + child.name ); continue; } copy.AddChild( child.Duplicate( copyChild.gameObject, copy ) ); } foreach( var childCat in old.childCatsLoop ) { var path = childCat.path; var copyTemp = copyRoot.Find( path ); if( copyTemp == null ) { Main.LogE( "Unable to find child at path: " + path ); continue; } var copyCat = new EffectCategory( childCat.name, copyTemp.gameObject, copy ); catIndex[copyCat.name] = copyCat; CopyCat( copyCat, childCat, catIndex ); } }
internal EffectElement(String name, EffectCategory parent) { this.obj = new GameObject(); this.name = name; this.parent = parent; parent.AddChild(this); this.obj.transform.parent = parent.obj.transform.parent; this.scale = Vector3.one; this.position = Vector3.zero; this.rotation = Quaternion.identity; }