World Streamer Integration
World Streamer 2 (Atavism 10.4.0+)
With Atavism X.4 we introduced even easier to use integration with World Streamer 2
In order to use it, you will need World Streamer from the Unity Asset Store.
To integrate World Streamer 2 with Atavism follow this quick guide.
- Import World Streamer 2 from the Unity Asset Store
- Tick World Streamer 2 integration checkbox in the Atavism Editor.
World Streamer 2 (Atavism 10.3.0-)
We have introduced even easier to use integration with World Streamer 2.
In order to use it, you will need World Streamer 2 from the Unity Asset Store.
Atavism has a new advanced loading screen that is prepared for integration with World Streamer 2.
To integrate World Streamer 2 with Atavism follow this quick guide.
- Import World Streamer 2 from the Unity Asset Store
- Tick World Streamer integration checkbox in the Atavism Editor.
- Find Streamer.cs file in your project and open it to modify its content (mostly find //Dragonsan sections, copy and paste these sections into proper functions, according to the below code snippets)
- Add at the beginning of the script such line
using Atavism;
- Replace
public class Streamer : MonoBehaviour
withpublic class Streamer : AtavismStreamer
- Add below code before last closing bracket }
public override int GetTilesToLoad() { return tilesToLoad; } public override int GetTilesLoaded() { return tilesLoaded; } public override float GetLoadingProgress() { return (tilesToLoad > 0) ? tilesLoaded / (float)tilesToLoad : 1; }
- Insert below code into Awake function
void Awake() { //if (spawnedPlayer) //{ // player = null; //} //Dragonsan start section if (ClientAPI.GetPlayerObject() != null) { GameObject go = ClientAPI.GetPlayerObject().GameObject; if (go != null) player = go.transform; } //Dragonsan end section foreach (var sceneCollectionManager in sceneCollectionManagers) { sceneCollectionManager.ResetPosition(); } }
- Insert below code into PositionChecker coroutine
IEnumerator PositionChecker() { while (true) { if (spawnedPlayer && player == null && !string.IsNullOrEmpty(playerTag)) { GameObject playerGO = GameObject.FindGameObjectWithTag(playerTag); //Dragonsan start section if(ClientAPI.GetPlayerObject() != null && playerGO==null) playerGO = ClientAPI.GetPlayerObject().GameObject; //Dragonsan end section if (playerGO != null) player = playerGO.transform; } if (streamerActive && player != null) { CheckPositionTiles(); } else { bool loadedScenes = false; foreach (var sceneCollectionManager in sceneCollectionManagers) { if (sceneCollectionManager.loadedScenes.Count > 0) { /* loadedScenes = true; sceneCollectionManager.ResetPosition();*/ } } if (loadedScenes) UnloadAllScenes(); } yield return new WaitForSeconds(positionCheckTime); } }
- Comment these selected lines
- Insert below code into SceneUnloading function
private void UnloadScenes(List<SceneSplit> scenesToDestroy) { foreach (var item in scenesToDestroy) { //Debug.Log("UnloadScenes " + item.sceneName); //if (item.sceneGo != null) //{ // Terrain childTerrain = item.sceneGo.GetComponentInChildren<Terrain>(); // if (childTerrain) // { // GameObject childTerrainGO = childTerrain.gameObject; // Destroy(childTerrain); // childTerrain = null; // Destroy(childTerrainGO); // childTerrainGO = null; // } //} item.loaded = false; item.loadingFinished = false; item.sceneCollectionManager.loadedScenes.Remove(item); item.sceneGo = null; //Dragonsan start section tilesLoaded--; //Dragonsan end section loadingManager.UnloadSceneAsync(item.scene); }
- Insert below code into the bl_SceneLoader file
using WorldStreamer2;
- Add at the beginning of the script such line
World Streamer
With Atavism 2019.1 we introduced even easier to use integration with World Streamer.
In order to use it, you will need World Streamer from the Unity Asset Store.
Atavism 2019.1 has a new advanced loading screen which is prepared for integration with World Streamer.
to integrate World Streamer with Atavism follow this quick guide.
- Import World Streamer from the Unity Asset Store
- Tick World Streamer integration checkbox in the Atavism Editor.
- Find Streamer.cs file in your project and open it to modify its content (mostly find //Dragonsan sections, copy and paste these sections into proper functions, according to the below code snippets)
- Add at the beginning of the script such line
using Atavism;
- Replace
public class Streamer : MonoBehaviour
withpublic class Streamer : AtavismStreamer
- Add below code before last closing bracket }
public override int GetTilesToLoad() { return tilesToLoad; } public override int GetTilesLoaded() { return tilesLoaded; } public override float GetLoadingProgress() { return (tilesToLoad > 0) ? tilesLoaded / (float)tilesToLoad : 1; }
- Insert below code into Awake function
void Awake () { if (spawnedPlayer) { player = null; } //Dragonsan start section GameObject go = ClientAPI.GetPlayerObject().GameObject; if (go != null) player = go.transform; //Dragonsan end section xPos = int.MinValue; yPos = int.MinValue; zPos = int.MinValue; }
- Insert below code into PositionChecker coroutine
IEnumerator PositionChecker () { while (true) { if (spawnedPlayer && player == null && !string.IsNullOrEmpty (playerTag)) { GameObject playerGO = GameObject.FindGameObjectWithTag (playerTag); //Dragonsan start section if(ClientAPI.GetPlayerObject() != null && playerGO==null) playerGO = ClientAPI.GetPlayerObject().GameObject; //Dragonsan end section if (playerGO != null) player = playerGO.transform; } if (streamerActive && player != null) { CheckPositionTiles (); } else if (loadedScenes.Count > 0) { UnloadAllScenes (); xPos = int.MinValue; yPos = int.MinValue; zPos = int.MinValue; } yield return new WaitForSeconds (positionCheckTime); } }
- Comment these selected lines
- Insert below code into SceneUnloading function
void SceneUnloading () { List<SceneSplit> scenesToDestroy = new List<SceneSplit> (); foreach (var item in loadedScenes) { if (Mathf.Abs (item.posX + item.xDeloadLimit - xPos) > (int)deloadingRange.x || Mathf.Abs (item.posY + item.yDeloadLimit - yPos) > (int)deloadingRange.y || Mathf.Abs (item.posZ + item.zDeloadLimit - zPos) > (int)deloadingRange.x) if (item.sceneGo != null) scenesToDestroy.Add (item); if (useLoadingRangeMin) if (Mathf.Abs (item.posX + item.xDeloadLimit - xPos) <= loadingRangeMin.x && Mathf.Abs (item.posY + item.yDeloadLimit - yPos) <= loadingRangeMin.y && Mathf.Abs (item.posZ + item.zDeloadLimit - zPos) <= loadingRangeMin.z) if (item.sceneGo != null) scenesToDestroy.Add (item); } foreach (var item in scenesToDestroy) { loadedScenes.Remove (item); if (item.sceneGo != null) { Terrain childTerrain = item.sceneGo.GetComponentInChildren<Terrain> (); if (childTerrain) { GameObject childTerrainGO = childTerrain.gameObject; Destroy (childTerrain); childTerrain = null; Destroy (childTerrainGO); childTerrainGO = null; } } #if UNITY_5_3 || UNITY_5_3_OR_NEWER try { SceneManager.UnloadScene (item.sceneGo.scene.name); } catch (System.Exception ex) { Debug.Log (item.sceneName); Debug.Log (item.sceneGo.name); Debug.Log (item.sceneGo.scene.name); Debug.LogError (ex.Message); } #else GameObject.Destroy (item.sceneGo); #endif item.sceneGo = null; item.loaded = false; //Dragonsan start section tilesLoaded--; //Dragonsan end section } scenesToDestroy.Clear (); if (terrainNeighbours) terrainNeighbours.CreateNeighbours (); Streamer.UnloadAssets (this); }
- Add at the beginning of the script such line