Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice
  2. Read here for Unity's latest plans on OpenXR.
    Dismiss Notice

Help Wanted Custom CameraPoseProvider in Functionality Island not working

Discussion in 'Unity MARS' started by csteinberg, Nov 20, 2020.

  1. csteinberg

    csteinberg

    Joined:
    Mar 15, 2019
    Posts:
    2
    I am trying to write a custom CameraPoseProvider for use in simulation and I found the SimulatedCameraPoseProvider script and am working from a copy of this as a template. I created my TestCameraPoseProvider (with an extremely high priority as a test) and set this as a default provider in both the Default Island and a custom Functionality Island asset and set these explicitly in the MARS Session Advanced panel. When I hit play in the editor the IProviderCameraPose object that is spawned always has the SimulatedCameraPoseProvider script attached.

    I have tried various things (increasing the priority, setting various Platform overrides, the custom Functionality Island asset, assigning both the IProvidesCameraPose as the class as well as trying it as a prefab object with my TestCameraPoseProvider behavior attached, etc...) but nothing seems to override the SimulatedCameraPoseProvider being assigned in the Editor in Play mode except instantiating a copy of the TestCameraPoseProvider prefab in the scene explicitly. From the documentation, it seems like it should be selected from the Functionality Island instead, but this does not seem to be the case.
     
  2. mtschoen

    mtschoen

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    140
    Hi there!

    I think what's going on is that, even in play mode, we use the SimulatedDiscoveryIsland by default. Under ProjectSettings > MARS > Simulation, you should see a section labeled Scene Module. There is an option for "Simulate in Play Mode" which is likely checked. If you uncheck it, you will use the default island in Play mode, but what you likely want to do (to keep the environment loading and simulate plane discovery) is expand the Advanced section below and click the field with the SimulatedDiscoveryIsland asset in it. That should bring you to the asset, and from there you can reveal it in Explorer or Finder and make a copy of it in your Assets folder. Set that copied island as your simulated discovery island back in the Project Settings window, and you can use it to customize the providers used in simulation.

    The priority and platform overrides weren't helping you in this case because the SimulatedDiscoveryIsland already has a default provider for camera pose, which takes precedence over the provider selection attributes. Ultimately, it may be best for us to copy these settings into your project by default but we were trying to minimize the amount of files that get added to your Assets folder on import wherever possible.
     
    csteinberg likes this.
  3. csteinberg

    csteinberg

    Joined:
    Mar 15, 2019
    Posts:
    2
    I can confirm that this resolves the issue I was experiencing. Thanks!
     
unityunity