Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here: unity.com/legal/terms-of-service.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice
  4. Join us on Thursday, September 29, for a day with Unity's SRP teams here on the forum or on Reddit, and discuss topics around URP, HDRP, and the Scriptable Render Pipeline in general.
    Dismiss Notice

Feedback Please support LocalPhysicsMode for Addressables.LoadScene

Discussion in 'Addressables' started by CDF, Oct 26, 2021.

  1. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,196
    A while ago this thread was started asking the same question:
    https://forum.unity.com/threads/add...eters-dont-allow-local-physics-scenes.848929/

    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?
     
  2. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,196
    Can anyone chime in here? There must be a good reason why this isn't supported, I'd just like to know why
     
  3. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,706
    I'll see if the team has any insight to share.
     
    CDF likes this.
  4. andymilsom

    andymilsom

    Unity Technologies

    Joined:
    Mar 2, 2016
    Posts:
    226
    Thank you @CDF
    We will look at introducing these parameters when we can next make public api changes.

    Thanks,
    Andy
     
    CDF likes this.
  5. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,196
    Thank you
     
  6. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,196
    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.
     
    Claytonious likes this.
  7. andymilsom

    andymilsom

    Unity Technologies

    Joined:
    Mar 2, 2016
    Posts:
    226
    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
     
    Claytonious and CDF like this.
  8. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,196
    Thank you
     
  9. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    814
  10. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    814
    @andymilsom Do you know which Unity versions 1.20.0 will be available for? (We're on 2021.3.x LTS).
     
  11. andymilsom

    andymilsom

    Unity Technologies

    Joined:
    Mar 2, 2016
    Posts:
    226
    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.
     
    Claytonious likes this.
  12. bconstantin

    bconstantin

    Joined:
    Feb 4, 2019
    Posts:
    15
    in 1.20 the parameter doesn't work at all in 2D.
     
    Last edited: May 12, 2022
  13. andymilsom

    andymilsom

    Unity Technologies

    Joined:
    Mar 2, 2016
    Posts:
    226
    hmmm, looks like we had a merge in the method that removed using the parameters. I'll get that fixed ASAP
     
    bconstantin likes this.
  14. bconstantin

    bconstantin

    Joined:
    Feb 4, 2019
    Posts:
    15
    Do we have some good news ? ^^
     
  15. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    725
    The PR for the fix has landed in our master branch and will be part of the next Addressables release
     
    CDF likes this.
  16. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,196
    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:

    Code (CSharp):
    1.  
    2. using UnityEngine.ResourceManagement.AsyncOperations;
    3. using UnityEngine.ResourceManagement.ResourceLocations;
    4. using UnityEngine.SceneManagement;
    5.  
    6. namespace UnityEngine.ResourceManagement.ResourceProviders {
    7.  
    8.     /// <summary>
    9.     /// Temporary fix for loading Addressable scenes in Fusion with multi-peer.
    10.     /// There's still an issue in Addressables 1.20.0 where Addressables doesn't actually provide the loadSceneParameters!
    11.     /// https://forum.unity.com/threads/please-support-localphysicsmode-for-addressables-loadscene.1188613/
    12.     /// </summary>
    13.     /// <author>Chris Foulston</author>
    14.     public class FusionSceneProvider : SceneProvider, ISceneProvider2 {
    15.  
    16.         #region Public Methods
    17.  
    18.         public new AsyncOperationHandle<SceneInstance> ProvideScene(ResourceManager resourceManager, IResourceLocation location, LoadSceneParameters loadSceneParameters, bool activateOnLoad, int priority) {
    19.  
    20.             loadSceneParameters.localPhysicsMode = loadSceneParameters.loadSceneMode == LoadSceneMode.Additive ? LocalPhysicsMode.Physics3D : LocalPhysicsMode.None;
    21.  
    22.             return base.ProvideScene(resourceManager, location, loadSceneParameters, activateOnLoad, priority);
    23.         }
    24.  
    25.         #endregion
    26.     }
    27. }
    28.  
    Makes the assumption that if scene load mode is additive, then use LocalPhysics3D
     
    Last edited: May 19, 2022
  17. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,196
    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:

    load_scene.png
     
unityunity