Sacchan-VRC / SaccFlightAndVehicles

Other
109 stars 25 forks source link

EngineController throws System.OverflowException #5

Closed esnya closed 3 years ago

esnya commented 3 years ago

Tested versions:

I tested it with 1.4. But, the code hasn't changed, so it should still occur on the HEAD of master .

The float.Parse in the L1694 of EngineController.cs is probably the cause. If the hierarchy of AAMTarget[n] is too deep, order[n].ToString() will be in exponential notation (e.g., 1.23456E+08), and a number will be added to the end of it (e.g, 1.23456E+080), causing the parsing to fail.

https://github.com/Sacchan-VRC/SaccFlightAndVehicles/blob/d714dfae1b86e934112e04d424dd2c36c40ae2a7/Scripts/Vehicle/EngineController.cs#L1694

If it is int, this problem should not occur.

order[n] = float.Parse($"{(int)order[n]}{parent.transform.GetSiblingIndex()}");