For anyone wondering about a better way for hiding these cheat codes so the Internet people don’t abuse your game
You can use UNITY_EDITOR scripting symbol (Unity - Manual: Conditional Compilation) .
Like this:
#if UNITY_EDITOR
private bool debugCollisionDisabled;
#endif
private void Update() {
#if UNITY_EDITOR
if (Input.GetKeyDown(KeyCode.C)) {
debugCollisionDisabled = !debugCollisionDisabled;
}
#endif
}
private void OnCollisionEnter(UnityEngine.Collision collision) {
#if UNITY_EDITOR
if (debugCollisionDisabled) {
return;
}
#endif
... (rest of the code) ...
}