//! Called once per frame by unity engine.
    public void Update()
    {
        if (addedModBlocks == false)
        {
            if (ReadyToLoadModBlocks())
            {
                BlockDictionary blockDictionary = GetComponent <BuildController>().blockDictionary;
                blockDictionary.AddModBlocks(blockDictionary.blockDictionary);
                blockDictionary.AddModMachines(blockDictionary.machineDictionary);
                blockDictionary.AddModMeshes(blockDictionary.meshDictionary);
                addedModBlocks = true;
            }
        }

        // Get a refrence to the camera.
        if (mCam == null)
        {
            mCam = Camera.main;

            if (PlayerPrefs.GetFloat("FOV") != 0)
            {
                mCam.fieldOfView = PlayerPrefs.GetFloat("FOV");
            }

            if (PlayerPrefs.GetFloat("drawDistance") != 0)
            {
                mCam.farClipPlane = PlayerPrefs.GetFloat("drawDistance");
            }
        }
        else
        {
            // Disable mouse look during main menu sequence.
            gameObject.GetComponent <MSCameraController>().enabled &= gameStarted != false;

            // Get the spawn location, for respawning the player character.
            if (gotPosition == false)
            {
                originalPosition = transform.position;
                gotPosition      = true;
            }

            // The state manager has finished loading the world.
            if (stateManager.worldLoaded == true)
            {
                gameStarted = true;

                if (FileBasedPrefs.GetBool(stateManager.worldName + "oldWorld") == false)
                {
                    OpenTabletOnFirstLoad();
                }
                else if (movedPlayer == false)
                {
                    MovePlayerToSavedLocation();
                }

                if (ShouldShowTabletIntro())
                {
                    ShowTabletIntro();
                }

                if (checkedForCreativeMode == false && stateManager.worldLoaded == true)
                {
                    creativeMode = FileBasedPrefs.GetBool(stateManager.worldName + "creativeMode");
                    if (creativeMode == true)
                    {
                        Debug.Log("World [" + stateManager.worldName + "] running in creative mode.");
                    }
                    else
                    {
                        Debug.Log("World [" + stateManager.worldName + "] running in standard mode.");
                    }
                    checkedForCreativeMode = true;
                }

                // Destruction messages.
                if (destructionMessageActive == true)
                {
                    if (destructionMessageCount > 10)
                    {
                        currentTabletMessage    = "";
                        destructionMessageCount = 0;
                    }
                    if (destructionMessageReceived == false)
                    {
                        tablet.GetComponent <AudioSource>().Play();
                        destructionMessageReceived = true;
                    }
                }
                else
                {
                    destructionMessageCount    = 0;
                    destructionMessageReceived = false;
                }

                // Pirate attack warnings.
                if (pirateAttackWarningActive == true)
                {
                    currentTabletMessage = "Warning! Warning! Warning! Warning! Warning!\n\nIncoming pirate attack!";
                    if (pirateAttackWarningReceived == false)
                    {
                        tablet.GetComponent <AudioSource>().Play();
                        pirateAttackWarningReceived = true;
                    }
                }
                else
                {
                    pirateAttackWarningReceived = false;
                }

                // Meteor shower warnings.
                if (meteorShowerWarningActive == true)
                {
                    currentTabletMessage = "Warning! Warning! Warning! Warning! Warning!\n\nIncoming meteor shower!";
                    if (meteorShowerWarningReceived == false)
                    {
                        tablet.GetComponent <AudioSource>().Play();
                        meteorShowerWarningReceived = true;
                    }
                }
                else
                {
                    meteorShowerWarningReceived = false;
                }

                if (timeToDeliver == true)
                {
                    DisplayDeliveryWarning();
                }
                else
                {
                    timeToDeliverWarningRecieved = false;
                }

                if (destroying == true)
                {
                    ModifyCombinedMeshes();
                }

                if (requestedBuildingStop == true)
                {
                    HandleBuildingStopRequest();
                }

                // The player controller is notified that the game manager finished combining meshes.
                if (stoppingBuildCoRoutine == true && gameManager.working == false)
                {
                    stoppingBuildCoRoutine = false;
                }

                if (requestedChunkLoad == true)
                {
                    HandleChunkLoadRequest();
                }

                // Locking or unlocking the mouse cursor for GUI interaction.
                if (GuiOpen())
                {
                    Cursor.visible   = true;
                    Cursor.lockState = CursorLockMode.None;
                    gameObject.GetComponent <MSCameraController>().enabled = false;
                }
                else
                {
                    Cursor.visible   = false;
                    Cursor.lockState = CursorLockMode.Locked;
                    gameObject.GetComponent <MSCameraController>().enabled = true;
                }

                if (requestedSave == true)
                {
                    HandleSaveRequest();
                }

                if (storageInventory != null && storageGUIopen == true)
                {
                    CheckStorageDistance();
                }

                if (stateManager.saving == false)
                {
                    inputManager.HandleInput();
                    EnforceWorldLimits();
                }

                if (PlayerPrefsX.GetPersistentBool("multiplayer") == true)
                {
                    networkController.NetworkFrame();

                    if (networkController.networkWorldUpdateCoroutineBusy == false)
                    {
                        networkWorldUpdateCoroutine = StartCoroutine(networkController.NetWorkWorldUpdate());
                    }
                }
            }
        }
    }