- Home /
Prevent Script from being disabled on exception.
Is there a way to prevent a script from being disabled on exception. I am trying to make my save game script so it resets the save game file if any of the saved values become invalid when it throws the exception "OutOfMemoryException: Out of memory" But the script disables itself so It doesn't delete and rewrite the corrupted save file. Anyone know a way to re-enable or keep the script enabled when an exception occurs or to find a way around this?
Answer by Casiell · Mar 15, 2019 at 09:45 AM
You should validate values yourself, not wait for an exception. And if your validation fails, then you can do your thing with no exceptions involved
The lazy way would be to just put everything in a try-catch block, but that's the worse out of this two ideas
Your answer
Follow this Question
Related Questions
Copy reference from one component to another derived component., 2 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Select a type from the inspector 0 Answers
Visual Studio Code Debugger Throws Random Exception 0 Answers