Quantcast
Channel: Questions in topic: "assetbundle"
Viewing all articles
Browse latest Browse all 1593

Using Occlusion Culling with remotely downloaded Asset Package

$
0
0
In the Unity project I'm working on, I'm downloading a fairly large (potentially multiple hundreds of megabytes) unity Asset Package from my server. Every user's project is different, so I can't bundle these Asset Packages into my app - they have to be downloaded from a server. I'm having a lot of performance issues since there are tons of meshes in the asset package, but only a few hundred are visible at a given time. I've read the docs on [Occlusion Culling][1], but as I understand it you have to enable it in the Unity Editor for every object which you need culled, something that won't work for me since I'm downloading these packages from a server. I'm using an asset bundle loader script similar to this: public class AssetBundleLoader : MonoBehaviour { void Start() { StartCoroutine(GetAssetBundle()); } IEnumerator GetAssetBundle() { UnityWebRequest www = UnityWebRequestAssetBundle.GetAssetBundle("https:///myurl.com/myasset"); yield return www.SendWebRequest(); if (www.isNetworkError || www.isHttpError) { Debug.Log(www.error); } else { AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(www); AssetBundleRequest request = bundle.LoadAllAssetsAsync(); yield return request; GameObject loadedObject = (GameObject)request.asset; GameObject.Instantiate(loadedObject, Vector3.zero, Quaternion.identity); Debug.Log("Successfully Loaded Asset Bundle"); } } } My current idea to get around this is that when I download the asset package and convert it into a GameObject, I'll walk through the tree of children GameObject and add an [OcclusionArea][2] component to them. Note that all these objects have non-transparent materials. My question is - will this approach work? Is there a different approach I could be taking instead? Since the lack of dynamic occlusion culling here really slows down my app, I'm open to any ideas on how I could implement it, including writing my own scripts. Baking these asset packages into my app is not an option, though. [1]: https://docs.unity3d.com/Manual/OcclusionCulling.html [2]: https://docs.unity3d.com/Manual/class-OcclusionArea.html

Viewing all articles
Browse latest Browse all 1593

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>