My notes from this talk and other research
Use OnBecameVisible and OnBecameInvisible to shut down unseen behaviours
Unity encourages the use of Update() for each game object but there are alternatives. Use IENumerator to create a coroutine.
Transform.position will have performance issues if the object you’re calling it on is deep in a hierarchy. The code must iterate through the entire hierarchy to find the world position of the object.
Garbage collection is expensive and is triggered when the programme runs out memory. Fragmentation can cause this to happen at any point our game. Ideally we should try and prevent this by cleaning the memory when the performance impact will be least noticed. We can use System.GC.Collect() durning level loads. There’s more in the advanced section of the Unity Manual
Use structs instead of classes for local data. Structs are allocated memory on the stack and get removed when the variable goes out of scope. Class instances are allocated on the heap and must be garbage collected.
Preallocated reusable objects can be stored for later use. An example of object pooling is Astro Dude on the unity asset Store.
This Unite talk was made in 2012. The presenter states that the unity GUI system is not that memory friendly. Alas I don’t know if the situation has improved which may mean that I’ll be writing some of my game code.
Primitive colliders are much cheaper the mesh colliders. Even a bunch of primitive colliders may still outperform a mesh collider.
unity Documentation on Script Performance Optimization
Gamasutra Article on optimizing the iOS action platformer Shadow Blade.