playMaker

Author Topic: Having problem with action 'Load From File'[SOLVED]  (Read 3697 times)

sturmburg

  • Playmaker Newbie
  • *
  • Posts: 12
Having problem with action 'Load From File'[SOLVED]
« on: May 04, 2015, 09:06:46 AM »
I need to load a text file into a string.  I've been trying to use 'Load From File' which I got from the Playmaker Ecosystem, but it fails and tells me it can't find the file at the specified path.  But if I follow the path I can actually see the file at that location.

Anyone use this action successfully?

Any help greatly appreciated.
« Last Edit: June 16, 2016, 03:20:26 AM by jeanfabre »

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: Having problem with action 'Load From File'
« Reply #1 on: June 12, 2016, 02:12:46 PM »
I have the same problem, I am using "Application.dataPath/StreamingAssets/T_GameReset.txt" to find the file.

I tried also "/StreamingAssets/T_GameReset.txt" but of course it points then to "C:/StreamingAssets/T_GameReset.txt" and it's not ok.

I want to make this once and for all to be sure it will work on Mac, Linux, and if I'll manage to port the game, also on PS4 and Xbox.

However, it seems I am having problems in general with some actions.
This one, like the other actions I took from the EcoSystem, seems to not complete the state.
It doesn't throw an error, it simply doesn't start any transitions.

I am using PlayMaker 1.8.0.f43 on Unity 5.4.0b17.

Edit: I've just made a test and put the file in C: and this way it works... so I guess there's some problem in catching the error... but I need to know how to point at StreamingAssets.
« Last Edit: June 12, 2016, 02:15:32 PM by megmaltese »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Having problem with action 'Load From File'
« Reply #2 on: June 14, 2016, 02:59:57 AM »
Hi,

 First, you should not use "StreamingAssets" for anything but streaming medias.

Use "Resources" for text files.

Then you can use Resources.Load which then works across all platforms.

Bye,

 Jean

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: Having problem with action 'Load From File'
« Reply #3 on: June 14, 2016, 05:13:10 PM »
Uhhh but why? For what I read, StreamingAssets is the way to have files available in the local filesystem of the application, so I find nothing strange in loading a text file from there... also, the action works great by loading from C:/, why not just get the StreamingAssets folder path or tell me what it is?
« Last Edit: June 14, 2016, 05:17:40 PM by megmaltese »

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: Having problem with action 'Load From File'
« Reply #4 on: June 14, 2016, 05:23:17 PM »
Tried Resources Load from the EcoSystem, gives me error all the time, don't know what is the path to put in there.
My text file is under "SR/StreamingAssets/T_GameReset.txt" in the Assets folder, but this doesn't work and throws an error.

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: Having problem with action 'Load From File'
« Reply #5 on: June 14, 2016, 05:39:05 PM »
OK, managed by insisting on Load From File, found that the right path to put in the field is "Assets/StreamingAssets/T_GameReset.txt" even though this way I have my doubts it will work on different platforms, but for now I will proceed with this.
I thought that the StreamingAssets folder was the root of the system...