VRIF save between scenes.

Discussion and help for Easy Save 3
Post Reply
ProfessorJay
Posts: 10
Joined: Thu Feb 17, 2022 8:01 am

VRIF save between scenes.

Post by ProfessorJay »

Good afternoon,
I am having a troublesome time with an easy save situation. This is not for any reason the fault of moodkie, I am just not a professional coder or game maker and so I see the information and I cant put it all together and need more help figure it out than most.

ok, I saw another thread on this forum (and also mailed him as well) as he had a similar problem. maybe he will reply on discord, but I thought it would also be good to ask here. I am using VRIF a VR base asset. I have a prefab game object (an artifact) that instantiates at the end of a level. the player can pick it up and put in a box that is marked "don't destroy on load" as then it will transfer over to hub level museum. Now when I get the game object to the next scene, I can attach it to a "snap zone" (this is also like the thread from frostamation). however when I save and load the object, it doesn't load back into the snap zone. I know the object needs to be enabled easy save for prefab. I also know that all the other objects that are in the scene initially work fine, as those objects are native to the scene and not brought from a different scene, putting them in snap zones and loading and saving works fine. I get that all things work fine if they are from the original scene, given easy save for prefab and saved.

how does someone take an object from another scene and save into a different scene? I read in the frostamation thread that because of the scene change reference ID is probably different and an object needs a static ID, how do you do this? I'm completely clueless where you would put the "es3referencemngr" or anything else for that matter. I also thought you only need easy save manager on the scene you save on, if I'm trying to move an object from one scene to another, does every scene with an object instantiated at runtime need an easy save manager for the sake of reference ID? does every scene need to have easy save enabled on each object that would be moved between scenes?

I'm sorry I hope this makes sense, I am losing my mind trying to figure it out. I know I am asking a lot. I am at the end of my project and did not realize how tough it would be to actually make something save.
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: VRIF save between scenes.

Post by Joel »

Hi there,

I'm afraid we can't provide support specific to VRIF as we have no experience with this tool, but I can provide a general answer to your question:
how does someone take an object from another scene and save into a different scene?
Just to check, have you followed the Saving and Loading GameObjects and Prefab Instances guide?
https://docs.moodkie.com/easy-save-3/es ... s-prefabs/

The general workflow is:
  1. Right-click the prefab and select Easy Save 3 > Enable Easy Save for Prefab.
  2. Use ES3.Save to save your prefab instance in your first scene.
  3. Use ES3.Load to load your prefab instance in your second scene.
As mentioned in the guide, only Components which are explicitly supported on the prefab will have it's fields saved/loaded. For more information on how to add explicit support for a Component, see the Choosing what is saved guide:
https://docs.moodkie.com/easy-save-3/es ... -is-saved/
does every scene with an object instantiated at runtime need an easy save manager for the sake of reference ID?
Regarding the Easy Save 3 Manager, you will be prompted with a warning in the console to add one if you need one (it is required in any scene where you're saving or loading references). In your case you will need one in both of your scenes as you're saving or loading references in both scenes. You can add these by going into each scene and selecting Tools > Easy Save 3 > Add Manager to Scene.
I'm completely clueless where you would put the "es3referencemngr"
You do not need to manually add an ES3ReferenceMgr Component to anything and you will never be prompted to do so. This is included in the Easy Save 3 Manager.
does every scene need to have easy save enabled on each object that would be moved between scenes?
If you're saving prefab instances, each of the prefabs you're creating an instance from will need to have Easy Save enabled for it.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
ProfessorJay
Posts: 10
Joined: Thu Feb 17, 2022 8:01 am

Re: VRIF save between scenes.

Post by ProfessorJay »

Just to check, have you followed the Saving and Loading GameObjects and Prefab Instances guide?
https://docs.moodkie.com/easy-save-3/es ... s-prefabs/

The general workflow is:
Right-click the prefab and select Easy Save 3 > Enable Easy Save for Prefab.
Use ES3.Save to save your prefab instance in your first scene.
Use ES3.Load to load your prefab instance in your second scene.
As mentioned in the guide, only Components which are explicitly supported on the prefab will have it's fields saved/loaded. For more information on how to add explicit support for a Component, see the Choosing what is saved guide:
I get how this works, but I am not sure where you put this information: "// Save a GameObject.
ES3.Save("myGameObject", go);

// Load a GameObject, automatically assigning it to an existing
// GameObject if one exists, or create a new GameObject if not.
ES3.Load("myGameObject", defaultGo);"
my prefab objects in the level instantiate a random game object each time the player is on the scene. do i make a new script and just say "es3.save("artifact01", go) and put it on each game object that is instantiated?
ProfessorJay
Posts: 10
Joined: Thu Feb 17, 2022 8:01 am

Re: VRIF save between scenes.

Post by ProfessorJay »

The general workflow is:
Right-click the prefab and select Easy Save 3 > Enable Easy Save for Prefab.
Use ES3.Save to save your prefab instance in your first scene.
Use ES3.Load to load your prefab instance in your second scene.
I understand how this part works, the prefab is not in the scene at first however, its a prefab instance that is scripted to spawn when the scene loads and the player reaches the end and pick it up. the player then puts it in the box which is dont destroy on load and then can change scenes. the object is in the box when the new scene loads but it doesnt save intrhe new scene.
I guess im just really stupid because for most people this would be easy, but i seem to be missing something. I honestly dont know where to put es3.save and es3.load. the easy save aspect was fine. I made two buttons with save and load for a scene, and saved the whole scene, but of course the game object from the previous scene did save in the new scene because it was not from the scene that weas being saved.
ProfessorJay
Posts: 10
Joined: Thu Feb 17, 2022 8:01 am

Re: VRIF save between scenes.

Post by ProfessorJay »

ES3.Save("myGameObject", go)
is go just GameObject? so if my gameobject was called artifact02 it would be ES3.Save("artifact02", GameObject)

sorry this is probably very obvious for coders
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: VRIF save between scenes.

Post by Joel »

ProfessorJay wrote: Fri Sep 16, 2022 9:14 am
Just to check, have you followed the Saving and Loading GameObjects and Prefab Instances guide?
https://docs.moodkie.com/easy-save-3/es ... s-prefabs/

The general workflow is:
Right-click the prefab and select Easy Save 3 > Enable Easy Save for Prefab.
Use ES3.Save to save your prefab instance in your first scene.
Use ES3.Load to load your prefab instance in your second scene.
As mentioned in the guide, only Components which are explicitly supported on the prefab will have it's fields saved/loaded. For more information on how to add explicit support for a Component, see the Choosing what is saved guide:
I get how this works, but I am not sure where you put this information: "// Save a GameObject.
ES3.Save("myGameObject", go);

// Load a GameObject, automatically assigning it to an existing
// GameObject if one exists, or create a new GameObject if not.
ES3.Load("myGameObject", defaultGo);"
my prefab objects in the level instantiate a random game object each time the player is on the scene. do i make a new script and just say "es3.save("artifact01", go) and put it on each game object that is instantiated?
As you are instantiating a variable number of GameObjects it would be best to put them all in a List<GameObject> and save this from a separate script.
is go just GameObject? so if my gameobject was called artifact02 it would be ES3.Save("artifact02", GameObject)

sorry this is probably very obvious for coders
The first parameter is the key, which is a string which uniquely identifies the data in the file. For information what each parameter of the Easy Save methods mean please see the Getting Started guide and the API page for the Easy Save methods:
https://docs.moodkie.com/easy-save-3/getting-started/
https://docs.moodkie.com/easy-save-3/es ... /es3-save/
https://docs.moodkie.com/easy-save-3/es ... /es3-load/

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
ProfessorJay
Posts: 10
Joined: Thu Feb 17, 2022 8:01 am

Re: VRIF save between scenes.

Post by ProfessorJay »

As you are instantiating a variable number of GameObjects it would be best to put them all in a List<GameObject> and save this from a separate script.
I have all of the objects in an array. the instantiate/array script is on a game object that uses its own transform position as the instantiation/spawning point for gameobjects. does making that game object an es3 prefab affect/ make the gameobjects it instantiates into es3 prefab objects automatically? :o
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: VRIF save between scenes.

Post by Joel »

Hi there,

I'm not sure what you mean by this, could you clarify, perhaps with an example?

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
ProfessorJay
Posts: 10
Joined: Thu Feb 17, 2022 8:01 am

Re: VRIF save between scenes.

Post by ProfessorJay »

ok, so i have a game object its called random spawner. its got a script on it that has a public variable that allows me to add as many prefab objects as i want to it. when the spawnrandom() function starts its spawns one of the objects in the array/list? at random. it also uses itself, its own game/transform position to spawn at.

oh! i also mean this: if I have said object that randomly spawns from a list of any amount of game objects, and i make the random spawner object an ES3 prefab. does that make everything that it spawns also an es3 prefab automatically?
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: VRIF save between scenes.

Post by Joel »

Hi there,

'Enable Easy Save for Prefab' should only be used on the prefab that you are instantiating. I.e. the GameObject you're providing as a parameter to the Instantiate(go) method.

As your Random Spawner GameObject isn't a prefab (instead it's the thing which creates the prefabs), you shouldn't add it to this.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply