Search Unity

  1. How can our website serve you better? Give us your feedback. Take our survey and let us know.
    Dismiss Notice

Resolved Too many massive prefabs

Discussion in 'Prefabs' started by l33t_P4j33t, Dec 30, 2020.

  1. l33t_P4j33t

    l33t_P4j33t

    Joined:
    Jul 29, 2019
    Posts:
    189
    I have hundreds of massive prefabs stored within a scriptable object, and the game works by instantiating these prefabs at runtime at random

    however, its getting to the point that unity editor crashes whenever i open a directory with the scriptable object. I assume how it works is that whenever there is a reference to the scriptable object, all of the game's assets also have to be loaded too, no?

    whats a non terrible solution?

    the only alternative i can think of is splitting the prefabs into hundreds of scenes, including them in build, loading them at runtime and then doing GameObject.Find("prefab-#432"); but that's pretty terrible
     
    Last edited: Dec 30, 2020
  2. l33t_P4j33t

    l33t_P4j33t

    Joined:
    Jul 29, 2019
    Posts:
    189
    something something asset bundles
     
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    5,803
    I can think of two ways of the top of my head:
    1. Use LazyLoadReference to reference Prefabs.
    2. Integrate Addressables and use AssetReference to reference Prefabs.
    I haven't used LazyLoadReference myself yet, but I would try this one first. Integrating Addressables in an existing project can be a tremendous task and I ran in many issues doing that.
     
    l33t_P4j33t likes this.
unityunity