Search Unity

[RELEASED] Dialogue System for Unity - easy conversations, quests, and more!

Discussion in 'Assets and Asset Store' started by TonyLi, Oct 12, 2013.

  1. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Great! Glad to help.
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Dialogue System 2.2.6 Released

    Version 2.2.6 of the Dialogue System for Unity is now available on the Asset Store!

    Version 2.2.6 Release Notes:

    Core:
    • Dialogue Editor:
      • Improved: Improvements to "..." Lua wizards.
      • Fixed: Menu > Show Actor Portraits now work with portrait sprites & textures.
      • Fixed: Custom node colors could display as transparent.
      • Fixed: Variables with '.' weren't shown as submenus in some contexts.
      • Fixed: Node dropdown didn't refresh conversation title when exiting play mode.
    • Improved: Standard UI Quest Log Window now has Select First Quest On Open checkbox.
    • Improved: [var] and [lua] tags are now parsed in alert messages.
    • Improved: Added StandardUIMenuPanel option to block input for duration immediately after opening.
    • Improved: Added checkbox to clear subtitle text on close.
    • Improved: Added UIButtonKeyTrigger.monitorInput property, option to visually simulate pressed state.
    • Improved: Setting DialogueTime now also sets PixelCrushers.GameTime.
    • Fixed: Misc. fixes to SetMenuPanel() sequencer command.
    • Fixed: TextMesh Pro typewriter effect timing with \>...\< RPG Maker codes.
    • Fixed: When showing invalid responses, [auto] and [f] no longer take precedence over Conditions for nodes with invalid conditions.
    • Fixed: StandardQuestLogWindow "no quests" messages were not being localized.
    • Save System: Added support for async saving; SaveSystem.SaversRestartGame() is now public.
    • Save System: PositionSaver on NavMeshAgents didn't restore rotation.
    • New Input System: Fixed: No longer tries to handle KeyCode.None.

    Third Party Support:
    • articy:draft: Renamed import buttons to clarify their functions.
    • Emerald AI: Updated integration for v2.4.
    • Opsive character controllers: Updated integration for version 2.2 (available on opsive.com).
    • Spine: SpineDialogueActor methods are now overridable; added support for SkeletonGraphic.
    • uMMORPG: Updated integration for 1.189.
    • uSurvival: Updated integration for 1.74.

    NOTE: Unity has requested Asset Store publishers to submit new releases with a minimum of Unity 2018.4. The next release will require Unity 2018.4 or higher.
     
    Freznosis, DMRhodes and hopeful like this.
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    The Dialogue System for Unity is 50% off in the Asset Store's Spring Sale!

    As seen in Game of the Year winners and everything from huge MMOs to Apple Arcade-featured mobile releases to small personal projects and everything in between.

    upload_2020-4-15_9-31-10.jpeg
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Dialogue System for Unity & Quest Machine Comparison Chart

    The Dialogue System and Quest Machine can both do quests. For those who are asking about the differences, here's the comparison chart:

    Dialogue System & Quest Machine Features

    In brief:
    • The Dialogue System does interactive branching conversation, and provides a node-based conversation editor and field-based hand-written quest editor.
    • Quest Machine does WoW-style accept/decline dialogues, provides a node-based quest editor, and can procedurally generate new quests at runtime.
    • Quest Machine includes an integration package for the Dialogue System so you can add branching conversations to Quest Machine quests.
     
  5. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    121
    Hey,

    I am having a couple of issues in regards to the playmaker integration.
    The issue being, I can no longer get it to work.

    Before, I was at a slightly older trial version of dialogue system.
    However, after buying AND updating dialogue system, the entries from the playmaker action browser are gone.
    I've deleted the plugin folder and the dialogue manager before installing the full version + update and I've also installed the integration files (plugins -> common -> third party support & dialogue system -> third party support).

    However, unfortunately there's still not anything.
     
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @SOSolacex - Thanks for buying the Dialogue System! It sounds like you've done everything perfectly so far. Are there any red compiler errors in the Console window? Make sure errors are turned on in the Console, too:

    upload_2020-4-16_12-37-20.png

    Can you please try importing PlayMaker, Dialogue System, and the two integration packages into a new, empty project? I just confirmed that all looks good in a new project with the latest versions of PlayMaker and Dialogue System. The actions should be located under Dialogue System and Pixel Crushers Common.

    If you get stuck, please feel free to send a copy of your project to tony (at) pixelcrushers.com. I'll be happy to take a look directly.
     
    Last edited: Apr 16, 2020
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Suzerain at LudoNarraCon on Steam April 24-27

    Check out Suzerain, made with the Dialogue System for Unity, at LudoNarraCon's virtual conference on Steam's front page April 24-27.

     
  8. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    121
    Thanks for your reply. Cheers.
    Looks like I just had to restart my unity! It worked immediately after.
     
    TonyLi likes this.
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Great! Glad it's working now.
     
  10. Curlyone

    Curlyone

    Joined:
    Mar 15, 2018
    Posts:
    41
    Hello

    I am thinking of buying this but i have 3 questions about it.

    Is it possible to use this asset for UIElements Runtime out of the box ? If not, is it possible to do it from my side ?

    How well/stable this asset works for beta and alpha versions of Unity ? (I am using ECS for my project and since its preview i have to use beta/alpha versions for shiny stuff :D )

    Thank you.
     
  11. Janoooba

    Janoooba

    Joined:
    Feb 9, 2016
    Posts:
    43
    Hey @TonyLi

    Before I implement this into my current project I'm wondering if you could answer a few questions about this asset for me?

    Is it possible (and if so, how easy is it) to modify your Actor database to include more custom information for each actor?
    Is it possible to query and set values in the variables database through external code? Do I need a reference to a manager instance, or is there a singleton or static accessor?
    Would it be easy to hijack the variables database and save/load it to my own profile system?
    Is this asset localization friendly?

    Thanks!
     
  12. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Curlyone - It's possible to do it from your side. The Dialogue System is UI-independent. It will happily work with any script that implements a simple C# interface called IDialogueUI. It ships with a very robust implementation of IDialogueUI for Unity UI and other UI systems, but not with UIElements yet. The Templates folder includes a starter script for IDialogueUI that you can just copy and fill out with your UIElements code.

    Assets can't 100% guarantee compatibility with alpha and beta versions because Unity may change those versions at any time, and they often have bugs that assets can do nothing about. But I have tested the Dialogue System with the alpha and beta versions of 2020.1 and found no issues so far.
     
  13. Curlyone

    Curlyone

    Joined:
    Mar 15, 2018
    Posts:
    41
    Oh also i forgot to ask, does it work with Unity's localization package ?

    Thanks.
     
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Janoooba - Easy. In the Dialogue Editor's Actors section, inspect an actor. Expand All Fields, and add any custom fields you want. You can also add those fields to the template so they get automatically added to all actors.

    There's a static accessor. For example:
    Code (csharp):
    1. int playerAge = DialogueLua.GetActorField("Player", "Age").asInt;
    2. DialogueLua.SetVariable("Current Temperature", 67.5f);
    The static class is called DialogueLua because the Dialogue System runs a Lua environment under the hood to allow conversation nodes to perform logic checks. You can also register your own C# methods with the Lua environment to hook your own code into conversations. Although it's Lua, in the Dialogue Editor you don't have to type Lua code. You have the option of using point-and-click menus to specify conditions and actions, even for your own C# methods.

    Yes. It's a one-line call each direction (one line to grab all data, one line to put all data back). The Dialogue System has an extensible save system, too. Many games just use the Dialogue System's save system for the entirety of their saved game functionality.

    Yes. It has built in localization support, with the option to export and import spreadsheets to send to translators, or you can also use the Dialogue System's i2 Localization integration if you prefer.
     
    Last edited: Apr 16, 2020
  15. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    The Dialogue System has its own built-in localization, with the option to use i2 Localization if you prefer.
     
  16. Janoooba

    Janoooba

    Joined:
    Feb 9, 2016
    Posts:
    43
    Fantastic! Looking forward to working with this!
     
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
  18. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Feature Package Available: Scene Events

    Version 2.2.7 will have a new feature: scene events. Normally, assets that exist separately from scenes, such as dialogue databases, cannot reference scene objects. For example, you can't assign a scene object to a field in a ScriptableObject asset.

    In version 2.2.7, when you inspect a dialogue entry node, the Events foldout will have an option to add a UnityEvent that can operate on scene objects:

    upload_2020-4-16_16-16-47.png


    The Dialogue System Customer Download site has a patch containing an advance copy of this feature if you'd like to try it out before version 2.2.7. (If you need access to the Customer Download site, please PM me your Unity Asset Store invoice number.)
     
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Check out Framing Dawes, a dark fairy tale adventure made with the Dialogue System for Unity and a feature on Adventure Game Friday. You can wishlist it on Steam and play the demo now.

     
  20. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Ludum Dare, Twine, and Dialogue System

    Ludum Dare 46 is this weekend! Twine is a popular tool to make short narrative games for game jams. I'm just posting a reminder that the Dialogue System for Unity can import Twine. So if you make an interesting Twine game this weekend and want to expand it into something bigger after the jam, you can use the Dialogue System to import your Twine dialogue into Unity.
     
  21. DREBOTgamestudio

    DREBOTgamestudio

    Joined:
    Jan 30, 2018
    Posts:
    66
    Hi i want to use TextMeshPro. I set TextMesh Pro on start window.
    upload_2020-4-19_14-41-28.png
    But all ui elements used old text.
    upload_2020-4-19_14-43-27.png
    and i can not change script, becouse
    upload_2020-4-19_14-44-14.png
    What should I do so that I can use TextMeshPro everywhere?
     
  22. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    DREBOTgamestudio likes this.
  23. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    121
    Small question since I feel like I have overlooked it / can't find it in the docs. But is there a setting that allows me to set a key from the input manager to hide/unhide the dialogue?

    For example, I've got an image popping up through a sequencer during the dialogue, however I was wondering if by pressing a key people could hide the text and what not to see the entire image if they want to. Or perhaps, do that, but only to a certain extent (Reduce the opacity of the UI).

    Or should I just create a small script for that myself?
     
  24. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @SOSolacex - There isn't a built-in key for that. You can write a small script to disable the Dialogue Manager's Canvas, or configure a UI Button's OnClick() event to disable it. Disabling the Canvas component is preferable to deactivating the GameObject because it doesn't reset your UI's Animators.
     
  25. DREBOTgamestudio

    DREBOTgamestudio

    Joined:
    Jan 30, 2018
    Posts:
    66
    Wow that's cool! how did you make such an implementation of the editor? Are you checking for an empty string, and if so then output 2 fields? Good idea to hide the fields :)
    Sorry, my mistake. I had to look at the documentation. Thank you.
     
  26. DREBOTgamestudio

    DREBOTgamestudio

    Joined:
    Jan 30, 2018
    Posts:
    66
    I want to make a different color for the text.
    upload_2020-4-20_4-0-0.png
    Is it possible to modify the code? Or did you provide for the possibility of installing different colors? :)
     
  27. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    It's a custom property drawer. :)
     
    DREBOTgamestudio likes this.
  28. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    You can set the In Range Color and Out Of Range Color.
    • When the selector detects a Usable that's in range, it shows the text and changes its color to the In Range Color.
    • When the selector detects a Usable that's out of range, it shows the text and changes its color to the Out Of Range Color.
    • If the selector doesn't detect a Usable, it hides the text.
     
    DREBOTgamestudio likes this.
  29. DREBOTgamestudio

    DREBOTgamestudio

    Joined:
    Jan 30, 2018
    Posts:
    66
    Yes, but the In Range Color affects the entire text. I want a different color for the title and message text.
     
  30. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    An easy way is to add a color rich text code to the use message:

    upload_2020-4-19_21-56-51.png

    If the Usable has its own custom use message, you can use rich text codes there, too.
     
    DREBOTgamestudio likes this.
  31. Majerinodino

    Majerinodino

    Joined:
    Mar 5, 2020
    Posts:
    4
    Had a quick question, thanks for replying to my last a few weeks ago! If in a conversation, I want to refer to another actor that is not the "Actor" or "Conversant", but how do I format it? In the below screenshot, the actor I want to refer to is named "Boring". I tried Actor["Boring"] and Actor["Boring"].Name and both simply show that text rather than simply referring to "Boring". I would prefer to refer to the actor's name variable as the display name will differ each playthrough (one time "Boring" may have the display name George while another may have Evan) instead of simply typing "speaking with Boring" without referring to the Boring actor's display naem. Is there a way to do this? Thank you very much in advance!

     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Majerinodino - Since it's not a simple variable (i.e., where you can use a [var=variable] tag), you'll need to use a [lua(code)] tag instead:

    Th-they were speaking with [lua(Actor["Boring"].Name)]. I was trying to listen...​

    I recommend using Display Names. Instead of the line above, use:

    Th-they were speaking with [lua(Actor["Boring"].Display_Name)]. I was trying to listen...​

    Make sure to set the actor's Display Name. In the Dialogue Editor, inspect the actor and tick Use Display Name. Since you're setting up actors at runtime, in C# you can use DialogueLua.SetActorField:

    DialogueLua.SetActorField("Boring", "Display Name", "Bob Boringman");
     
    Majerinodino likes this.
  33. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    @TonyLi ,

    A small improvement to SaveSystems where getting singleton's instance :

    m_instance = GameObject.FindObjectOfType<SaveSystem>();
    if (m_instance == null)
    m_instance = new GameObject("Save System", typeof(SaveSystem)).GetComponent<SaveSystem>();

    This is so that if SaveSystem already exist in the scene for whatever reason, it uses the exiting one instead. Otherwise, it will create a duplicate.

    Please update this... so when we update plugin later, we don't have to keep changing the code.
     
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Sure, I'll make sure this is added in the next release.
     
  35. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I am currently wondering, if it is possible to have multiple text table assets for the organization purpose and then when game starts, we can create one single text table from multiple text table asset sources?
     
  36. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Also, when I use Text Table Editor window, and add field and then move it up or down, I get the following error sometimes

    Retrieving array element that was out of bounds
    UnityEditor.EditorGUI:propertyField(Rect, SerializedProperty, GUIContent, Boolean)
    PixelCrushers.TextTableEditorWindow:OnDrawFieldListElement(Rect, Int32, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Editor/Text/TextTableEditorWindow.cs:483)
    UnityEditorInternal.ReorderableList:DoListElements(Rect)
    UnityEditorInternal.ReorderableList:DoLayoutList()
    PixelCrushers.TextTableEditorWindow:DrawGrid() (at Assets/Plugins/Pixel Crushers/Common/Scripts/Editor/Text/TextTableEditorWindow.cs:404)
    PixelCrushers.TextTableEditorWindow:DrawFieldsTab() (at Assets/Plugins/Pixel Crushers/Common/Scripts/Editor/Text/TextTableEditorWindow.cs:339)
    PixelCrushers.TextTableEditorWindow:DrawWindowContents() (at Assets/Plugins/Pixel Crushers/Common/Scripts/Editor/Text/TextTableEditorWindow.cs:206)
    PixelCrushers.TextTableEditorWindow:OnGUI() (at Assets/Plugins/Pixel Crushers/Common/Scripts/Editor/Text/TextTableEditorWindow.cs:174)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    This seems to happen when I have only entered the value for only one language and others are empty. But this is my speculation so I could be wrong.
     
  37. DREBOTgamestudio

    DREBOTgamestudio

    Joined:
    Jan 30, 2018
    Posts:
    66
    Greetings. Please tell me how to change the main menu? As I understand it, this approach is already obsolete. Where can I read about how to make a new menu?
    upload_2020-4-23_7-34-57.png
    upload_2020-4-23_7-35-40.png
     
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @castor76 - There's isn't currently a way to automatically merge multiple text tables into a single text table at runtime. At design time, you can export the text table content to CSV files and then import them all into a single text table. I'll also add an option to directly import the content of one text table into another. You can write a short script to create a merged text table at runtime. Here's an example:
    Code (csharp):
    1. using UnityEngine;
    2. using PixelCrushers;
    3.  
    4. public class MergeTextTablesExample : MonoBehaviour
    5. {
    6.     public TextTable[] sourceTables;
    7.  
    8.     private TextTable mergedTable;
    9.  
    10.     void Start()
    11.     {
    12.         mergedTable = ScriptableObject.CreateInstance<TextTable>();
    13.         foreach (var languageName in sourceTables[0].languages.Keys)
    14.         {
    15.             mergedTable.AddLanguage(languageName);
    16.         }
    17.         foreach (var table in sourceTables)
    18.         {
    19.             foreach (var fieldID in table.fields.Keys)
    20.             {
    21.                 var fieldName = table.GetFieldName(fieldID);
    22.                 mergedTable.AddField(fieldName);
    23.                 foreach (var languageName in table.languages.Keys)
    24.                 {
    25.                     mergedTable.SetFieldTextForLanguage(fieldName, languageName, table.GetFieldTextForLanguage(fieldName, languageName));
    26.                 }
    27.             }
    28.         }
    29.  
    30.         Debug.Log("Value of field 'Hello' is: " + mergedTable.GetFieldText("Hello"));
    31.     }
    32. }


    I'll address this in the next update. For now, it's harmless.

    Hi @DREBOTgamestudio - DemoMenu is just a simple script for the demo scene. Instead, consider using the free Menu Framework addon available on the Dialogue System Extras page.
     
    DREBOTgamestudio likes this.
  39. nichjaim

    nichjaim

    Joined:
    Apr 23, 2020
    Posts:
    46
    hey, sorry if this has already been asked but is it possible to have multiple dialogues occurring at once, such as if the game is coop or splitscreen.
     
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @nichjaim - Sure! Tick the Dialogue Manager's Other Settings > Allow Simultaneous Conversations. Each one should run in its own dialogueUI.

    On the topic of co-op games, I worked on a prototype that used single conversations in co-op mode. Each player could vote for a response. A little dot would appear for each player's vote, as indicated by the purple arrow below. Once all players voted, the response with the highest number of votes would be used. Just mentioning it as another option/idea.

    upload_2020-4-23_17-7-4.png
     

    Attached Files:

    nichjaim likes this.
  41. DREBOTgamestudio

    DREBOTgamestudio

    Joined:
    Jan 30, 2018
    Posts:
    66
    Hi, I am trying to configure save. How it works on the same stage is clear to me. But how do I transfer saves from one scene to another? On the first scene, I have a jacket and a character. The character picks up this jacket and puts it on. How do I keep the jacket on the character when loading the second scene?

    On the second scene, there is also a character prefab, all you need to do is upload the data.

    I can’t understand how to untie the load from the scene.

    p.s. I use Inventory Engine as an inventory. Persistent Inventory works great in one scene.
     
  42. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @DREBOTgamestudio - Use one of these methods to change scenes:
    • SaveSystem.LoadScene() in C# code. You can optionally pass a spawnpoint (typically an empty GameObject) in the new scene. The player's PositionSaver component will move the player to that spawnpoint. Example:
      PixelCrushers.SaveSystem.LoadScene("Castle@Foyer");
    • Use a Save System Methods component. This component has a LoadScene method that you can hook up in the inspector, for example to a UI Button's OnClick() event.
    • Use the LoadLevel() sequencer command.
    All of the methods above will use a scene transition manager if present. For an example, see the scene transition manager on the Dialogue Manager GameObject in DemoScene1. It fades to black and then fades back in, but if you want to show an intermediate loading scene simply specify its name in the inspector.
    • Or, if you're not going to use any of the techniques above to change scenes, call SaveSystem.RecordSavedGameData() and SaveSystem.BeforeSceneChange() before changing scenes. After changing scenes, call SaveSystem.ApplySavedGameData().
    Everything above will use the same save system that you're using to save your game in a single scene, so you don't need to change anything else.
     
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Tom Regan Interview with Disco Elysium Dev

    Tom Regan wrote a great interview with Helen of Studio ZA/UM, developers of multiple award-winning Disco Elysium (made with the Dialogue System), summing it up with:

    Article: Disco Elysium: How a Few Friends from Estonia Created 2019's Most Original Game

    upload_2020-4-24_8-1-51.jpeg

    Reminder: The Dialogue System is 50% off for a limited time in the Asset Store's Spring Sale.
     
    Last edited: Apr 24, 2020
  44. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Suzerain Featured At LudoNarraCon On Steam

    Suzerain, made with the Dialogue System, is being featured at LudoNarraCon on Steam. Check out their livestream schedule.

     
  45. nichjaim

    nichjaim

    Joined:
    Apr 23, 2020
    Posts:
    46
    Is there an event for when a text character is added to the dialogue text. I'm trying to make a sound everytime more of the dialogue text is put in the UI akin to banjo kazooie but i'm not sure where to be looking.
     
  46. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @nichjaim - Are you talking about every time the typewriter effect types a character? If so, inspect the dialogue UI. Drill down until you find the NPC Subtitle Panel's Subtitle Text child GameObject. It has a typewriter effect script. You can assign one or more audio clips. Every time the typewriter types a character, it will play one of the audio clips. You can also set a list of silent characters for which it doesn't play an audio clip.

    You can also use the OnCharacter() event. This event occurs whenever a character is typed.
     
    nichjaim likes this.
  47. DREBOTgamestudio

    DREBOTgamestudio

    Joined:
    Jan 30, 2018
    Posts:
    66
    I'm trying to do as you said, but I can’t. I created a test cube but could not load it.
    upload_2020-4-26_6-45-42.png

    I load scene 1 on which this cube is located. Then I call the scripts in the following order.
    1. SaveSystem.RecordSavedGameData();
    2. SaveSystem.BeforeSceneChange();
    3. SceneManager.LoadScene(2);
    After loading scene 2, I call the script:
    4. SaveSystem.ApplySavedGameData();

    What am I doing wrong?
     
  48. DREBOTgamestudio

    DREBOTgamestudio

    Joined:
    Jan 30, 2018
    Posts:
    66
    This method works great. My character changed position and his clothes were preserved. The only thing I had to adjust the ApplyData code.

    Code (CSharp):
    1.         public override void ApplyData(string s)
    2.         {
    3.             if (!string.IsNullOrEmpty(s))
    4.             {
    5.                 var currentScene = SceneManager.GetActiveScene().buildIndex;
    6.  
    7.                 var data = SaveSystem.Deserialize<InventoryCharacterData>(s, inv_data);
    8.                 if (data == null) return;
    9.                 inv_data = data;
    10.                 if (data.scene == currentScene || data.scene == -1)
    11.                 {
    12.                     SetInvCharacter(data);
    13.                 }
    14.             }
    15.         }
    Since I change the scene data.scene != currentScene. For the test, I simply removed this check. How to do it right?
     
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    @DREBOTgamestudio - Remove that check. Then inspect your saver component in the Unity editor, and tick "Save Across Scene Changes".
     
    DREBOTgamestudio likes this.
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697