- Home /
Where to put debug methods and variables
Hi all,
I was wondering where in my MonoBehaviour should I put some methods and [SerializableFields] fields for debugging (for example for RayCast drawings).
I have think about:
Simply have the methods and fields inside the class, with the prefix myDebug_, for example
Have a [SerializableField] class MyDebug as a field of my MonoBehaviour and pass the entire MonoBehaviour as parameter to the constructor (at start), and keep inside this class the debug fields and methods
What do you think would be the ideal design? I accept other ideas.
Thanks
Doesn't matter where you put debug info, just remember to remove it once you're done debugging, or before compiling. Also avoid debug calls in heavy iterations, Unity uses a method to run the debugs through to the console, it has a $$anonymous$$ASSIVE overhead, barely noticeable for a few calls, but a million calls, yup you'll be locked up for a good 5-10 $$anonymous$$utes. Permitted your ram can store that many calls, since the debug console is cached.
Your answer
Follow this Question
Related Questions
Developing an extensible framework for a video game 1 Answer
Decoupling with a path-finding algorithm 1 Answer
Good Player Input/Controller Design 1 Answer
Documenting Unity classes/ components/ system 1 Answer
Unity architecture 3 Answers