If Run in background and Play in background, clear immediately.
If Pause Gameplay and Play in background, text sticks.
If Run in background and uncheck Play in background, clear after dialogue has spoken.
So, it should be clearing if we have an unchecked unchecked Play in background and the action is set to Run in background, the dialogue should supersede the actionlist run state? But that still doesn't explain why text sticks if Pause Gameplay and Play in background, the text should unstick once Pause Gameplay is returned to normal.
Leave Play in background unchecked for the moment. It's only complicating matters.
Only focus on setting it to Pause Gameplay.
Right at the start of your gif, it's pausing gameplay, and the GameState is set to Normal when the interaction finishes. This is correct - though it should be reporting the GameState being set to Cutscene at the beginning of it. Did you place the debug statement outside of the "if" statement?
If it's being set to Normal, then the override is set to clear - you can see this going on in the OnEnterGameState event. You're going to have to place another debug statement inside the SetOverrideText function to check that it's being called - or perhaps being called a second time with a new override afterwards.
Here you can see, it doesn't show the 'inventory interact' when it's set to Pause Gameplay. It shows 'inventory interact' immediately when it's set to Run In Background and again at the end, but the text holds (it shouldn't) but it shows 'inventory cancel action' as it stops holding. https://gfycat.com/cluelessportlyarrowana
By Normal, you mean Run In Background instead of Pause Gameplay?
Neither. I'm referring to the "Enter GameState" debug line in OnEnterGameState.
Here you can see, it doesn't show the 'inventory interact' when it's set to Pause Gameplay.
That's correct.
Where is the SetOverrideText function?
Line 143.
Duplicate your project, remove all scene/character graphics and all scenes except one for me to test with. Set up a single inventory item, with the interaction set up to demonstrate the problem. Then PM it to me.
You still have your Verb1txtVerb2 component enabled. This is interfering with the new script, which is a replacement.
In your Verbs prefab, delete the 2nd verb line as well, as the black gameobject that covers the 1st. The problem was that the 2nd (incorrect) verb line was showing.
I have updated the script to respond correctly to unhandled inventory interactions as well:
Can you explain it once more, I've tried removing the old script and the text stops showing entirely, is txtVerbLineCopy taking over as the main line now?
EDIT: Oh, okay, so remove the txtVerbLineCopy entirely, can I also remove the blackbg object? It doesn't seem to be needed anymore?
Somewhere along the line we've lost holding the text in place until a Pause Gameplay action is unpaused or finished:
You can see the door opening and closing actions pause the gameplay for a second, then control is resumed and he speaks, but the text returns to "Walk to" as soon as he hits the marker and the interactions starts: https://gfycat.com/weightyrectangulargalapagosmockingbird
As the last issue was because of the way you'd set things up, best to start over with a basic Text canvas. Try the following:
Create a new Canvas in your scene (not a prefab, nor linked to the Menu Manager), and attach a Text component as a child. Configure its display so that its readable at all times
Attach an Animator to the Canvas but don't assign an Animator Controller
Attach the ScummVerbLine component to the Canvas root, and assign the Text child in its Inspector
With that, we can now see how it behaves without influence elsewhere. What is its behaviour then?
I haven't changed anything in this project since I sent you the project .zip other than the changes you specified with VerbsUI, otherwise it's an identical project folder. I don;t understand how this could work for you if we're running the same project?
Regarding the inventory selection issue, are you having the same issue on the project I sent you with the VerbsUI changes? I can't imagine how the ScummLine script could change how an object is selected.
Having made the changes to your Verbs UI, remove the new test Canvas, and send me the updated project - together with a complete list of the behaviour you want - with specific examples in a test scene, "If you select Use, then click the door, then X should happen"
Comments
gamestate, not gameState.
https://gfycat.com/unhappymedicalcanary
If Run in background and Play in background, clear immediately.
If Pause Gameplay and Play in background, text sticks.
If Run in background and uncheck Play in background, clear after dialogue has spoken.
So, it should be clearing if we have an unchecked unchecked Play in background and the action is set to Run in background, the dialogue should supersede the actionlist run state? But that still doesn't explain why text sticks if Pause Gameplay and Play in background, the text should unstick once Pause Gameplay is returned to normal.
Leave Play in background unchecked for the moment. It's only complicating matters.
Only focus on setting it to Pause Gameplay.
Right at the start of your gif, it's pausing gameplay, and the GameState is set to Normal when the interaction finishes. This is correct - though it should be reporting the GameState being set to Cutscene at the beginning of it. Did you place the debug statement outside of the "if" statement?
If it's being set to Normal, then the override is set to clear - you can see this going on in the OnEnterGameState event. You're going to have to place another debug statement inside the SetOverrideText function to check that it's being called - or perhaps being called a second time with a new override afterwards.
I placed it like this:
private void OnEnterGameState(GameState gamestate) { if (gamestate == GameState.Normal) { SetOverrideText(string.Empty); } Debug.Log("Enter GameState: " + gamestate); }
By Normal, you mean Run In Background instead of Pause Gameplay?
Where is the SetOverrideText function? I can see plenty of invokes, but not the actual function: https://paste.ofcode.org/6miGB47P26c47rMgWxHhGf
I tried this: https://paste.ofcode.org/tQbc9LUV6efCRDL9XWXCwk
Here you can see, it doesn't show the 'inventory interact' when it's set to Pause Gameplay. It shows 'inventory interact' immediately when it's set to Run In Background and again at the end, but the text holds (it shouldn't) but it shows 'inventory cancel action' as it stops holding. https://gfycat.com/cluelessportlyarrowana
Neither. I'm referring to the "Enter GameState" debug line in OnEnterGameState.
That's correct.
Line 143.
Duplicate your project, remove all scene/character graphics and all scenes except one for me to test with. Set up a single inventory item, with the interaction set up to demonstrate the problem. Then PM it to me.
You still have your Verb1txtVerb2 component enabled. This is interfering with the new script, which is a replacement.
In your Verbs prefab, delete the 2nd verb line as well, as the black gameobject that covers the 1st. The problem was that the 2nd (incorrect) verb line was showing.
I have updated the script to respond correctly to unhandled inventory interactions as well:
Can you explain it once more, I've tried removing the old script and the text stops showing entirely, is txtVerbLineCopy taking over as the main line now?
EDIT: Oh, okay, so remove the txtVerbLineCopy entirely, can I also remove the blackbg object? It doesn't seem to be needed anymore?
Correct.
Somewhere along the line we've lost holding the text in place until a Pause Gameplay action is unpaused or finished:
You can see the door opening and closing actions pause the gameplay for a second, then control is resumed and he speaks, but the text returns to "Walk to" as soon as he hits the marker and the interactions starts: https://gfycat.com/weightyrectangulargalapagosmockingbird
Whereas the "open door/close door" text is held until control is resumed: https://gfycat.com/dependablefrigideasternglasslizard
Not on my end, I'm afraid.
As the last issue was because of the way you'd set things up, best to start over with a basic Text canvas. Try the following:
With that, we can now see how it behaves without influence elsewhere. What is its behaviour then?
Okay, this is set up exactly as you described and they do the same thing: https://gfycat.com/babyishfittinggrackle
I haven't changed anything in this project since I sent you the project .zip other than the changes you specified with VerbsUI, otherwise it's an identical project folder. I don;t understand how this could work for you if we're running the same project?
Regarding the inventory selection issue, are you having the same issue on the project I sent you with the VerbsUI changes? I can't imagine how the ScummLine script could change how an object is selected.
Having made the changes to your Verbs UI, remove the new test Canvas, and send me the updated project - together with a complete list of the behaviour you want - with specific examples in a test scene, "If you select Use, then click the door, then X should happen"