Error when barking from Lua

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
chud575
Posts: 50
Joined: Thu May 11, 2017 10:57 am

Error when barking from Lua

Post by chud575 »

Howdy,

When I call a bark from Lua, it works, but I also get an error message:

Code: Select all

MissingMethodException: The best match for method OnBarkLine has some invalid parameter.
System.MonoType.InvokeMember (System.String name, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object target, System.Object[] args, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, System.String[] namedParameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/MonoType.cs:520)
UnityEngine.SetupCoroutine.InvokeMember (System.Object behaviour, System.String name, System.Object variable) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:31)
UnityEngine.Component:BroadcastMessage(String, Object, SendMessageOptions)
PixelCrushers.DialogueSystem.BarkController:InformParticipantsLine(String, Transform, Subtitle)
PixelCrushers.DialogueSystem.<Bark>c__Iterator7:MoveNext()
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
PixelCrushers.DialogueSystem.DialogueSystemController:BarkString(String, Transform, Transform, String)
PixelCrushers.DialogueSystem.DialogueManager:BarkString(String, Transform, Transform, String)
<BarkNonActor2>c__Iterator0:MoveNext() (at Assets/_Freeport/Scripts/Gameplay/Other/Custom Dialogue Manager Scripts/CustomLuaFunctions.cs:56)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
and here's the Lua Code:

Code: Select all

 public void BarkNonActor(string barkText, string barker, double delay)
    {
        if ((int)delay == -1)
        {
            Transform subject = GameObject.Find(barker).GetComponent<Transform>(); //PixelCrushers.DialogueSystem.SequencerCommands.SequencerCommand.GetSubject(barker);
            print("Bark? " + barkText);// + ", " + subject);
            DialogueManager.BarkString(barkText, subject);
        }
        else
        {
            StartCoroutine(BarkNonActor2(barkText, barker, delay));
        }
    }

    IEnumerator BarkNonActor2(string barkText, string barker, double delay)
    {
        yield return new WaitForSeconds((float)delay);
        Transform subject = GameObject.Find(barker).GetComponent<Transform>(); //PixelCrushers.DialogueSystem.SequencerCommands.SequencerCommand.GetSubject(barker);
        print("Bark2? " + barkText);// + ", " + subject);
        DialogueManager.BarkString(barkText, subject);
    }
User avatar
Tony Li
Posts: 21070
Joined: Thu Jul 18, 2013 1:27 pm

Re: Error when barking from Lua

Post by Tony Li »

That'll be fixed in version 1.7.1 this week. The "OnBarkLine" message that's sent to the Dialogue Manager incorrectly passes the speaker's transform, not the subtitle. It will be corrected to work line the "OnBarkLine" message that's sent to the speaker, which passes the subtitle.
chud575
Posts: 50
Joined: Thu May 11, 2017 10:57 am

Re: Error when barking from Lua

Post by chud575 »

look at you - being a step ahead of me and stuff :p
User avatar
Tony Li
Posts: 21070
Joined: Thu Jul 18, 2013 1:27 pm

Re: Error when barking from Lua

Post by Tony Li »

It just means some other poor soul ran into the same issue first. ;)
Post Reply