Chapter 12: Completing the VR Game
This chapter continues from the previous one and completes the VR first-person shooter project by focusing on the underpinning code and functionality for creating gameplay, both in VR and using a keyboard and mouse.
Creating and destroying objects is an expensive process. An Object Pool helps to improve performance by retrieving objects from a fixed pool that was previously instantiated at a suitable time (that is, during the initial run or a loading screen). It also aids memory fragmentation by instantiating the objects together in memory in one go. Memory fragmentation occurs when the heap is broken into unnecessarily small chunks, preventing you from instantiating any new objects even if there is enough free space (just not contiguously). With this in mind, it is a good idea to become familiar with the concept, so in this chapter, we'll create an Object Pool that will store our enemy objects.
As discussed in Chapter 9, Continuing with...