Another Revive of an old question of mine
I used the script you created on page 1 for my auto button to put in my option menu... it works fine IF there is a conversation running, however if there is not i get the following error :
Code: Select all
TargetException: Non-static field requires a target
System.Reflection.MonoField.GetValue (System.Object obj) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoField.cs:108)
GameSettingsOptions.ToggleAutoText (Boolean ATtoggle) (at Assets/Scripts/Settings/GameSettingsOptions.cs:130)
UnityEngine.Events.InvokableCall`1[System.Boolean].Invoke (System.Object[] args) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:189)
I did not copy the whole thing as it seems to be useless after that part...
I had to edit my post from here, because I changed the whole thing to separate a EnableAutoText and DisableAutoText (it made it easier to set it back after loading a game) - I should not here that I use my own save/load I had made prior to buying the Dialogue System... its a super easy binary formatter that saves all my global-static-variables that holds everything of "value"...
I am now 99% sure the error comes from the line :
Code: Select all
var sequencer = typeof(ConversationView).GetField ("sequencer", BindingFlags.NonPublic | BindingFlags.Instance).GetValue (DialogueManager.ConversationView) as Sequencer;
When AutoDialogue is enabled while "not" in a conversation at all...
Here is a copy of my 3 methods to (toggle button, enable and disable)
Code: Select all
public void ToggleAutoText (bool ATtoggle)
{
if (ATtoggle)
{
EnableAutoText ();
}
else
{
DisableAutoText();
}
}
public void EnableAutoText ()
{
var oldMode = DialogueManager.DisplaySettings.subtitleSettings.continueButton;
{
if (oldMode == DisplaySettings.SubtitleSettings.ContinueButtonMode.Always)
{
var newMode = DisplaySettings.SubtitleSettings.ContinueButtonMode.Never;
DialogueManager.DisplaySettings.subtitleSettings.continueButton = newMode;
var sequencer = typeof(ConversationView).GetField ("sequencer", BindingFlags.NonPublic | BindingFlags.Instance).GetValue (DialogueManager.ConversationView) as Sequencer;
if (!sequencer.IsPlaying)
{
DialogueManager.Instance.BroadcastMessage ("OnContinue", SendMessageOptions.DontRequireReceiver);
}
}
if (DialogueManager.ConversationView != null)
{
DialogueManager.ConversationView.SetupContinueButton ();
}
}
}
public void DisableAutoText ()
{
var oldMode = DialogueManager.DisplaySettings.subtitleSettings.continueButton;
if (oldMode == DisplaySettings.SubtitleSettings.ContinueButtonMode.Never)
{
var newMode = DisplaySettings.SubtitleSettings.ContinueButtonMode.Always;
DialogueManager.DisplaySettings.subtitleSettings.continueButton = newMode;
}
if (DialogueManager.ConversationView != null)
{
DialogueManager.ConversationView.SetupContinueButton ();
}
}
No idea what that error means... or what that "reflection" is... had to add it at the top with the other "using" otherwise there was red lines in there...
Its really not easy to be thorough and make a great option menu for the players! No wonder most games just dont care enough to take the time to create a great option menu!