public void LoadBounds() { DebugOutput.Shout("Starting BoundsOctrees test"); Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); DebugOutput.Shout("Testing LoadingBounds"); string fileName = "OctreeData/" + BoundsName; TextAsset ta = (TextAsset)Resources.Load(fileName); BinaryReader br = new BinaryReader(new MemoryStream(ta.bytes)); DebugOutput.Shout("bounds were created: " +br.ReadString()); bounds = new BoundsOctree(null, 0, BoundsName, boundsSize, transform.position, br.ReadInt32(), null); bounds.CreateFromStream(br); foreach (var relatedOctree in bounds.relatedOctrees) { relatedOctree.RefreshNeighbors(); } BoundsOctree origoBound = bounds.GetBound(true, transform.position + startingPoint); if (origoBound != null) { origoBound.EstablishRelations(); } else { DebugOutput.Shout("Origopoint is unreachable."); } stopWatch.Stop(); DebugOutput.Shout("Finished Loading bounds in "+stopWatch.ElapsedMilliseconds +" milliseconds."); int cnt = 0; foreach (var relatedBounds in bounds.relatedOctrees) { if (relatedBounds.Empty && relatedBounds.Related) { cnt++; } } DebugOutput.Shout("finished bounds in " + (stopWatch.ElapsedMilliseconds) + ", a total of " + bounds.relatedOctrees.Count + " octrees remains, of which " + cnt + " is traversable"); }