Character save at save point

Announcements, support questions, and discussion for the Dialogue System.
User avatar
supadupa64
Posts: 200
Joined: Sun Mar 06, 2016 9:40 pm
Contact:

Re: Character save at save point

Post by supadupa64 »

I got two errors when I imported the script.

1)
Assets/Scripts/UpdateQuestTrackerOnLoad.cs(3,41): error CS0246: The type or namespace name `MonoBehavior' could not be found. Are you missing a using directive or an assembly reference?

2)
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.UI.Graphic.OnRebuildRequested () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Graphic.cs:480)
UnityEngine.UI.GraphicRebuildTracker.OnRebuildRequested () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/GraphicRebuildTracker.cs:33)
UnityEngine.CanvasRenderer.RequestRefresh () (at C:/buildslave/unity/build/artifacts/generated/common/modules/UI/CanvasRendererBindings.gen.cs:314)
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Character save at save point

Post by Tony Li »

Sorry, that was a typo. (Classless American here ;) .) Change "MonoBehavior" to "MonoBehaviour". Unity's fancy and European like that.

I just fixed it in my previous post, too.
User avatar
supadupa64
Posts: 200
Joined: Sun Mar 06, 2016 9:40 pm
Contact:

Re: Character save at save point

Post by supadupa64 »

Awesome I'll try it now!
User avatar
supadupa64
Posts: 200
Joined: Sun Mar 06, 2016 9:40 pm
Contact:

Re: Character save at save point

Post by supadupa64 »

Everything seems to be working. I think there was one glitch where it put me back at the starting point of the game again, but I'll keep testing it.
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Character save at save point

Post by Tony Li »

Great!

If you can reproduce that glitch, and if your player GameObject is spawned into the scene instead of being present in the scene from the get-go, you may need to tell the PersistentPositionData component to run after your spawn script. You'd need to edit the Script Execution Order to do this. (Press "+", select PixelCrushers.DialogueSystem.PersistentPositionData, and set the value to something high like 500.)
User avatar
supadupa64
Posts: 200
Joined: Sun Mar 06, 2016 9:40 pm
Contact:

Re: Character save at save point

Post by supadupa64 »

My player spawns at the starting location only the first time I load a saved game. Every loaded game after that seems to work just fine.
bohnstudios
Posts: 68
Joined: Sun Aug 16, 2015 3:01 am
Location: St. Louis, MO
Contact:

Re: Character save at save point

Post by bohnstudios »

Monobehaviour; "...the base class every script derives from." So classless Tony....haha....HILARIOUS :lol:
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Character save at save point

Post by Tony Li »

supadupa64 wrote:My player spawns at the starting location only the first time I load a saved game. Every loaded game after that seems to work just fine.
Try setting the Script Execution Order. If that doesn't work, please let me know how your player GameObject gets into the scene.
bohnstudios wrote:Monobehaviour; "...the base class every script derives from." So classless Tony....haha....HILARIOUS :lol:
;-)
User avatar
supadupa64
Posts: 200
Joined: Sun Mar 06, 2016 9:40 pm
Contact:

Re: Character save at save point

Post by supadupa64 »

Alright so I did all that and set it to 500. It still does the same thing. The quests look like they are saving perfectly, but the players spawns at the start on the first loaded game.

My player object is just sitting there from the start in the scene when you hit "start" to play the game for the first time.
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Character save at save point

Post by Tony Li »

How does your player spawn? Can you remind me if you're using a player controller asset, like maybe Opsive's Third Person Controller or something?
Post Reply