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’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Question Accessing proxy conditions at runtime (from script)

Discussion in 'Unity MARS' started by secret_portal_mike, Nov 9, 2020.

  1. secret_portal_mike

    secret_portal_mike

    Joined:
    Jul 11, 2018
    Posts:
    5
    Hi, I have a visual that I would like to size using the configured plane size condition on a proxy. I am having trouble getting at the PlaneSizeCondition from the proxy itself. I can see there is a "conditions" property on each proxy, and the TryGetType function on the ProxyConditions class, but I have been unable to get it return anything useful. Is this sorta of introspection of the active conditions possible at runtime? Can anyone point me in the right direction?! Thanks :)
     
  2. amydigiov_Unity

    amydigiov_Unity

    Unity Technologies

    Joined:
    May 24, 2016
    Posts:
    15
    Hi @secret_portal_mike, if you want your proxy's content to scale with the size of its plane you can add the StretchToExtentsAction component to your visual. For this to work the game object for your visual will have to be underneath the proxy in the hierarchy. This action matches the object's X and/or Z scale to the plane's size depending on how you set the "Planar Stretch" field. If you want to scale Y instead of X or Z you should have StretchToExtentsAction on its own game object, place the visual under this object, and rotate the visual accordingly.
     
  3. secret_portal_mike

    secret_portal_mike

    Joined:
    Jul 11, 2018
    Posts:
    5
    thanks I'll give it a shot!