What's the full output of the Console at the time the error occurs? Also, if you unpause Unity after the error shows for the first time, what happens the next time a speech line is played?
I found when using "Duplicate for each line?", there is not NullPointException. But the problem is the Dummy Text cannot get the subtitle text, and thus cannot set the Panel (for the subtitle background) to the correct size.
The 2 Debug.Log() gives these responses when subtitle pops up:
You previously said there was a NRE error on line 15, which suggests the issue was with the menu variable - not speech (which there is a null-check for).
Were you using this previously without the duplicate-line option? As you'd said a need for it earlier, this script is only compatible with that option.
What is the exact error message you're getting in the Console?
When using the script with the duplicate-line option, there is no NRE error. But the problem of my previous reply exist. I think maybe I can resort to having only 1 speech bubble at a time, and use the first solution without the duplicate-line option.
What about the other Console messages? Where do they show in relation to the above two?
The two new messages are exactly as they should be. I think we could go on forever trying to debug like this, because - like I said - it works for me.
Create a .unitypackage file of your 8 Manager assets, UI Canvas prefabs and the custom script you've attached to the Canvas in question - then PM it to me.
Finally managed to solve it! The issue is really in the script (as you hinted in the PM):
I used a script of sizeDelta to resize of the subtitle text background according to the dummy text size. The sizeDelta part always works but it somehow puts the subtitle menu panel above the anchor point (which is at top-left so the entire subtitle menu cannot be seen in game). This is solved by using the Move with character? option.
One finding is when the subtitle position is chosen to be Above Player the subtitle is always at the correct position even without the Move with character? option. I needed it because I have chosen the Above Speaking Character option.
Comments
This script tweaks things to show a little debug info. What does the Console say?
http://pasteall.org/953139/csharp
Then inside PlayerMenus.cs, and find the GetMenuWithCanvas method (around line 2761), and insert the following at the top of it:
Debug.Log ("DupMenus: " + dupSpeechMenus.Count + ", Menus: " + menus.Count);
What's the full output of the Console at the time the error occurs? Also, if you unpause Unity after the error shows for the first time, what happens the next time a speech line is played?
and
Were you using this previously without the duplicate-line option? As you'd said a need for it earlier, this script is only compatible with that option.
What is the exact error message you're getting in the Console?
NullReferenceException: Object reference not set to an instance of an object
When using the script with the duplicate-line option, there is no NRE error. But the problem of my previous reply exist. I think maybe I can resort to having only 1 speech bubble at a time, and use the first solution without the duplicate-line option.
Try this: open Menu.cs, and find the method SetSpeech (around line 2714). Just above the line "speech = _speech;", insert the following:
Debug.LogWarning ("Assigning speech: " + _speech);
if (_speech != null) Debug.LogWarning ("Speech text: " + _speech.log.fullText);
What's the output of the Console then?
and
The two new messages are exactly as they should be. I think we could go on forever trying to debug like this, because - like I said - it works for me.
Create a .unitypackage file of your 8 Manager assets, UI Canvas prefabs and the custom script you've attached to the Canvas in question - then PM it to me.
I used a script of sizeDelta to resize of the subtitle text background according to the dummy text size. The sizeDelta part always works but it somehow puts the subtitle menu panel above the anchor point (which is at top-left so the entire subtitle menu cannot be seen in game). This is solved by using the Move with character? option.
One finding is when the subtitle position is chosen to be Above Player the subtitle is always at the correct position even without the Move with character? option. I needed it because I have chosen the Above Speaking Character option.
Thanks for the extensive help again!