Forum Discussion
Alchemist11th
1 year agoExplorer
Unity OVRInput.Get() caching for performance?
In Unity, I normally cache any GetComponent() if I plan on using it within the Update(). Is the OVRInput.Get similar? Everyone online seems to just put code like OVRInput.Get(OVRInput.RawButton.X) ...
- 1 year ago
At least what I have seen is unlike GetComponent(), OVRInput.Get is already optimized internally. The OVRManager handles input polling and state management efficiently, so you don't need to cache these calls like you would with GetComponent(). When you call OVRInput.Get(OVRInput.RawButton.X), you're essentially just checking a value that's already been updated by OVRManager in its internal update cycle. It's more like checking a property than performing an expensive component lookup. If you're using the same input check multiple times within the same Update() cycle, it would be marginally more efficient to cache it.
4vit
1 year agoExplorer
At least what I have seen is unlike GetComponent(), OVRInput.Get is already optimized internally. The OVRManager handles input polling and state management efficiently, so you don't need to cache these calls like you would with GetComponent(). When you call OVRInput.Get(OVRInput.RawButton.X), you're essentially just checking a value that's already been updated by OVRManager in its internal update cycle. It's more like checking a property than performing an expensive component lookup. If you're using the same input check multiple times within the same Update() cycle, it would be marginally more efficient to cache it.
- Alchemist11th1 year agoExplorer
Thank You! I appreciate the response.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 1 month ago
- 4 years ago
- 6 years ago