Auto Saving using box collider?

I’m actually beginner here in unity. I’m creating a saving without using button, i want to use a trigger box collider so that when the player run to it, it will save but i can’t find any tutorial like that but if you have tutorial guys can i get a link :).

What you want is easily achievable. But, before anything else, I should encaurage you to search about Unity’s JsonUtility and, well… Reading MSDN C# Guide, since it can and will help you with some C# core coding.

DISCLAIMER - Everything I wrote here works for me and correspond to my usual workflow, so opinions may differ on which is the best practice and which isn’t.

Now, for me, the safest way to save stuff is to save to a .json file from an isolated serialized public class. Let me explain:

// I have a Profile class. It holds my personal data.
public class Profile
    public string name;
    public string email;
    public string randomPasswordDecoderKey:

    public void Save ()
        ProfileJSON profile = new ProfileJSON ()
            name =,
            email =

        // This string has the path to the file. You could save it to whererver you wanted to.
        // For simplicity's sake I'll use the StreamingAssets folder.
	    string finalPath = $"{Application.streamingAssetsPath}/profile.json";

		// The newFile receives all of the values contained on the profile, converted to the
        // .json text format.
        // The .json file is then found through the path (if not, it is created) then opened.
        // The newFile is finally written into the .json file, and then the file is closed.
        string newFile = JsonUtility.ToJson(profile);
	    File.WriteAllText(finalPath, newFile);

    public void Load ()
        ProfileJSON profile = new ProfileJSON ();

        // This string has the path to the file. You need to specify the same path as the save,
        // otherwise it won't be able to find the file.
	    string finalPath = $"{Application.streamingAssetsPath}/profile.json";

		// The jsonString receives all of the values contained on the profile.json file.
        // Then we simply override the values of our ProfileJSON instance using FromJsonOverwrite.
        string jsonString = File.ReadAllText(finalPath);
        JsonUtility.FromJsonOverwrite(jsonString, profile);

        // Also, don't forget to set the values of this profile after that! :-) =; =;

// This is a public Serializable class that is isolated from the rest of the code.
// For some reason my Password Decoder Key is public, but I don't want to save it to a text file.
// So, to avoid that we create this class, which only contains the name and the e-mail of the profile.
// Think of it like a temporary folder where you'll place your files before moving 'em
// to the final directory.
public class ProfileJSON
    public string name;
    public string email;

You could just call the Save method on OnTriggerEnter. The Load one could be used on either Start or Awake.

Hopefully this answer will help you in some way!

PS: Please, DON’T forget to add using System.IO at the top of the .cs file you’re using to save stuff.