Hello,
I am new to Adventure Creator and am hitting an issue with long startup times when using Unity's play in editor feature.
A popular technique for building levels is to construct them from many reusable modular set pieces. My 3D game scene uses this technique. These tiles are marked as static. My current map has around 200 of these geometry prefab instances all parented to an empty named 'Geometry'. They are untagged and set to layer Ignore Raycast. These tiles each have their own colliders using Unity's physics system (characters can walk on them). I have opted for Unity's pathfinding and baked the navmeshes. I am using Unity 4.6.2f1 and Adventure Creator 1.42c
Here are some benchmarks of time from when I click the play button to when the game is playable (these are approximate since I'm timing using a stopwatch by hand)
World geometry disabled + GameEngine disabled = ~2 seconds
World geometry enabled + GameEngine disabled = ~2 seconds
World geometry disabled + GameEngine enabled = ~2 seconds
World geometry enabled + GameEngine enabled = ~18 seconds
It looks like the AC GameEngine is interacting with the world geometry at start-up, although being new to AC, I'm not sure why it would need to. As I add more geometry to the world, I imagine this start-up lag will continue increasing.
Can you please advise as to why startup is so slow when many objects are placed and anything I can do to mitigate this issue?
Thanks!
Comments
1) Try switching to MeshCollider pathfinding. No need to supply a NavMesh object - just switching it should be enough to see if it makes a difference
2) Disable the colliders on your world geometry. You should be able to do this in one by bulk-selecting them.
It looks like IgnoreNavMeshCollisions() has a O(n^2) loop with a call to the physics engine, which seems is scaling very poorly. Commenting out IgnoreNavMeshCollisions() inside GatherObjects() allows me to start with only a three second startup time (would prefer 2sec, but it's still way better than 18sec )
Out of curiosity, why does AC ignore nav mesh collisions? Is it safe to skip this if I'm using stock Unity pathfinding?
---
Ignore collision failed. Both colliders need to be activated when calling this IgnoreCollision
UnityEngine.Physics:IgnoreCollision(Collider, Collider)
AC.StateHandler:IgnoreNavMeshCollisions() (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:110)
AC.StateHandler:GatherObjects() (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:97)
AC.StateHandler:GetReferences() (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:85)
AC.StateHandler:Awake() (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:50)
UnityEngine.Object:Instantiate(Object)
AC.KickStarter:Awake() (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:743)
Unfortunately, a lot of the time she prefers to turn in endless circles :P But this doesn't seem to affected by the script change or not.