public static void FinalizePlayerObjectEditor(GameObject playerObj, GaiaSettings gaiaSettings) { if (playerObj != null) { playerObj.transform.SetParent(GaiaUtils.GetPlayerObject().transform); #if UNITY_EDITOR //Adjust the scene view to see the camera if (SceneView.lastActiveSceneView != null) { if (gaiaSettings.m_focusPlayerOnSetup) { SceneView.lastActiveSceneView.LookAtDirect(playerObj.transform.position, playerObj.transform.rotation); } } #endif } GaiaSessionManager session = GaiaSessionManager.GetSessionManager(); if (session != null) { if (session.m_session != null) { if (playerObj.transform.position.y < session.m_session.m_seaLevel) { playerObj.transform.position = new Vector3(playerObj.transform.position.x, session.m_session.m_seaLevel + 5f, playerObj.transform.position.z); } } } #if GAIA_PRO_PRESENT //Add the simple terrain culling script, useful in any case if (GaiaUtils.CheckIfSceneProfileExists()) { GaiaGlobal.Instance.SceneProfile.m_terrainCullingEnabled = true; } #endif bool dynamicLoadedTerrains = GaiaUtils.HasDynamicLoadedTerrains(); if (dynamicLoadedTerrains) { #if GAIA_PRO_PRESENT TerrainLoader loader = playerObj.GetComponent <TerrainLoader>(); if (loader == null) { loader = playerObj.AddComponent <TerrainLoader>(); } loader.LoadMode = LoadMode.RuntimeAlways; float tileSize = 512; if (TerrainLoaderManager.Instance.TerrainSceneStorage.m_terrainTilesSize > 0) { tileSize = TerrainLoaderManager.Instance.TerrainSceneStorage.m_terrainTilesSize; } float size = tileSize * 1.25f * 2f; loader.m_loadingBoundsRegular = new BoundsDouble(playerObj.transform.position, new Vector3(size, size, size)); loader.m_loadingBoundsImpostor = new BoundsDouble(playerObj.transform.position, new Vector3(size * 3f, size * 3f, size * 3f)); loader.m_loadingBoundsCollider = new BoundsDouble(playerObj.transform.position, new Vector3(size, size, size)); #endif } }