playMaker

Author Topic: Resources Load  (Read 42050 times)

Farwest

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 63
Re: Resources Load
« Reply #45 on: October 04, 2018, 09:23:17 AM »
Hi.
Ok, i think this should work.

I have added a Do Not Spawn, But the default is set to false, else it would break the action for other people.
So you will need to change that on all your resource actions that you wish not to spawn the object.

I did a little bit of testing and it seems to work, but be sure to make a backup when you try (you never know)

You can get it from the attachment below.
Let me know if it works, so i can update the action on the Ecosystem :)

djaydino, you are awesome! Yes it works as intended flawlessly. Thank you so much, you deserve more than mere thanks!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7623
    • jinxtergames
Re: Resources Load
« Reply #46 on: October 05, 2018, 01:10:59 AM »
Hi.
Just a side note, if you need to spawn many object of the same type you should look into pooling, especially if you see performance issues.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15537
  • Official Playmaker Support
Re: Resources Load
« Reply #47 on: October 05, 2018, 02:00:16 AM »
Hi,

 Oh, I see now. Sorry I was off on this one.

 Ok, so maybe we should implement something like a new fsmbool in the actual action to enable/disable instantiation?

Can you take care of that Kurt?

 Bye,

 Jean

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7623
    • jinxtergames
Re: Resources Load
« Reply #48 on: October 05, 2018, 07:20:05 AM »
Hi.
That's exactly what i did :)

So default the action will still do the same and not break if someone would update the action.

I will update on the Ecosystem

Farwest

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 63
Re: Resources Load
« Reply #49 on: October 05, 2018, 08:36:43 AM »
Hi.
Just a side note, if you need to spawn many object of the same type you should look into pooling, especially if you see performance issues.

Thank you, I will check Pooling system.

Actually, I am checking which Enemies Player will going to face, then I procedurally generate and spawn them in a Loop (after the limit of Enemies are reached, loop stops). Loop starts at the start of every battle, therefore I use Resource Load only for the amount of Enemies selected only, in a limited way.

It seems pooling system will be necessary, when I need to duplicate them more in a battle as amount of enemy decrease by battling (I don't duplicate them with Resource Load). Thanks again for the tips.

LogLady

  • Full Member
  • ***
  • Posts: 150
Re: Resources Load
« Reply #50 on: August 08, 2019, 05:57:23 PM »
"Rise from your grave!"

Hi!
I'm using the "resources.load" action and unity 2019.1.13f1 but got stuck on something:

If I hardcode the path needed to load a file it works ok but if I get a string from a text file (this text is the path to the file that I can load hardcoding) I get a failure result. Is there a way to load files from the resources folder without hardcoding it?
« Last Edit: August 08, 2019, 06:11:15 PM by LogLady »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7623
    • jinxtergames
Re: Resources Load
« Reply #51 on: August 08, 2019, 07:44:12 PM »
Hi.
can you show the path its getting.

i believe i can remember when getting from a text file that some issues where there with the / or \
But im not sure.

i will try to if i can find it back tomorrow (almost 2 am here at the moment)

But if its from xlm file it should work (using datamaker)

LogLady

  • Full Member
  • ***
  • Posts: 150
Re: Resources Load
« Reply #52 on: August 08, 2019, 08:19:34 PM »
Hi!

I'm using / to access the data. The problem is that if I hardcode the path "folder/fileToAccess" the resource.load action works ok. If I put the very same path "folder/fileToAccess" in a string and the load this string inside the resource.load action I receive a failure event.

The attached picture shows more info about what is happening. The editor console shows no info about it, by the way.

1. Hardcoded and working. For what I want I can't have hardcoded paths to files because it rises the number of things to do manually without any reuse.

2. The path string is inside an array and is obtained correctly.

3. Shows the string to be used with the resource.load action and that it will not work.

4. The same as number 2 but in play mode.

5. File loaded incorrectly.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7623
    • jinxtergames
Re: Resources Load
« Reply #53 on: August 09, 2019, 09:37:31 AM »
Hi.
Just tested on my end and it seems to work fine here.



Are you doing this @start? if so try to set a next frame event before doing this.

Also be sure there is no space @ the end of the string in the array

But i would suggest using xml for dialogue if you have several lines and different languages.

This tutorial might help to understand how to use this :


LogLady

  • Full Member
  • ***
  • Posts: 150
Re: Resources Load
« Reply #54 on: August 09, 2019, 03:01:39 PM »
@djaydino
"Also be sure there is no space @ the end of the string in the array"

I have more than one line inside my text file and I think that it is the same as the new line character (hidden) after the path line and that is the problem. Is there a way to avoid it without using "get string left" function?

I tested like you did with just one line inside the text file and it works fine.

Just to clarify, an example:
Inside your test file, after the line "This is a test" press enter and add another line. Try to pick the first line and you will get the error.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7623
    • jinxtergames
Re: Resources Load
« Reply #55 on: August 10, 2019, 05:53:52 PM »
Hi.
indeed.

Maybe something like "Split Text To Array" (Ecosystem) can help.
you can split as new lines


LogLady

  • Full Member
  • ***
  • Posts: 150
Re: Resources Load
« Reply #56 on: August 10, 2019, 10:08:09 PM »
@djaydino

The "Split text to array list" is what I'm using but it picks the new line character and it is what throws the error. I solved it using the "Get string left" function but I'll need a fixed characters number for the files but in the end it will help to keep things organized.

I'm studying your xml video, by the way.

Thanks for your help!