Question Scene Changes

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
nitrox32
Posts: 68
Joined: Sat Dec 01, 2018 10:41 am

Question Scene Changes

Post by nitrox32 »

I'm creating a game using Invector and DS. I'm looking to set up a main menu scene that will start a new game or load a saved game. I also have a pause screen in game that's setup up that allows the player to save the game and go back to the main menu scene. Everything is working exactly as I need it to except that one behavior is puzzling and I don't know what is causing it. Everytime I exit the game scene and return from the main menu scene, when I open Invector's inventory the cursor is missing. I'm sure this is a lockstate issue however this behavior only happens after returning from the main menu and only with Invectors inventory system (my pause screen works fine). I'm not sure if this is something having to do with DS input manager or my script that toggles the lockstate or if this is an Invector problem. Perhaps I have multiple systems controlling the lockstate that are conflicting with each other (DS, my script, Invector). Any thoughts on how to troubleshoot this?
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Question Scene Changes

Post by Tony Li »

Hi,

Are you using the Dialogue System's Invector integration?

If so, did you set up the Invector player according to the integration instructions, such as unticking Use Instance? Remember also to inspect Invector's inventory prefab (which is assigned to the player's vItemManager component) and untick Don't Destroy On Load.

The Dialogue System's integration doesn't touch the cursor's lock state except if you've added a Show Cursor On Conversation component to an NPC or ticked the NPC's Dialogue System Trigger > Show Cursor During Conversation. These only apply during conversations, however.

The Dialogue Manager's Input Device Manager component may control the cursor state. However, you can eliminate this as a variable by unticking its Control Cursor State checkbox.

Are you using a menu asset such as Easy Main Menu or the Dialogue System's Menu Framework? Or something developed in-house?
nitrox32
Posts: 68
Joined: Sat Dec 01, 2018 10:41 am

Re: Question Scene Changes

Post by nitrox32 »

Thanks for getting back to me, you gave me a lot to think about. I think I built this on a shaky foundation so I'm starting over with the idea that would like to use DS as much as possible for loading and saving. To avoid conflicts with cursor states between DS and Invector I think I would like to have a separate script that toggles the visibility and lockstate of the cursor that can be called when each menu opens or closes. Unless you have any other thoughts, this seems to be the simplest approach.

Here are my goals:

1) To create a main menu scene that will have two buttons:

Button 1 - New Game - This button should load the starting game scene and begin at the players starting position as well turn off the cursor when the game scene begins.
Button 2 - Load Game - Load a saved game that loads the Invectors player position, inventory as well as the positions of some Emerald AI characters and turns off the cursor when the game loads.

2) Create an in game pause screen that will turn on the cursor when activated and have three buttons:

Button 1 - Main Menu - This button will return to the main menu and turn the cursor on
Button 2 - Save Game - This button should save the player's position, Invectors Inventory, the position of some emerald AI and any dialogue system things such as quest state, conversations, etc.
Button 3 - Resume - Turn off the cursor and return to the game.

3) Be able to turn on the Invector inventory system and have the cursor turn on and off depending on its state.


This is what I've done so far:


1)Created the UI elements (Menus, buttons, etc.)for both scenes
2)Set up my Invector Player with the Item Manager, the inventory prefab has the Don't Destroy on Load unticked.
3)Both the menu scene and game scene have a dialogue manager with components required to load and save. Detect Mouse Control and Control Cursor State have been unticked for both scenes.
4)Added the Position Saver, Dialogue System Invector Bridge and Dialogue System Events components to my Invector player.
5)Activated the button that returns to the main menu screen. I use Unity's SceneManager.LoadScene("MainMenu") to do this (is there a better way using DS?).

So I guess my first question has to do with the New Game button from the main menu. I have it set to call the Save.SystemLoadSceneAtSpawnPoint. When I press the button a new scene begins as expected. However after returning to the main menu scene the New Game button doesn't start a new game. Is using using the Save.SystemLoadSceneAtSpawnPoint the best way of starting a new game? If so, why can't I start a new game after I return the MainMenu?
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Question Scene Changes

Post by Tony Li »

Hi,

Use SaveSystem.RestartGame("sceneName") to start a new game.

Feel free to take some ideas from the Dialogue System's Menu Framework on the Extras page. I think I have an example of it working with Invector if you need it.
nitrox32
Posts: 68
Joined: Sat Dec 01, 2018 10:41 am

Re: Question Scene Changes

Post by nitrox32 »

Thanks, I was able to get most of what I wanted to work. For some reason the Invector Inventory is not being saved. I have added the USE_INVECTOR_INVENTORY scripting define symbol but can't find the Invector Inventory Saver component. Where is it?
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Question Scene Changes

Post by Tony Li »

You might have just missed a small step in the setup instructions:

1. If you are using the paid version of Invector, import the package Plugins ► Pixel Crushers ► Common ► Third Party Support ► Invector Support.

This will unpack files into the folder Assets ► Pixel Crushers ► Common ► Third Party Support ► Invector Support.
nitrox32
Posts: 68
Joined: Sat Dec 01, 2018 10:41 am

Re: Question Scene Changes

Post by nitrox32 »

Ah...I thought I did that already. Thanks.
Post Reply