protected virtual SyncObjectBinding ImportInstance(StreamInstance stream) { var syncObjectBinding = SyncPrefabImporter.CreateInstance(GetInstanceRoot(stream.key.source), stream.key.source, stream.instance, this); #if UNITY_EDITOR var box = stream.boundingBox; var min = new Vector3(box.Min.X, box.Min.Y, box.Min.Z); syncObjectBinding.bounds = new Bounds(min, Vector3.zero); syncObjectBinding.bounds.Encapsulate(new Vector3(box.Max.X, box.Max.Y, box.Max.Z)); #endif return(syncObjectBinding); }
public override void OnImportAsset(AssetImportContext ctx) { var syncPrefab = PlayerFile.Load <SyncPrefab>(ctx.assetPath); Init(syncPrefab.Name); var root = SyncPrefabImporter.Import(syncPrefab, this); var names = new List <string>(); SetUniqueNameForRoots(root, ref names); // TODO Find a deterministic way to avoid name collisions. RemapMaterials(root); ctx.AddObjectToAsset("root", root.gameObject); ctx.SetMainObject(root.gameObject); }