I've run into a problem where when the player presses the fire button, the game has to check the names of over 100 weapons at this point such as in the screenshot. It only happens in a function that triggers when the character is told to fire a weapon, so it only happens for one tick normally when playing. The problem comes where if I remove all limitations from the character and rapidly press the fire button, it can get really bad with CPU usage due to that function call. So I was wondering if there is some other way I can do this that isn't so inefficient.
This is not a weapons system such as in an RPG where you just get stat boosts and a special attribute sometimes. These are different kinds of projectiles and such that all behave very differently.