playMaker

Author Topic: Load from File: doesn't trigger Success/Failure Events  (Read 215 times)

Thore

  • Playmaker Newbie
  • *
  • Posts: 47
    • View Profile
Load from File: doesn't trigger Success/Failure Events
« on: July 27, 2017, 06:05:49 AM »
Playmaker 1.8.4

Action: Load from File
Expectation: Trying to load a file that does not exist should lead to triggering the Failure Event. Likewise, if something is found, it should trigger the Success Event.
Bug: When no file is found, it prints out "FileNotFoundException: Could not find file "<path>", but the state is stuck in the state where this action sits, rather than triggering the failure event.

I also like to request a tooltip change on File Path to "e.g. Assets/Test.txt" to make it clearer. For consideration: I tried to understand how paths work, I often encountered the path to look like this "(Application.persistentDataPath + "/test.txt")", so there could be an issue with some type of builds (but I don't know).

Thanks.

EDIT: found out that it ignores both Success Event and Failure Event. On success, it continues to next action (or to next state via finished), and is still functional.
« Last Edit: July 27, 2017, 06:15:08 AM by Thore »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 2260
    • View Profile
    • jinxtergames
Re: Load from File: doesn't trigger Success/Failure Events
« Reply #1 on: July 27, 2017, 09:50:43 AM »
Hi,
I don't know who made these (custom) actions, but they where indeed broken

So i have rebuild them and updated them on the Ecosystem.
I have tested them a little and they seem to work properly now.

Can you re-download them and let me know if they work correctly now?

Thore

  • Playmaker Newbie
  • *
  • Posts: 47
    • View Profile
Re: Load from File: doesn't trigger Success/Failure Events
« Reply #2 on: July 28, 2017, 11:10:12 AM »
Hi djaydino,

It works! Thanks a lot, that's very kind of you especially since it's a custom action. 

Unfortunately, the action isn't robust enough to work in various builds, but that's a different matter.

Unity
Windows Build
Web GL (local & online)

In case you or someone else is interested, here's a simple set up, fast to reproduce (or use attached package below).

  • Make a new scene.
  • Attach FSM to camera, with Load from File on Start state.
  • Make one new state, and on that one...
  • Drag-Drop Camera component from Main Camera. SET PROPERTY backgroundColor, and pick a red.
  • Copy Paste that state, and change the red to a green.
  • Now from Start state, connect failure to the red one, and success to the green one.
  • Put a text file somewhere, and set the path
  • Play, see the green.
  • Make a Web GL build, and play, see the red.

My end goal was to read the txt from StreamingAssets. The documentation hints at complications (and solutions) with paths on Web GL, maybe this is of any use (I'm too newb to make use of this).

Quick solution: add a note that this Action shouldn't be used for Web. ;)


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 2260
    • View Profile
    • jinxtergames
Re: Load from File: doesn't trigger Success/Failure Events
« Reply #3 on: July 30, 2017, 03:55:11 AM »
Hi,
Maybe you can use the 'WWW Object' aciton?

Thore

  • Playmaker Newbie
  • *
  • Posts: 47
    • View Profile
Re: Load from File: doesn't trigger Success/Failure Events
« Reply #4 on: July 31, 2017, 03:14:15 PM »
I used this action, and it worked in Unity. When I build for WebGL it broke.

An error shows up after Web GL building, saying "Could Not Create Action: <FSM name>: <state name>: WWWObject (Maybe the script was removed?)"

I checked what was going on, and now the action vanished entirely without a trace. It is no longer available at all, and gone from the action list (but present in the folder).

Reproduced this in a fresh project.

I noticed that at very top line in Unity you see the Unity Version, Project Name and then it says WebGL. It appears that when you make a build the Unity project itself is set to that type of build. This WebGL setting seems to make certain actions unavailable.

EDIT: also noticed another thing that was broken right before I build it into WebGL. Even though it did fetch the string from a text file hosted on the web, the subsequent action to convert the string to array using the separators in the string, did not work.

Thanks for your help! :)
« Last Edit: August 01, 2017, 04:22:16 AM by Thore »