Allow only one instance

Announcements, support questions, and discussion for Quest Machine.
GorkaGames
Posts: 178
Joined: Fri Sep 21, 2018 8:38 pm

Allow only one instance

Post by GorkaGames »

Hi,

What is referring "Allow only one instance" in the quest machine configuration settings? Thanks
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Allow only one instance

Post by Tony Li »

When Allow Only One Instance is ticked and the scene already contains a Quest Machine GameObject (typically carried over from the previous scene by the Don't Destroy GameObject script), it will automatically destroy any new Quest Machine GameObjects so only one will exist. This way, you're guaranteed to always be using the same Quest Machine GameObject for all scenes.
GorkaGames
Posts: 178
Joined: Fri Sep 21, 2018 8:38 pm

Re: Allow only one instance

Post by GorkaGames »

Ok, I undersand, thanks! I already had checking in to avoid conflicts.
GorkaGames
Posts: 178
Joined: Fri Sep 21, 2018 8:38 pm

Re: Allow only one instance

Post by GorkaGames »

Hi, I get this error when interacting the player with the quest giver:

playerQuestListContainer.DeleteQuest(quest.id); // Clear any old instance of repeatable quests first.

And sometimes the UI on the quest Dialog UI gets partially bloqued and don't let me select any quest (Neither with keyboard nor Gamepad. I'm using rewired and I already installed the rewired addon on your third party folder)

I don't know if the error is because that or by another reason....


Full error here:

NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.QuestMachine.QuestGiver.ShowOfferQuest (PixelCrushers.QuestMachine.Quest quest) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:461)
PixelCrushers.QuestMachine.QuestGiver.OnSelectQuest (PixelCrushers.QuestMachine.Quest quest) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:480)
PixelCrushers.QuestMachine.UnityUIQuestDialogueUI+<AddQuestList>c__AnonStorey2.<>m__0 () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest UIs/Unity UI/Unity UI Quest Dialogue UI/UnityUIQuestDialogueUI.cs:238)
UnityEngine.Events.InvokableCall.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:166)
UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:58)
UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:36)
UnityEngine.UI.Button.OnSubmit (UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute (ISubmitHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:127)
UnityEngine.EventSystems.ExecuteEvents.Execute[ISubmitHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:261)
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
Rewired.Integration.UnityUI.RewiredStandaloneInputModule:SendSubmitEventToSelectedObject() (at Assets/Rewired/Integration/UnityUI/RewiredStandaloneInputModule.cs:791)
Rewired.Integration.UnityUI.RewiredStandaloneInputModule:Process() (at Assets/Rewired/Integration/UnityUI/RewiredStandaloneInputModule.cs:646)
UnityEngine.EventSystems.EventSystem:Update()
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Allow only one instance

Post by Tony Li »

Hi,
GorkaGames wrote: Wed Sep 26, 2018 10:03 amHi, I get this error when interacting the player with the quest giver:

playerQuestListContainer.DeleteQuest(quest.id); // Clear any old instance of repeatable quests first.
Is this line in your script reporting an error? If so, would you please post the error that you're getting? Can you also post the code that includes this line?
GorkaGames wrote: Wed Sep 26, 2018 10:03 amAnd sometimes the UI on the quest Dialog UI gets partially bloqued and don't let me select any quest (Neither with keyboard nor Gamepad. I'm using rewired and I already installed the rewired addon on your third party folder)
If you keep the inspector on the EventSystem GameObject, it will show which UI element is currently selected:

Image

Is any UI element selected?

Can you click anything with the mouse?

At this point in runtime, what is the Input Device Manager's Input Device dropdown set to? (Note that if you move the mouse, it will automatically set the dropdown to Mouse.)

I'm trying to get an idea of the state of Unity's UI system when the issue occurs.
GorkaGames wrote: Wed Sep 26, 2018 10:03 am
Full error here:
NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.QuestMachine.QuestGiver.ShowOfferQuest (PixelCrushers.QuestMachine.Quest quest) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:461)
PixelCrushers.QuestMachine.QuestGiver.OnSelectQuest (PixelCrushers.QuestMachine.Quest quest) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:480)
PixelCrushers.QuestMachine.UnityUIQuestDialogueUI+<AddQuestList>c__AnonStorey2.<>m__0 () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest UIs/Unity UI/Unity UI Quest Dialogue UI/UnityUIQuestDialogueUI.cs:238)
UnityEngine.Events.InvokableCall.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:166)
UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:58)
UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:36)
UnityEngine.UI.Button.OnSubmit (UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute (ISubmitHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:127)
UnityEngine.EventSystems.ExecuteEvents.Execute[ISubmitHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:261)
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
Rewired.Integration.UnityUI.RewiredStandaloneInputModule:SendSubmitEventToSelectedObject() (at Assets/Rewired/Integration/UnityUI/RewiredStandaloneInputModule.cs:791)
Rewired.Integration.UnityUI.RewiredStandaloneInputModule:Process() (at Assets/Rewired/Integration/UnityUI/RewiredStandaloneInputModule.cs:646)
UnityEngine.EventSystems.EventSystem:Update()
When does this error occur?

Is a quest dialogue UI assigned to the Quest Giver's UI Settings? It's easier if it's not assigned. In this case, the Quest Giver will use the quest dialogue UI that's assigned to the Quest Machine GameObject.
GorkaGames
Posts: 178
Joined: Fri Sep 21, 2018 8:38 pm

Re: Allow only one instance

Post by GorkaGames »

Its in your code QuestGiverCs:

protected virtual void ShowOfferQuest(Quest quest)
{
QuestMachineMessages.DiscussQuest(player, this, id, quest.id);
playerQuestListContainer.DeleteQuest(quest.id); // Clear any old instance of repeatable quests first.
questDialogueUI.ShowOfferQuest(myQuestGiverTextInfo, quest, OnAcceptQuest, OnQuestBackButton);
QuestMachineMessages.DiscussedQuest(player, this, id, quest.id);
}

And the error:

NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.QuestMachine.QuestGiver.ShowOfferQuest (PixelCrushers.QuestMachine.Quest quest) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:461)
PixelCrushers.QuestMachine.QuestGiver.OnSelectQuest (PixelCrushers.QuestMachine.Quest quest) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:480)
PixelCrushers.QuestMachine.UnityUIQuestDialogueUI+<AddQuestList>c__AnonStorey2.<>m__0 () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest UIs/Unity UI/Unity UI Quest Dialogue UI/UnityUIQuestDialogueUI.cs:238)
UnityEngine.Events.InvokableCall.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:166)
UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:58)
UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:36)
UnityEngine.UI.Button.OnSubmit (UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute (ISubmitHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:127)
UnityEngine.EventSystems.ExecuteEvents.Execute[ISubmitHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:261)
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
Rewired.Integration.UnityUI.RewiredStandaloneInputModule:SendSubmitEventToSelectedObject() (at Assets/Rewired/Integration/UnityUI/RewiredStandaloneInputModule.cs:791)
Rewired.Integration.UnityUI.RewiredStandaloneInputModule:Process() (at Assets/Rewired/Integration/UnityUI/RewiredStandaloneInputModule.cs:646)
UnityEngine.EventSystems.EventSystem:Update()


It happens when the dialog box show up and I try to activate one of the quests. It doesn't activate any quest and it gives this error
GorkaGames
Posts: 178
Joined: Fri Sep 21, 2018 8:38 pm

Re: Allow only one instance

Post by GorkaGames »

Quest Dialogue UI is none on the quest Giver, as you mentioned its better.
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Allow only one instance

Post by Tony Li »

Thank you for the info. I will investigate this and try to send you a fix by the end of the day.
GorkaGames
Posts: 178
Joined: Fri Sep 21, 2018 8:38 pm

Re: Allow only one instance

Post by GorkaGames »

Thanks, just remember you that I'm with the rewired addon installed and with your Input Device Manager deactivated, just in case.
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Allow only one instance

Post by Tony Li »

Hi,

I just PM'ed you the download for patch 1.0.7 20180926.

I couldn't reproduce the issue, but I tested it and added more error checking and reporting. If you still get the error, please post the error messages since they should be more helpful now.

For Rewired, keep the Input Device Manager, and add an Input Device Manager Rewired component to it. The Input Device Manager is what auto-focuses the first button when a UI window opens. If no button is focused, Unity UI can't navigate using keyboard or gamepad. (The Input Device Manager isn't strictly required, but if you remove it you must write a script to manually focus some UI button whenever a window opens.) The Input Device Manager Rewired component is an add-on that tells the Input Device Manager to read input from Rewired instead of standard Unity input.

To automatically set unique keys for Saver components, use the menu item: Tools > Pixel Crushers > Common > Save System > Assign Unique Keys....
Post Reply