legoandmars / GorillaCosmetics

A cosmetic mod for Gorilla Tag.
MIT License
47 stars 208 forks source link

fix for scoreboard nullref spam every frame for each player #20

Closed AHauntedArmy closed 2 years ago

AHauntedArmy commented 2 years ago

every frame the scoreboard tries to set the player swatch color to the material color, if the custom material selected doesn't have a "_Color" property available it would cause the scoreboard line to throw a null error that's its missing, for each player its missing on. the same also happened when letting the scoreboard line use the material for the swatch material, it would throw an error over "_MainTex" being missing.

the solution i have is the expand the VRRig's array by 1 and add the custom material to the end, patch ChangeMaterialLocal so if the material wanted is the none infected material, set the index to be the end of the array where the custom material is saved, after the original function runs to update everything, set the VRRigs stored index value back to 0 so the scoreboard doesn't try to use the custom material for the swatch material.