# Update global distance min/max variable from code?

**URL:** <https://qa.fmod.com/t/update-global-distance-min-max-variable-from-code/19569>\
**Category:** Unity\
**Tags:** unity\
**Created:** [November 23, 2022, 7:11pm UTC](https://qa.fmod.com/t/update-global-distance-min-max-variable-from-code/19569 "2022-11-23T19:11:18Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![cj2heads](https://avatars.discourse-cdn.com/v4/letter/c/ecb155/32.png) [@cj2heads](https://qa.fmod.com/u/cj2heads)\
**Post date:** [November 23, 2022, 9:37pm UTC](https://qa.fmod.com/t/update-global-distance-min-max-variable-from-code/19569/2 "2022-11-23T21:37:19Z")

</div>

I have found this in the API docs which seems to get me pretty close:

[https://www.fmod.com/docs/2.02/api/studio-api-eventinstance.html#fmod\_studio\_event\_property\_maximum\_distance](https://www.fmod.com/docs/2.02/api/studio-api-eventinstance.html#fmod_studio_event_property_maximum_distance)

And it looks like I can loop through all loaded banks and all events to get the instances that are playing:

> [@Retrieving info for playing events](https://qa.fmod.com/t/retrieving-info-for-playing-events/11844):
>
> With the Designer API we were able to query which events were currently playing at run-time (EventSystem::getInfo). This allowed us to visualize currently playing audio events within our 3d game world. I was not able to find a way to do this with the Studio API. Is it possible?

I’m going to set that up for now but still holding out that there’s a simpler solution. Would love to hear a response if there is 🙂

---

_[View the full topic](https://qa.fmod.com/t/update-global-distance-min-max-variable-from-code/19569)._
