ValveSoftware / steamvr_unity_plugin

SteamVR Unity Plugin - Documentation at: https://valvesoftware.github.io/steamvr_unity_plugin/
BSD 3-Clause "New" or "Revised" License
1.03k stars 256 forks source link

SteamVR 2.7.3 allocates #1007

Open AndersMalmgren opened 2 years ago

AndersMalmgren commented 2 years ago

image

This is a build player that I am benchmarking

AndersMalmgren commented 2 years ago

Forgot to expand the first allocation

image

AndersMalmgren commented 1 year ago

Hey guys any news on this? It still allocates. Makes our game spike from GC collection


        public static bool enabled
        {
            get
            {
#if UNITY_2020_1_OR_NEWER || OPENVR_XR_API
                if (XRSettings.supportedDevices.Length == 0)
                    enabled = false;
#else
                if (!XRSettings.enabled)
                    enabled = false;
#endif
                return _enabled;
            }
            set
            {
                _enabled = value;

                if (_enabled)
                {
                    Initialize();
                }
                else
                {
                    SafeDispose();
                }
            }
        }
AndersMalmgren commented 1 year ago

UNity docs says, Returns a list of supported XR devices that were included at build time.

Seems safe to cache

AndersMalmgren commented 1 year ago

@zite i have talked with unity and its safe and best practice to cache the result from getSupportedDevices

https://forum.unity.com/threads/xrsettings-get_supporteddevices-allocate.1364541/#post-8609667