Dont forget to remove your cheatcodes / Debug.Keys!

I know I did:P.

1 Like

As a preparation I put that part into a separate script. The debugging actions are a bit more complicated as they call “LoadNextLevel()” in another script for example, but I think it should be worth it to have a clean structure where all those debugging is concentrated into a single script.

What’s still missing now is how to leave that script (or at least having it connected with the player object) out of a release build…

1 Like

That a good idea^^. Will do this next game. Thanks:)

You’re welcome.

This is what I’ve done:

DebugHelper.cs:

using UnityEngine;

public class DebugHelper : MonoBehaviour
{
    CollisionHandler ch;
    void Start()
    {
        ch = gameObject.GetComponent<CollisionHandler>();
    }

    void Update()
    {
        if( Input.GetKeyDown(KeyCode.L))
        {
            ch.LoadNextLevel();
        }
        if (Input.GetKey(KeyCode.C))
        {
            ch.isCheating = !ch.isCheating;
        }
    }
}

and in my CollisionHandler.cs:

public class CollisionHandler : MonoBehaviour
{
    public bool isCheating = false;
[...]
    void StartCrashSequence()
    {
        if( isCheating ) { return; }
[...]
2 Likes

This is a good Idea was thinking of doing it but didn’t bother in the end as its a few line of Code but in future games will definitely make it separate. Also @Paula I Forgot to remove mine and had to go back and rebuild :sweat_smile:

1 Like

Privacy & Terms