I am building a dungeon generation system, which the plan was to have each room know its exits, and check if there is room to generate the next piece before doing so.
The problem I am running into is that I am creating all of these objects on start, and so, they may be created, but their colliders cannot be raycasted against until the first FixedUpdate (a little bit of behaviour I found out about from the Physics.Raycast page:
Notes: This function will return false if you cast a ray from inside a sphere to the outside; this in an intended behaviour. If you move colliders from scripting or by animation, there needs to be at least one FixedUpdate executed so that the physics library can update it’s data structures, before a Raycast will hit the collider at it’s new position.
I don’t see any way on the physics page to manually force it to rebuild its data structures, but am wondering if there is a function in some other static class that can be called to force it to rebuild its collider data structures. If one exists, it would be a massive help.
If not, it would be possible to make it so that the generator can track what room it’s generating, and only add one room per FixedUpdate - but that would be a massive pain to write, and it would slow down the process of generating dungeons quite a bit.