Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Modify Conditions at Runtime

Discussion in 'Unity MARS' started by Jared_playstudios, Aug 12, 2020.

  1. Jared_playstudios

    Jared_playstudios

    Joined:
    Mar 27, 2019
    Posts:
    11
    I think that MARS is great for developing AR experiences within Unity. I'm curious about how to approach modifying conditions at runtime.

    Particularly, I'm interested in getting a config from a server, and updating geofence coordinates of a proxy's condition at runtime. I'm hoping that this has been considered, and is made available either through an existing design pattern. Maybe something like "AddOrUpdateTrait" through "IProvidesTraits", or by levering a CreateFromData functionality?

    Building a Replicator and Proxy at Runtime seems like a reasonable task, but I'm not seeing how to do that procedurally / at runtime. It feels like this is might align with the design patterns by leveraging a data model, and generating a proxy from an instance of the data model.

    Any recommendations / examples?

    I see how one might write a class inheriting from Condition<Vector2> and defining a mutable GeographicCoordinate property that can be set at runtime, but this feels like a lot of effort, and introducing a new access pattern that wouldn't be recommended.
     
  2. Jared_playstudios

    Jared_playstudios

    Joined:
    Mar 27, 2019
    Posts:
    11
    I've ended up creating a new class that extends Condition<Vector2>. I think that's the best approach I would recommend, based on the other design patterns within MARS. It feels straight forward, and works really well with creating prefabs, and proxies. Seems to fit better than trying to update any other internal condition class.
     
  3. leweyg_unity

    leweyg_unity

    Unity Technologies

    Joined:
    Jan 29, 2020
    Posts:
    38
    Quick answer: enable and disable the proxy for the conditions to update (NOTE: not all ProxyGroup conditions update under these circumstances). Ideally keep the proxy disabled until it is fully configured then, enable it. Re building Proxies at runtime, this is supported, just try to keep the object (and it's parent) disabled until fully configured. This is a known issue.
     
    Jared_playstudios likes this.