Scene Portal

Announcements, support questions, and discussion for Quest Machine.
Post Reply
Chuc
Posts: 3
Joined: Fri Aug 26, 2022 6:23 am

Scene Portal

Post by Chuc »

Not 100% where to ask this question. I got the scene portal when I got Quest Machine so i thought here was a good spot.

I am using UFPS, UIS and Quest Machine. I haven't made any quest yet or done any set up for Quest Machine atm as i am trying to get game working half decent before i flesh it out. The save system between the 3 is driving me nuts but that isn't what i am here for yet.

I have a starter scene where the game loads all my systems, then you travel to another scene but you end up being in the same position from the old scene in the new scene. Scene portal was suppose to fix this issue but i am having trouble with it. It is not sending me to the game object location of the new scene.

if i move the starter scene location over the spot of the second scene it loads fine, inventory works and all the UIS things work.
Attachments
Debug info from scene portal
Debug info from scene portal
Screenshot 2022-08-26 195629.png (6.57 KiB) Viewed 709 times
Spawn location in second scene
Spawn location in second scene
Screenshot 2022-08-26 195423.png (488.4 KiB) Viewed 709 times
Scene portal inspector from start scene
Scene portal inspector from start scene
Screenshot 2022-08-26 195507.png (78.03 KiB) Viewed 709 times
User avatar
Tony Li
Posts: 20769
Joined: Thu Jul 18, 2013 1:27 pm

Re: Scene Portal

Post by Tony Li »

Hi,

The ScenePortal component is part of the save system, so you'll want to make sure the save system is set up. The easiest way to do that is to:

1. Download the SaveSystemPrefabs package and import it.
2. Drop the Save System prefab into your systems scene.
3. Add the LoadingScreen scene to your build settings. (You can customize it later.)
4. Make sure no other instances of the SaveSystem component are present, such as on your Quest Machine GameObject.

Alternatively, you can add the save system components (SaveSystem, [Json]DataSerializer, [PlayerPrefs]SavedGameDataStorer) to another GameObject such as the Quest Machine GameObject. The key is that only one SaveSystem component exists in the scene. (In used [square brackets] because it's fine to add different variations such as DiskSavedGameDataStorer instead of PlayerPrefsSavedGameDataStorer.)

Since you're using UFPS, don't add a PositionSaver component to your player. Instead, add a UCCSaver. Assign a unique key such as "PlayerData" and make sure the Save Position checkbox is ticked. Also make sure this GameObject is tagged "Player".

That should do it. If you see any errors or warnings after changing scenes using the Scene Portal, let me know.
Chuc
Posts: 3
Joined: Fri Aug 26, 2022 6:23 am

Re: Scene Portal

Post by Chuc »

Thank you Tony i will look into it when i get home. From what you have said i may know the problem i have. I will let you know how i go later tonight.
Chuc
Posts: 3
Joined: Fri Aug 26, 2022 6:23 am

Re: Scene Portal

Post by Chuc »

So i added a UCC Saver to the player and it worked but my inventory from UIS didnt save so i added a UIS Saver to the player. That got my inventory to save and all work good but i got this error

NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Integrations.UltimateInventorySystem.InventoryBridgeSaver.SerializeSaveData () (at Assets/Opsive/UltimateCharacterController/Integrations/UltimateInventorySystem/Scripts/InventoryBridgeSaver.cs:94)
Opsive.UltimateInventorySystem.SaveSystem.SaverBase.Save () (at Assets/Opsive/UltimateInventorySystem/Scripts/SaveSystem/SaverBase.cs:71)
Opsive.UltimateInventorySystem.SaveSystem.SaveSystemManager.SaveAllSavers () (at Assets/Opsive/UltimateInventorySystem/Scripts/SaveSystem/SaveSystemManager.cs:487)
Opsive.UltimateInventorySystem.SaveSystem.SaveSystemManager.SaveInternal (System.Int32 saveIndex, System.Boolean saveToDisk) (at Assets/Opsive/UltimateInventorySystem/Scripts/SaveSystem/SaveSystemManager.cs:470)
Opsive.UltimateInventorySystem.SaveSystem.SaveSystemManager.Save (System.Int32 saveIndex, System.Boolean saveToDisk) (at Assets/Opsive/UltimateInventorySystem/Scripts/SaveSystem/SaveSystemManager.cs:269)
PixelCrushers.UISSupport.UISSaver.RecordData () (at Assets/Pixel Crushers/Common/Third Party Support/Opsive UIS Support/Scripts/UISSaver.cs:18)
PixelCrushers.SaveSystem.RecordSavedGameData () (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:666)
UnityEngine.Debug:LogException(Exception)
PixelCrushers.SaveSystem:RecordSavedGameData() (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:670)
PixelCrushers.SaveSystem:LoadScene(String) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:816)
PixelCrushers.ScenePortal:LoadScene() (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/Misc/ScenePortal.cs:68)
PixelCrushers.ScenePortal:UsePortal() (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/Misc/ScenePortal.cs:63)
PixelCrushers.ScenePortal:OnTriggerEnter(Collider) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/Misc/ScenePortal.cs:74)

If i remove the UIS Saver the error goes away but my inventory doesnt save. I am missing something somewhere or is UIS Saver the wrong one to use?
User avatar
Tony Li
Posts: 20769
Joined: Thu Jul 18, 2013 1:27 pm

Re: Scene Portal

Post by Tony Li »

Hi,

The error is in UIS. Please try backing up your project and updating to the latest UIS version. If that doesn't fix it, send this information to Opsive on their forum or discord server:

Code: Select all

NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Integrations.UltimateInventorySystem.InventoryBridgeSaver.SerializeSaveData () (at Assets/Opsive/UltimateCharacterController/Integrations/UltimateInventorySystem/Scripts/InventoryBridgeSaver.cs:94)
Opsive.UltimateInventorySystem.SaveSystem.SaverBase.Save () (at Assets/Opsive/UltimateInventorySystem/Scripts/SaveSystem/SaverBase.cs:71)
Opsive.UltimateInventorySystem.SaveSystem.SaveSystemManager.SaveAllSavers () (at Assets/Opsive/UltimateInventorySystem/Scripts/SaveSystem/SaveSystemManager.cs:487)
Opsive.UltimateInventorySystem.SaveSystem.SaveSystemManager.SaveInternal (System.Int32 saveIndex, System.Boolean saveToDisk) (at Assets/Opsive/UltimateInventorySystem/Scripts/SaveSystem/SaveSystemManager.cs:470)
Opsive.UltimateInventorySystem.SaveSystem.SaveSystemManager.Save (System.Int32 saveIndex, System.Boolean saveToDisk) (at Assets/Opsive/UltimateInventorySystem/Scripts/SaveSystem/SaveSystemManager.cs:269)
Post Reply