playMaker

Author Topic: Import TXT file into string at runtime  (Read 5987 times)

Flying Robot

  • Sr. Member
  • ****
  • Posts: 293
  • Od ton yebo redro
    • View Profile
    • Flying Robot Studios
Import TXT file into string at runtime
« on: October 18, 2013, 10:28:43 AM »
Imports a txt file from an absolute path into a string value at runtime. With a check if the file exists or not.

You can further dig this string using ArrayMaker Split text to arraylist.


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14014
  • Official Playmaker Support
    • View Profile
Re: Import TXT file into string at runtime
« Reply #1 on: October 20, 2013, 11:31:04 PM »
Hi,

 Cool,

 I hope you are maintaining a repository of your custom actions? if you don't I would strongly suggest you do, so that if one day this "action store" see the light, you will be able to add all your contribution without having to digg around.

 Thanks for your input! It's greatly appreciated.

Bye,

 Jean

Flying Robot

  • Sr. Member
  • ****
  • Posts: 293
  • Od ton yebo redro
    • View Profile
    • Flying Robot Studios
Re: Import TXT file into string at runtime
« Reply #2 on: October 21, 2013, 01:03:57 AM »
Thanks Jean,

I was reluctantly maintaining the repository in dropbox. Moved now to github for better maintenance.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14014
  • Official Playmaker Support
    • View Profile
Re: Import TXT file into string at runtime
« Reply #3 on: October 21, 2013, 03:13:50 AM »
Hi,

 Real nice! I actually mean a rep for you to keep track of it in the long run, but a github rep is good, I think I shoudl do that same actually! This way all the sample I creates could be accessible there too.

bye,

 Jean

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: Import TXT file into string at runtime
« Reply #4 on: October 21, 2013, 04:11:25 AM »
Just fyi, I know its not as clean but I generally keep track of the actions I post here by going to Profile>Summary>Profile Info>Show Posts>Attachments... Which shows all of your posts with any attachments. It works for me since I don't have much to keep track of so it may not be as good for you guys.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14014
  • Official Playmaker Support
    • View Profile
Re: Import TXT file into string at runtime
« Reply #5 on: October 21, 2013, 05:06:59 AM »
Hi,

 Did not know about that, thanks! but yeah, an online rep is better tho. I am currently inkering with the idea of using Bitbucket for all the custom actions and samples I provide, because I know they have a rest api back end I could use to then create an Unity Editor system to download and manage custom actions by simply searching the rep and download samples and/or custom action, without leaving the unity editor.

Bye,

 Jean

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: Import TXT file into string at runtime
« Reply #6 on: October 21, 2013, 05:39:25 AM »
Man that would be really cool.

We've kind of thrown around the idea of an extension to manage addon actions and stuff... Would it be feasible to make an asset that checked an online repository of actions like you're talking about and let the user import from a list of those actions? It would basically be an extension that kind of circumvents the asset store as far as action updates are concerned, so you can do small action updates to an online location immediately and only push extension updates to the store.

I wonder if its more effective to maintain the actions separately somehow, at least the addon and custom actions. Maybe its just simpler to keep it out of the store altogether and find a good place like the Wiki. Metrics/analytics would be nice.

Kind of derailing the topic... Sorry.

Flying Robot

  • Sr. Member
  • ****
  • Posts: 293
  • Od ton yebo redro
    • View Profile
    • Flying Robot Studios
Re: Import TXT file into string at runtime
« Reply #7 on: October 21, 2013, 05:50:36 AM »
That's an awesome proposal. What we have to do right now is to search through Hutonggames forums and Wiki. If it can be replaced by a editor extension that checks an online repository and list out the custom actions, it'd be great. Also having a back end to the repository where the action authors can update their action when he requires.

psypol

  • Playmaker Newbie
  • *
  • Posts: 39
    • View Profile
Re: Import TXT file into string at runtime
« Reply #8 on: February 03, 2014, 02:06:17 PM »
hello

sorry stupid noob/question : once i downloaded this .cs file what is
the installation process to see the new playmaker components and actions appear in unity ?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: Import TXT file into string at runtime
« Reply #9 on: February 03, 2014, 02:10:18 PM »
hello

sorry stupid noob/question : once i downloaded this .cs file what is
the installation process to see the new playmaker components and actions appear in unity ?

Just drag it into the project hierarchy.

psypol

  • Playmaker Newbie
  • *
  • Posts: 39
    • View Profile
Re: Import TXT file into string at runtime
« Reply #10 on: February 04, 2014, 02:05:39 PM »
thx. indeed it adds the action.
sorry, parts of unity are still black magic for me ;-)

parallel

  • Full Member
  • ***
  • Posts: 155
    • View Profile
Re: Import TXT file into string at runtime
« Reply #11 on: February 05, 2014, 05:16:19 AM »
Could anyone who has used this action give me an example of how to write the 'absolute path'?

Flying Robot

  • Sr. Member
  • ****
  • Posts: 293
  • Od ton yebo redro
    • View Profile
    • Flying Robot Studios
Re: Import TXT file into string at runtime
« Reply #12 on: February 05, 2014, 06:44:10 AM »
"c:\temp\MyTest.txt"

parallel

  • Full Member
  • ***
  • Posts: 155
    • View Profile
Re: Import TXT file into string at runtime
« Reply #13 on: February 05, 2014, 07:42:40 AM »
Oh, yes that looks absolute, thanks!

MeachWare

  • Playmaker Newbie
  • *
  • Posts: 43
    • View Profile
Re: Import TXT file into string at runtime
« Reply #14 on: February 08, 2014, 06:51:30 AM »
"c:\temp\MyTest.txt"
Which works wonderful on a Mac...  ;)

In re-reading this I am by no means trying to be a RICHARD, just a friendly reminder that both Unity and PlayMaker run (fine) on a Mac and perhaps a more universal (e.g. Application.dataPath + THIS LINK for proper path separator) approach could be taken.
« Last Edit: February 08, 2014, 01:58:00 PM by MeachWare »