Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: Flying Robot on October 18, 2013, 01:28:43 PM

Title: Import TXT file into string at runtime
Post by: Flying Robot on October 18, 2013, 01:28:43 PM
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.

Title: Re: Import TXT file into string at runtime
Post by: jeanfabre on October 21, 2013, 02:31:04 AM
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
Title: Re: Import TXT file into string at runtime
Post by: Flying Robot on October 21, 2013, 04:03:57 AM
Thanks Jean,

I was reluctantly maintaining the repository in dropbox. Moved now to github for better maintenance.
Title: Re: Import TXT file into string at runtime
Post by: jeanfabre on October 21, 2013, 06: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
Title: Re: Import TXT file into string at runtime
Post by: Lane on October 21, 2013, 07: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.
Title: Re: Import TXT file into string at runtime
Post by: jeanfabre on October 21, 2013, 08: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
Title: Re: Import TXT file into string at runtime
Post by: Lane on October 21, 2013, 08: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.
Title: Re: Import TXT file into string at runtime
Post by: Flying Robot on October 21, 2013, 08: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.
Title: Re: Import TXT file into string at runtime
Post by: psypol on February 03, 2014, 04: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 ?
Title: Re: Import TXT file into string at runtime
Post by: Lane on February 03, 2014, 04: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.
Title: Re: Import TXT file into string at runtime
Post by: psypol on February 04, 2014, 04:05:39 PM
thx. indeed it adds the action.
sorry, parts of unity are still black magic for me ;-)
Title: Re: Import TXT file into string at runtime
Post by: parallel on February 05, 2014, 07:16:19 AM
Could anyone who has used this action give me an example of how to write the 'absolute path'?
Title: Re: Import TXT file into string at runtime
Post by: Flying Robot on February 05, 2014, 08:44:10 AM
"c:\temp\MyTest.txt"
Title: Re: Import TXT file into string at runtime
Post by: parallel on February 05, 2014, 09:42:40 AM
Oh, yes that looks absolute, thanks!
Title: Re: Import TXT file into string at runtime
Post by: MeachWare on February 08, 2014, 08: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 (http://"http://docs.unity3d.com/Documentation/ScriptReference/Path.html") for proper path separator) approach could be taken.
Title: Re: Import TXT file into string at runtime
Post by: psypol on August 04, 2015, 01:45:10 PM
Hello

im using unity 4.6.1f1 and i tried to use this script
when i drag&droped the file into the Project i have these errors :

Quote
Assets/external_scripts/ImportTXT.cs(9,2): error CS0246: The type or namespace name `Tooltip' could not be found. Are you missing a using directive or an assembly reference?
+
Quote
Assets/external_scripts/ImportTXT.cs(9,2): error CS0104: `TooltipAttribute' is an ambiguous reference between `UnityEngine.TooltipAttribute' and `HutongGames.PlayMaker.TooltipAttribute'

Any idea how to get rid of those ?
thanks
Title: Re: Import TXT file into string at runtime
Post by: jeanfabre on August 06, 2015, 01:41:30 AM
Hi,

 This action need to be refactored and put into PlayMaker Action namespace to avoid conflicts with Unity. Where did you get it?

Bye,

 Jean
Title: Re: Import TXT file into string at runtime
Post by: psypol on August 06, 2015, 04:14:16 AM
Hello Jean. I got this action here in this thread (see start of page 1)
Title: Re: Import TXT file into string at runtime
Post by: edufurla on August 06, 2015, 10:45:51 AM
Hi.
Someone knows how write the path to get a txt file inside my assets folder.
I want publish the project with the txt file included.
Title: Re: Import TXT file into string at runtime
Post by: psypol on August 06, 2015, 11:22:27 AM
Hi.
Someone knows how write the path to get a txt file inside my assets folder.
I want publish the project with the txt file included.

How did you managed to read the file in the first place ?
+1 on your question cause i'm trying to achieve the same thing.
Title: Re: Import TXT file into string at runtime
Post by: edufurla on August 06, 2015, 01:03:07 PM
If I put the txt file in some place like C:\works\txt\text.txt works fine, but I have to create this exact folder structure when I copy the published project to another computer.
I would like to copy just the published folder, so coud be good find a way this action get the txt file from the assets.
Title: Re: Import TXT file into string at runtime
Post by: jeanfabre on August 20, 2015, 01:50:25 PM
Hi,

 you can, using Resources (http://docs.unity3d.com/ScriptReference/Resources.html) and the action ResourcesLoad (https://github.com/jeanfabre/PlayMakerCustomActions_U3/blob/master/Assets/PlayMaker%20Custom%20Actions/Resources/ResourcesLoad.cs) from the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181)

 Bye,

 Jean
Title: Re: Import TXT file into string at runtime
Post by: edufurla on August 20, 2015, 03:33:01 PM
Thank you for the answer Jean. I will try this for next projects.
I already solve the problem using GoogleFu.
 :)
Title: Re: Import TXT file into string at runtime
Post by: jeanfabre on September 14, 2015, 03:17:01 AM
Hi,

 yep, Googlefu is great indeed
 
Bye,
 Jean