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 How do I set "Reset On Loss" from script?

Discussion in 'Unity MARS' started by jmeyer_a, Mar 2, 2021.

  1. jmeyer_a

    jmeyer_a

    Joined:
    Nov 4, 2020
    Posts:
    1
    In a MARS session, I want to give the user the option to freeze currently found horizontal planes. There is an Editor setting, but I would like to access this Boolean from script (C#).

    I tried
    Code (CSharp):
    1. HorizontalPlane.GetComponent<Proxy>().GetComponent<SetPoseAction>().ResetOnLoss = true;
    but "ResetOnLoss" is not exposed.

    How do I access this Boolean?
     
  2. mtschoen

    mtschoen

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    140
    Hi there! Thanks for using MARS.

    It looks like this was an oversight on our part. There is no public accessor for `m_ResetOnLoss`, so you will have to either us reflection, or embed the MARS package and modify our code to add this property. The easiest way to do this is by copying the package from your project's `Library/PackageSource` folder into the `Packages` folder, or to use the `Client.Embed` method of the Package Manager API.

    We will be sure to add an accessor property for this field in a future release of MARS.
     
    jmeyer_a likes this.
unityunity