// Makes any object that should not be visible by this camera invisible by changing their layer
    // right before the culling.
    private void OnPreCull()
    {
        // Get all temporarily and permanently known objects from each figurine owned by the player attached to this camera.
        foreach (GameObject playerFig in figs.GetOwnedFigurines())
        {
            Figurine_PlayerVision playerVis = playerFig.GetComponentInChildren <Figurine_PlayerVision>();

            tempKnownObjects.UnionWith(playerVis.GetTempKnownObjects());
            permKnownObjects.UnionWith(playerVis.GetPermKnownObjects());
        }

        // Makes all permanently known non-fog objects visible.
        foreach (GameObject go in permKnownObjects)
        {
            if (!go.CompareTag("Fog"))
            {
                if (go.CompareTag("Obstacle"))
                {
                    go.transform.parent.gameObject.layer = defaultLayer;
                }
                else
                {
                    go.layer = defaultLayer;
                }
            }
        }

        // Makes all temporarily known fog cells invisible and all other temporarily known objects visible.
        foreach (GameObject go in tempKnownObjects)
        {
            if (go.CompareTag("Fog"))
            {
                go.layer = invisibleLayer;
            }
            else
            {
                go.layer = defaultLayer;
            }
        }
    }
    public void ChangePlayerGM()
    {
        isGM = true;
        //Save position of previous player.
        SavePosition();

        //GM is placed at the same spot all the time.
        gmm.physicalPlayer.transform.GetChild(0).position = gmm.GetGameMasterPos();
        Debug.Log("GM y-pos: " + gmm.physicalPlayer.transform.GetChild(0).position.y);
        gmm.physicalPlayer.transform.GetChild(0).rotation = gmm.GetGameMasterRotation();
        UpdatePlayerAvatar();

        //change later to make dependencies better
        pof.ChangeOwnedFigurines(gmm.GetActivePlayers()[0].GetOwnedFigurines());
        Debug.Log("OwnedFigurines: " + pof.GetOwnedFigurines());

        mainCamera.cullingMask = ~(0);

        if (activePlayer.playerColor != null)
        {
            text.text = "GM is active. " + "\nPrevious player: " + activePlayer.playerColor.name;
        }
    }