playMaker

Author Topic: Global Variables (floats) from txt or xml file?  (Read 2442 times)

jess84

  • Hero Member
  • *****
  • Posts: 515
Global Variables (floats) from txt or xml file?
« on: February 27, 2014, 10:13:22 AM »
For my level balancing, I have 100 levels and each with 3 variables that I want to store as Global floats. (so 300 globals)

Is there an easy way to import these from a txt file or an xml file to set the globals?

I'd like to be able to manage these values outside of Unity, and then just reimport the values if they change. (and not manage them manually)


jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Global Variables (floats) from txt or xml file?
« Reply #1 on: March 02, 2014, 08:46:54 AM »
bump  :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Global Variables (floats) from txt or xml file?
« Reply #2 on: March 03, 2014, 11:46:31 PM »
Hi,

 Use player prefs and some object oriented approach, this is ,much better thab 300 global variables...
 
I am currently working on xmlMaker to bring writing and editing to xml files. It's used in a coming soon game where each level has many variables like yours and this xml is storing and keeping track of all levels details and current user state in them.

 When it reaches a solid version, I'll be pushing it on the user wiki. Currently it's very much a work in progress, especially with the custom action custom editors.

 I can share the current build, but it comes with its very large set of uncertainties and known bugs.

bye,

 Jean

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Global Variables (floats) from txt or xml file?
« Reply #3 on: March 04, 2014, 09:54:11 AM »
Wow, that sounds ideal!

I think I'll wait until it's a bit more solid though, but thanks for the offer to share.

Organising values for balancing, win criterias, etc. is so much easier in an excel document (or even txt file), so if there's a way to one-click import/update all values when they have been edited, that would be amazing.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Global Variables (floats) from txt or xml file?
« Reply #4 on: March 05, 2014, 02:27:36 AM »
Hi,

 yes, good point. I did experiment with this, I can take a.csv and make it as an xml, so that works.

bye,

 Jean

MeachWare

  • Playmaker Newbie
  • *
  • Posts: 43
Re: Global Variables (floats) from txt or xml file?
« Reply #5 on: March 05, 2014, 06:39:20 PM »
That sounds great Jean!

I learned a lot after I took my "universe creator" and decided I wanted an XML based report after the universe was created. It was a bit confusing at first and I still have a bunch of "container" classes but it works a treat!

Of course now I'm going to basically scrap almost the entire process / structure and go a different (faction-based) direction. But I learned a lot in the process.
 8)