Search Unity

Is there/will there be a way to have bundled items placed in scenes?

Discussion in 'Addressables' started by BinaryEclipse, Dec 11, 2018.

  1. BinaryEclipse

    BinaryEclipse

    Joined:
    Sep 1, 2016
    Posts:
    43
    In our game, weapons are everywhere, integrated in the environment. At the moment, when I change an item in the bundle, the weapons already in the environment are unchanged, but newly spawned items use the new version. I imagine that this means the item exists in the project twice - once in the project, and once in the bundle. I admit that it being in the project is partially my fault because we are not fully converted to addressables yet - we still have some direct references, but I imagine the issue would still persist if a weapon is located in the scene unless this was explicitly handled somehow.

    I tried to do Addressables.LoadScene to see if it would tackle my concern, but I could not get it to work. Does it not take a string for the scene? I've tried giving it the scene name, giving it the path name (with and without the .unity extension) and I've tried making the path the same as the name, but all to no avail.

    How can I get this load scene method to work? And if that's not the way to solve my primary concern, what is (short of manually instantiating and replacing all objects in the scene)?
     
  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    I'm not sure I totally understand your request, so I'll give some general info that hopefully guides you the right way...
    1. a prefab or game object in a scene is built into that scene. If you also build the prefab into a bundle, it's a copy. Updating the bundle will not change the one in the scene
    2. Once you instantiate a prefab into a scene, it is not tied back to the source loaded asset. So if you unloaded a prefab, changed the bundle while running, and reloaded it, the instantiated version would be unchanged.