I've spent all my time since last weekend on re-factoring code to make it easier for others to read (as we now have two new developers) and adding some workarounds for some of the more....irritating aspects of Unity


Example -

You can access the transform (3d waypoint) of a game object with the command gameobjectname.transform. One would expect this to be a direct access to a reference of the game objects transform, but under the hood unity is actually looping through all the components on the game object, grabbing anything that's a transform, then returning the first one it found. It does this every time, despite unity enforcing game objects to only ever having one transform . To overcome this, in locations where I am accessing the transform in every game loop(or every network update cycle) I'm creating my own direct reference to the transform at game object creation time, then accessing that direct reference with each loop. This fix alone has shaved a worryingly large number of milliseconds off a game loop.



I've been burning through a few issues like that and replacing some of my own code that has become less efficient as the game has developed. So, yeah, nothing new to test tonight so no update.

There will be one next weekend.