playMaker

Author Topic: Using Datamaker with Remote XML Source  (Read 4896 times)

memetic arts

  • Full Member
  • ***
  • Posts: 141
Using Datamaker with Remote XML Source
« 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
« Last Edit: January 05, 2016, 07:08:16 PM by memetic arts »

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Using Datamaker with Remote XML Source
« Reply #1 on: January 05, 2016, 09:27:44 AM »
Glad you liked the tutorial from 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"

Here's the first state 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 The set text action is just for debugging purposes and not necessary

And here's the xml from the web loaded into the proxy

Hope that helps
« Last Edit: January 05, 2016, 09:52:26 AM by mdotstrange »
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

memetic arts

  • Full Member
  • ***
  • Posts: 141
Re: Using Datamaker with Remote XML Source
« Reply #2 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


memetic arts

  • Full Member
  • ***
  • Posts: 141
Re: Using Datamaker with Remote XML Source
« Reply #3 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.
« Last Edit: January 05, 2016, 08:48:26 PM by memetic arts »

memetic arts

  • Full Member
  • ***
  • Posts: 141
Re: Using Datamaker with Remote XML Source
« Reply #4 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

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Using Datamaker with Remote XML Source
« Reply #5 on: January 06, 2016, 12:47:33 AM »
Glad you got it working  :) Yeh I only tested it on Windows
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Using Datamaker with Remote XML Source
« Reply #6 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.


memetic arts

  • Full Member
  • ***
  • Posts: 141
Re: Using Datamaker with Remote XML Source
« Reply #7 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.


dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Using Datamaker with Remote XML Source
« Reply #8 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..

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Using Datamaker with Remote XML Source
« Reply #9 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  :)
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Using Datamaker with Remote XML Source
« Reply #10 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

memetic arts

  • Full Member
  • ***
  • Posts: 141
Re: Using Datamaker with Remote XML Source
« Reply #11 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

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Using Datamaker with Remote XML Source
« Reply #12 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