Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: memetic arts on January 05, 2016, 03:29:04 AM

Title: Using Datamaker with Remote XML Source
Post by: memetic arts on January 05, 2016, 03:29:04 AM
Hi -

Just completed @mdotstrange 's awesome datamaker / xml-to-hashtable tutorial, and had a question. While it seems that it should be easy enough via the WWWObject, I don't see an obvious way (or Action) to load an XML file from an external/remote server.

Hopefully I'm missing something obvious? Shouldn't there be a way to set the source to 'remote'?

Also, many thanks to mdotstrange for the great tut on datamaker, very clear, easy to follow, and, best of all, it *works*.  great stuff!

Thx!

==rr
Title: Re: Using Datamaker with Remote XML Source
Post by: mdotstrange on January 05, 2016, 09:27:44 AM
Glad you liked the tutorial from http://thestrangeschool.com/ (http://thestrangeschool.com/)  ;)

I was curious how to load the xml from the web so I just figured out a way to do it-

I used this xml file web address for this example http://www.w3schools.com/xml/note.xml

Create an XML proxy on the game object- I called mine "test" (http://i.imgur.com/Un8gbju.png)

Here's the first state (http://i.imgur.com/d9lB464.png) I used a version of wwwobject I modified because it was giving me weird errors- the modified action is attached

Here's the second state (http://i.imgur.com/FKf9HcR.png) The set text action is just for debugging purposes and not necessary

And here's the xml from the web loaded into the proxy (http://i.imgur.com/OC4GLbN.png)

Hope that helps
Title: Re: Using Datamaker with Remote XML Source
Post by: memetic arts on January 05, 2016, 10:01:05 AM
Perfect! 

I won't be able to implement/test until later today, but this looks like exactly what I needed. 

Thanks so much for taking the time to put together the explanation and screenshots, very much appreciated.

Cheers

Title: Re: Using Datamaker with Remote XML Source
Post by: memetic arts on January 05, 2016, 08:23:55 PM
Hi . . . so I'm getting going on this, but it seems that after adding your WWWObject1 Action, it doesn't show up in the Action browser . . . and on second look, the original WWWObject action doesn't show up either, eventhough I can see it in my Project panel under PlayMaker>Actions>

I see this in the beginning of the file:

#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_FLASH || UNITY_PS3 || UNITY_BLACKBERRY || UNITY_WP8 || UNITY_WEBGL)

I'm building to iOS ... does this mean the Action won't run on iOS?

EDIT:  Confirmed that the above "if" statement is what was preventing the action from showing up . .. though I'm not sure why that condition is there . . . from what I can tell in Unity Docs, WWWObj is usable in iOS builds . . . so not sure how to proceed here.
Title: Re: Using Datamaker with Remote XML Source
Post by: memetic arts on January 05, 2016, 09:29:26 PM
Bingo, this works!  Thank you again @mdotstrange

Still would like to know why there's an if-not-iOS condition on the WWWObject Action
Title: Re: Using Datamaker with Remote XML Source
Post by: mdotstrange on January 06, 2016, 12:47:33 AM
Glad you got it working  :) Yeh I only tested it on Windows
Title: Re: Using Datamaker with Remote XML Source
Post by: dudebxl on January 07, 2016, 07:15:25 PM
@ mdotstrange

I watched your DataMaker tutorial, very helpful and thx!!!! I have not used DataMaker yet but I will (looking at it now).. except i was surprised with how much work it was to get a Json into a hashtable. I am using WWW Json string so I made some actions to speed everyhtign up, just so you know: http://hutonggames.com/playmakerforum/index.php?topic=11991.0  maybe they will help you in your projects.

Title: Re: Using Datamaker with Remote XML Source
Post by: memetic arts on January 07, 2016, 08:33:15 PM
FYI, something to be aware of w/ JSON . . . I tried to compile my app to iOS last night and got a cross-compile error (which killed the build). The exact error was basically this:

"Cross compilation job Newtonsoft.Json.Net20.dll failed"

I removed the JSON folder inside of the DataMaker directory, and all was well. Filed a bug report, we'll see what happens. Since I'm all-XML now it's not impacting me directly, but is probably worth a test if you're working with JSON.

Title: Re: Using Datamaker with Remote XML Source
Post by: dudebxl on January 07, 2016, 10:16:15 PM
Cool thx for the info.. Actually my actions are not linked to datamaker and work withhout datamaker but still good to know..
Title: Re: Using Datamaker with Remote XML Source
Post by: mdotstrange on January 08, 2016, 12:53:59 AM
@dudebxl

Thx for the json action! I wanted to use json before I went the xml route as json files are easier to author/work with imo- so I'll definitely check it out- thx for making so many new Pm actions btw  :)
Title: Re: Using Datamaker with Remote XML Source
Post by: jeanfabre on January 11, 2016, 07:12:59 AM
Hi,

 uhm, I wasn't aware of this issue with the newton dll, I'll check it out. maybe I need to use an updated version.


 Bye,

 Jean
Title: Re: Using Datamaker with Remote XML Source
Post by: memetic arts on January 11, 2016, 11:34:21 PM
Thank you, Jean!

I'm using XML for now since I'm more familiar with it, but will most likely be moving to JSON, so it's good to know this will be resolved.

cheers
Title: Re: Using Datamaker with Remote XML Source
Post by: jeanfabre on January 13, 2016, 12:57:09 AM
Hi,

 It's all fine actually, you need to simple set the "Api Compatibilty Level" in the PlayerSettings/Optimization to ".NET 2.0" instead of ".NET 2.0 subset"

 Bye,

 Jean