Hi, I have a script that checks if a button pressed executes an event. For VR controllers whenever the user pressed a button a monobehaviour invokes an event and when the event executed everything that subscribed to that event gets called.
Problem is that this method forces me to create so many if statements about 100 - 150. I profiled the game and whenever the user presses a button Time ms jumps up to 1474.50 ms. When a button is not pressed game usually runs around 30 - 40 ms.
I’m not quite sure what is the issue here. Yes, I have so many if statements and they are called every frame in the update. But when buttons are not pressed, no issue. When a button is pressed there is a significant drop. It doesn’t matter if the event gets called from that button has subscribers or not even an empty click causes drops.
Any idea why it might be happening? Here are some screenshots from profiler and script that causes those drops.