Jump to content

Saving/Loading and Quick Travel suggestions?


Roman

Recommended Posts

Save/Loading:

Hey guys, I'm making a horror game where the player explores back and forth solving puzzles, akin to resident evil, and so far Sectr has been great to making huge chunks of levels in a single scene, but I was wondering, if I had to implement safe rooms, how can I make it so that the save room is the first loaded area in the main scene?

In my main scene, I have a neighbor loader in my camera, and a sectr member, it's portal determined, and it has a force start sectr. Would I have to keep the SectrMember on a separate scene that doesn't get deleted before loading the main scene, or could I just change sects when the main scene starts?

 

Fast Travel:

Considering I have the SectrMember in the main camera (it's a first person game), and it's portal determined, I was wondering if there's a way to implement fast travel from one point to another? I'm mostly curious about how to handle the loading/unloading before moving the player aspect.

 

EDIT: Bonus, I'm also working with EasySave3, if anyone has any experience pairing both, I'd appreciate any advice.

Link to comment
Share on other sites

On 5/16/2023 at 5:34 PM, Roman said:

Hey guys, I'm making a horror game where the player explores back and forth solving puzzles, akin to resident evil, and so far Sectr has been great to making huge chunks of levels in a single scene, but I was wondering, if I had to implement safe rooms, how can I make it so that the save room is the first loaded area in the main scene?

Have you tried Async Loading? 
Then using something like Easy Save I am not sure if they have something like this that would help. 
Or if you would want to make your own custom save that would save position. 
Kinda reminds me of the old Left For Dead series. 

 

 

On 5/16/2023 at 5:34 PM, Roman said:

Considering I have the SectrMember in the main camera (it's a first person game), and it's portal determined, I was wondering if there's a way to implement fast travel from one point to another? I'm mostly curious about how to handle the loading/unloading before moving the player aspect.

You might want to take a look into the demo and look at the door loading. 
Firewatch actually did something similar to this. Which could help you in both scenarios. 
They created a custom script that allowed them to name each sector like a scene. 
Then they simply use that script to swap out sectors based on parameters they set. 

May not work, but this might help. 

 

using System.Collections;
using UnityEngine;
using UnityEngine.SceneManagement;

public class SceneController : MonoBehaviour
{
    // Define an instance to allow other scripts to call methods
    public static SceneController instance;
    
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
    }

    public void SwitchScene(string sceneName)
    {
        StartCoroutine(LoadScene(sceneName));
    }

    IEnumerator LoadScene(string sceneName)
    {
        // You can show a loading screen here if you have one
        yield return null;

        // Start loading the scene
        AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(sceneName);

        // Wait until the scene is fully loaded
        while (!asyncOperation.isDone)
        {
            // You can update a loading bar here if you have one
            yield return null;
        }
    }
}



SCRIPT 2 
 

using UnityEngine;

public class SceneTrigger : MonoBehaviour
{
    // This string can be set from the Unity Inspector to choose which scene the trigger will load
    public string sceneToLoad;

    // This method is called when another collider enters this GameObject's trigger zone
    private void OnTriggerEnter(Collider other)
    {
        // Only switch scene if the other collider is the player (or whatever object you choose)
        if (other.CompareTag("Player"))
        {
            SceneController.instance.SwitchScene(sceneToLoad);
        }
    }
}

 

This OnTriggerEnter method will be triggered when a collider enters the trigger zone of the GameObject this script is attached to. If you need other ways to trigger the scene swap, you can write similar methods that respond to other events.

Remember to properly setup your scenes in the "Scenes in Build" list in Build Settings and make sure that objects that should trigger the scene swap have the appropriate tag ("Player" in this case). Also, the GameObject with SceneTrigger attached should have a Collider (with "Is Trigger" checked) component for the OnTriggerEnter method to work.

Link to comment
Share on other sites

Thank you very much! This helps a lot to get me on the right track.

I was mostly curious if Sectr already had implementations for this so that I wouldn't have to do a separate version hehe Thanks, I'll look into the door demo.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

×
×
  • Create New...