Please support LocalPhysicsMode for Addressables.LoadScene

A while ago this thread was started asking the same question:

but is no longer open for replies.

Why can’t Unity support LoadSceneParameters in Addressables?

We’re using Photon Fusion, and loading scenes there requires local physics per scene.
Currently the only workaround seems to be creating an empty scene and moving game objects from the Addressable scene into it.

But surely the Addressable team could add support for LoadSceneParameters?

Can anyone chime in here? There must be a good reason why this isn’t supported, I’d just like to know why

I’ll see if the team has any insight to share.

1 Like

Thank you @CDF
We will look at introducing these parameters when we can next make public api changes.

Thanks,
Andy

1 Like

Thank you

Hey @andymilsom Just wanted to check in on this.
Are there any plans to add LocalPhysicsMode support into Addressables soon?

I can submit a bug report if it helps track in your system.

1 Like

Yes this is in 1.20.0. Due to a change in API required to add the SceneLoadParameters, we cannot release the change in 1.19.X.
I do not yet have an accurate timescale of when 1.20 will be release unfortunately. I will update this ticket when we have a reasonable estimate for 1.20.0

2 Likes

Thank you

I’m also here with the same need because of physics with Fusion. @CDF are you using the workaround of moving objects into your own newly created scene for now?

It was really disappointing to see this two years after Addressables don't use LoadSceneParameters, don't allow local physics scenes - Unity Engine - Unity Discussions was originally posted. Argh.

@andymilsom Do you know which Unity versions 1.20.0 will be available for? (We’re on 2021.3.x LTS).

Addressables supports all LTS versions of the Editor.
1.20 however may not be verified with our systems for 2019lts and may have to be input manually. For 2021.3 you should be able to see the version in the package manager when available.

1 Like

in 1.20 the parameter doesn’t work at all in 2D.

hmmm, looks like we had a merge in the method that removed using the parameters. I’ll get that fixed ASAP

1 Like

Do we have some good news ? ^^

The PR for the fix has landed in our master branch and will be part of the next Addressables release

1 Like

Sorry I missed this. Kindof, I was using a custom SceneProvider script. Had to use a AssemblyDefinitionReference so I had access to the internals of Addressables. Here was the script I’m using:

using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.ResourceManagement.ResourceLocations;
using UnityEngine.SceneManagement;

namespace UnityEngine.ResourceManagement.ResourceProviders {

    /// <summary>
    /// Temporary fix for loading Addressable scenes in Fusion with multi-peer.
    /// There's still an issue in Addressables 1.20.0 where Addressables doesn't actually provide the loadSceneParameters!
    /// https://discussions.unity.com/t/859999
    /// </summary>
    /// <author>Chris Foulston</author>
    public class FusionSceneProvider : SceneProvider, ISceneProvider2 {

        #region Public Methods

        public new AsyncOperationHandle<SceneInstance> ProvideScene(ResourceManager resourceManager, IResourceLocation location, LoadSceneParameters loadSceneParameters, bool activateOnLoad, int priority) {

            loadSceneParameters.localPhysicsMode = loadSceneParameters.loadSceneMode == LoadSceneMode.Additive ? LocalPhysicsMode.Physics3D : LocalPhysicsMode.None;

            return base.ProvideScene(resourceManager, location, loadSceneParameters, activateOnLoad, priority);
        }

        #endregion
    }
}

Makes the assumption that if scene load mode is additive, then use LocalPhysics3D

Is this gonna be like a 2 month wait or can we get a hot fix?

Just realized that after updating to 1.20.0 that load scene parameters method isn’t actually being used:

8141705--1057010--load_scene.png