Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: looi on May 27, 2016, 08:40:22 AM

Title: Xml Select Single Node set xPath Query by string variable?[SOLVED]
Post by: looi on May 27, 2016, 08:40:22 AM
Hello!

I'm using the action Xml Select Single Node action, which is in the DataMaker package. I am using a xml file as source.

When I do the action with an xPath Query introduced by text it works fine, but the problems comes when I want to set the xPath Query by an string variable. It just don't allow me to select any string. I mean, they appear in the dropdown, but when I select one, the input remains in "None".

If I try to do it at runtime, it appears this error in the console:

"ArgumentException: Object type HutongGames.PlayMaker.FsmString cannot be converted to target type: System.Boolean
Parameter name: val
System.Reflection.MonoField.SetValue (System.Object obj, System.Object val, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoField.cs:133)
System.Reflection.FieldInfo.SetValue (System.Object obj, System.Object value) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/FieldInfo.cs:150)
HutongGames.PlayMakerEditor.ActionEditor.DoVariableSelection (System.Object userdata) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/ActionEditor.cs:2779)
UnityEditor.GenericMenu.CatchMenu (System.Object userData, System.String[] options, Int32 selected) (at C:/buildslave/unity/build/artifacts/generated/common/editor/GenericMenuBindings.gen.cs:122)"

So I don't know if I am missing something or what, but I can't find why it happens. I've also tried to set it as "None" and then add more variables, but it just don't work...

Have somebody been in this problem?

Thank you!
Title: Re: Xml Select Single Node set xPath Query by string variable?
Post by: djaydino on May 27, 2016, 08:20:18 PM
Hi,

Quote
cannot be converted to target type: System.Boolean

this says that it wants to convert to a bool but it can't

Can you check if your variable is set to a string and not to a bool?

if that did not solve, could you show some pictures on how it worked and not worked.
and from your variables.
Title: Re: Xml Select Single Node set xPath Query by string variable?
Post by: looi on May 30, 2016, 04:15:44 AM
Oh Oh!

It was my fault, I was incorrectly using the variables inside the parsed string! I didn't understand what "Variable _0_" means but now I do!

Thanks to this magnífic video:
https://www.youtube.com/watch?v=eB_E4embTvw (https://www.youtube.com/watch?v=eB_E4embTvw)