Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: jeanfabre on May 17, 2013, 02:03:21 AM

Title: Resources Load
Post by: jeanfabre on May 17, 2013, 02:03:21 AM
Hi Everyone,

 following a post: http://hutonggames.com/playmakerforum/index.php?topic=3904.msg18167#msg18167

Please find an action to load gameObjects, textures and materials from the resources folders in your assets based on the path of the asset.

Basically, this allow you to define the name of the asset using string, instead of having to maintain references. Also Working with Resources has special requirements, make sure you follow the guidelines:

http://docs.unity3d.com/Documentation/ScriptReference/Resources.html

[EDIT] new version with more checks to avoid error if resource is not found.
[EDIT: February 2014] now supported loading text assets in a FsmString.

Bye,

 Jean

Title: Re: Resources Load
Post by: junglist on June 24, 2013, 01:43:23 PM
this is great Jean! Would you please make a variation of this action that works like  this:

http://answers.unity3d.com/questions/425609/can-you-instantiate-random-prefabs-from-the-resour.html

whydoidoit's answer fetches a random prefab from a specified folder inside resources. We can just use playmaker's create object to spawn.
Title: Re: Resources Load
Post by: jeanfabre on June 25, 2013, 02:53:49 AM
Hi,

 you can do this already.

1: create the string representing your prefab name using actions such as "random int","int to string" and "build string"

2: inject that prefab name in "Resources Load" and done.

bye,

 Jean
Title: Re: Resources Load
Post by: junglist on June 25, 2013, 03:17:22 AM
I just found this: http://hutonggames.com/playmakerforum/index.php?topic=3138.0

Combined with the actions you mentioned this will work. Thank you
Title: Re: Resources Load
Post by: jeanfabre on June 25, 2013, 03:30:57 AM
Hi,
 
 I see, your issue was in finding out the number of prefabs in the resources. Thats' kind of dangerous cause you may have more prefabs in the end, not just the ones related to that particular feature.

bye,

 Jean
Title: Re: Resources Load
Post by: junglist on June 25, 2013, 01:25:05 PM
I was assuming that much, but as long as I organize the folders/prefabs properly it should be perfect for my needs I think. I will be sure to post my results in this thread, thank you again for your input Jean
Title: Re: Resources Load
Post by: jeanfabre on July 04, 2013, 03:05:50 AM
Hi,

 Small improvements, now it will not throw errors if resource is not found ( especially with prefabs).

bye,

 Jean
Title: Re: Resources Load
Post by: mohvisuals on August 01, 2013, 04:43:42 PM
I am unable to get this to work.

I have a folder called Resources and within that I have a prefab named Sphere.

Resources/Sphere is my Asset Path

I have the Type set to GameObject and the variable set.

What am I missing?
Title: Re: Resources Load
Post by: jeanfabre on August 02, 2013, 08:56:54 AM
Hi,

 You are likely having a typo in the reference of the resource.

Bye,

 Jean
Title: Re: Resources Load
Post by: FractalCore on October 04, 2013, 04:55:42 AM
I just tried your Sphere example. It's already looking in Resources so you don't include that in the Asset Path. Just putting Sphere in the Asset Path works.
Title: Re: Resources Load
Post by: JennaReanne on September 25, 2014, 03:46:57 PM
This action is great - thank you Jean!  It looks like it both loads and instantiates prefabs in the scene; would it be possible to adjust this action or create a new one that gives us the option to just load a prefab into a variable?  Then we can use Create Object to define where we want to prefab to load in the scene.

Thank you!
Best,
Jenna
Title: Re: Resources Load
Post by: Lane on September 26, 2014, 11:01:41 AM
Hey Jenna,

Did this solve your problems here (http://hutonggames.com/playmakerforum/index.php?topic=8450.0)? Or did you need this action possibly extended or more functionality? Just want to make sure it doesn't get buried and be unsolved.
Title: Re: Resources Load
Post by: JennaReanne on September 29, 2014, 09:54:12 AM
Hi Lane - I realized that the behavior I described in that thread was actually normal for Unity (I'll go back and update it!), so I'm using resource loading to help alleviate the memory issues.  I'm somewhat constrained in my use of the Resource Load action, though, because it instantiated a prefab as soon as it loads it.  It would be nice to have the option to just load it into a variable, then create it with a later action.

Thanks,
Jenna
Title: Re: Resources Load
Post by: escpodgames on December 19, 2014, 05:26:13 PM
New version of the action with the ability to load AudioClips

Set the variable to Object and the Results variable to Object UnityEngine.AudioClip
Title: Re: Resources Load
Post by: jeanfabre on January 19, 2015, 02:05:28 AM
Hi,

 Very good, I have added the changes it to version available on the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181)

Bye,

 Jean
Title: Re: Resources Load
Post by: lejeux16 on February 08, 2015, 04:39:00 PM
Where is the link to download "Resources Load"? Maybe I missed something but I don't understand where I can find it.
Title: Re: Resources Load
Post by: lejeux16 on February 08, 2015, 05:05:21 PM
I copy the action ResourcesLoad.cs in the action folder but I have a error in the unity log:

Assets/PlayMaker/Actions/ResourcesLoad.cs(18,24): error CS0246: The type or namespace name `FsmVar' could not be found. Are you missing a using directive or an assembly reference?

What is this mean?
Title: Re: Resources Load
Post by: jeanfabre on February 17, 2015, 01:31:43 AM
Hi,

It's likely that you have errors in your project, can you double check that this is the only error you have in the console?

 else, are you sure you have PlayMaker installed? the latest from the Asset store?

 Bye,

 Jean
Title: Re: Resources Load
Post by: Budde88 on February 28, 2015, 08:14:41 AM
I was wondering if there was a way to load a whole folder full of assets within the Resources folder. Load All Assets Resources/ExampleFolder.

I am having issues with this Resources Load script. It will Load Some Textures, but then it just won't load others...

But I would like the ability to do what I mentioned above, is this possible?
Title: Re: Resources Load
Post by: jeanfabre on February 28, 2015, 11:13:43 AM
Hi,

 it should load any of the textures you have in your resources, if it doesn't work, it's likely a problem with the path you express to reach that texture.

 Use Asset Bundles if you want to load a series of textures or content in one go.

 Bye,

 Jean
Title: Re: Resources Load
Post by: phannDOTde on June 30, 2015, 09:33:48 AM
Seems that the action actually included in the Ecosystem doesn't work out of the box with unity 5 and should it be able to load sprites as well? Since I get following error if I use the action from this thread to pull a sprite:

InvalidCastException: Cannot cast from source type to destination type.
HutongGames.PlayMaker.Actions.uGuiImageSetSprite.DoSetImageSourceValue () (at Assets/PlayMaker Custom Actions/uGui/uGuiImageSetSprite.cs:60)
HutongGames.PlayMaker.Actions.uGuiImageSetSprite.OnEnter () (at Assets/PlayMaker Custom Actions/uGui/uGuiImageSetSprite.cs:43)
HutongGames.PlayMaker.FsmState.ActivateActions (Int32 startIndex)
HutongGames.PlayMaker.FsmState.OnEnter ()
HutongGames.PlayMaker.Fsm.EnterState (HutongGames.PlayMaker.FsmState state)
HutongGames.PlayMaker.Fsm.SwitchState (HutongGames.PlayMaker.FsmState toState)
HutongGames.PlayMaker.Fsm.UpdateStateChanges ()
HutongGames.PlayMaker.Fsm.Start ()
PlayMakerFSM.Start ()
Title: Re: Resources Load
Post by: jeanfabre on June 30, 2015, 03:35:51 PM
Hi,

 are you saving the loaded resource in a FsmObject of the right type ( UnityEngine.Sprite), else the type is lost and becomes generic and can't be injected back where it's supposed to be.

 Bye,

 Jean
Title: Re: Resources Load
Post by: phannDOTde on June 30, 2015, 05:28:34 PM
Hi,

 are you saving the loaded resource in a FsmObject of the right type ( UnityEngine.Sprite), else the type is lost and becomes generic and can't be injected back where it's supposed to be.

 Bye,

 Jean

yes I do - the action from the ecosystem btw. drops this error once included in the project (unity 5.1.1f1):

Assets/PlayMaker Custom Actions/Resources/ResourcesLoad.cs(133,64): error CS1061: Type `HutongGames.PlayMaker.FsmVar' does not contain a definition for `ObjectType' and no extension method `ObjectType' of type `HutongGames.PlayMaker.FsmVar' could be found (are you missing a using directive or an assembly reference?)

Title: Re: Resources Load
Post by: phannDOTde on June 30, 2015, 05:48:18 PM
Hi,

 are you saving the loaded resource in a FsmObject of the right type ( UnityEngine.Sprite), else the type is lost and becomes generic and can't be injected back where it's supposed to be.

 Bye,

 Jean

I just saw that the first error I posted was from "uGui Set Sprite" - my bad - but the sprite is newer loaded, not sure what I'm doing wrong. The sprite is located directly in "Resources" called "ID_WPN_0001" therefore I try to load "ID_WPN_0001" or did I misunderstand something?

Addition: so far I can follow the Actions Script there is no Sprite Type included at all *wondering*

Another Addition: as for testing  loading a "Texture" works fine :-/
Title: Re: Resources Load
Post by: jeanfabre on July 01, 2015, 01:43:50 AM
Hi,

 - a Sprite is not a Texture, both use an image, but Unity will treat them differently, so make sure you select that file and make sure you selected "sprite" as it's type.

 - Can you load it as a texture in an FsmTexture and can you debug it in PlayMaker ( can you verify that indeed the FsmTexture has been feeded with this resource?)

Bye,

 Jean
Title: Re: Resources Load
Post by: phannDOTde on July 01, 2015, 07:58:02 AM
Hi,

 - a Sprite is not a Texture, both use an image, but Unity will treat them differently, so make sure you select that file and make sure you selected "sprite" as it's type.

 - Can you load it as a texture in an FsmTexture and can you debug it in PlayMaker ( can you verify that indeed the FsmTexture has been feeded with this resource?)

Bye,

 Jean

Hi Jean

- the source image is set as a sprite in the import settings (see attachment)
- I cross checked yesterday and I can load the same thing (resources load) as an texture and apply it to an raw image component without any issues - if that is what you meant

ps.: I use the actions version from the ecosystem now but I throw out everything from the "Unity 3_5" case in the cs script bc of the error it throws in Unity 5

best
Peter


Title: Re: Resources Load
Post by: jeanfabre on July 02, 2015, 07:28:06 AM
Hi,

 ok, few things:

-- the ResourcesLoad action works fine in Unity 5, I just tested, can you explain what's wron and why you had to edit it?

-- I validated the principle here, I can load a sprite from a Resources folder using the action "resourcesLoad" and it's fine, the important setup are:

the resourcesLoad MUST be set properly,

type must be "object"
Object Type must be "UnityEngine.Sprite"
StoreAsset must be a FsmObject of type "UnityEngine.Sprite"
 Success and Failure event must be transitions of the state so that you can validate the good execution of the action.


I have attached the test I just did, can you confirm that scene is working for you on your end?

Bye,

 Jean
Title: Re: Resources Load
Post by: phannDOTde on July 02, 2015, 08:55:30 AM
Hi,

 ok, few things:

-- the ResourcesLoad action works fine in Unity 5, I just tested, can you explain what's wron and why you had to edit it?

-- I validated the principle here, I can load a sprite from a Resources folder using the action "resourcesLoad" and it's fine, the important setup are:

the resourcesLoad MUST be set properly,

type must be "object"
Object Type must be "UnityEngine.Sprite"
StoreAsset must be a FsmObject of type "UnityEngine.Sprite"
 Success and Failure event must be transitions of the state so that you can validate the good execution of the action.


I have attached the test I just did, can you confirm that scene is working for you on your end?

Bye,

 Jean

Hi Jean

thanks for taking the time.

- As I mentioned in some post before loading "ResourcesLoad.cs" from the Eco system as does loading your sample throws this error:
Quote
Assets/PlayMaker Custom Actions/Resources/ResourcesLoad.cs(133,64): error CS1061: Type `HutongGames.PlayMaker.FsmVar' does not contain a definition for `ObjectType' and no extension method `ObjectType' of type `HutongGames.PlayMaker.FsmVar' could be found (are you missing a using directive or an assembly reference?)

So I figure I remove the UNITY_3_5 exception

Code: [Select]
#if ! UNITY_3_5
System.Type _type = storeAsset.ObjectType;
if (_type == typeof(UnityEngine.Sprite))
{
/* Can't find a way to make a reusable code for All types...
FsmObject _target= this.Fsm.Variables.GetFsmObject(storeAsset.variableName);
// _target.Value = this.LoadResourceByType<_type>(assetPath.Value);

var mi = typeof(ResourcesLoad).GetMethod("LoadResourceByType");
var fooRef = mi.MakeGenericMethod(_type);
_target.Value = (Object)fooRef.Invoke(new ResourcesLoad(), new object[] { assetPath.Value });
*/


UnityEngine.Sprite _sprite = (UnityEngine.Sprite)Resources.Load(assetPath.Value,typeof(UnityEngine.Sprite));
if (_sprite==null)
{
return false;
}else{
FsmObject _target= this.Fsm.Variables.GetFsmObject(storeAsset.variableName);
_target.Value = _sprite;
return true;
}
}
if (_type == typeof(AudioClip))
{
AudioClip audioClip = (AudioClip)Resources.Load(assetPath.Value,typeof(AudioClip));
if (audioClip==null)
{
return false;
}else{
FsmObject _target= this.Fsm.Variables.GetFsmObject(storeAsset.variableName);
_target.Value = audioClip;
return true;
}
}
#else
AudioClip audioClip = (AudioClip)Resources.Load(assetPath.Value,typeof(AudioClip));
if (audioClip==null)
{
return false;
}else{
FsmObject _target= this.Fsm.Variables.GetFsmObject(storeAsset.variableName);
_target.Value = audioClip;
return true;
}
#endif

As for your sample scene, loading the scene into my project and opening it all parameters of the FSM state are gone (maybe an version issue or bc of the modified Action?) - meaning I have to reassign all of them to the Resource Load Action. Once done I get the same result - the Action ends with "OK" but the Variable Object.Sprite is empty :-/
Title: Re: Resources Load
Post by: jeanfabre on July 08, 2015, 08:04:33 AM
Hi,

 I haven't touched the public interface, so you should not loose variables assignment, I am confused as to what happens in your case.

are you running on Unity 3.5 and with what version of PlayMaker?

I'll need a clear repro case, cause my tests here shows normal behavior.

Bye,

 Jean
Title: Re: Resources Load
Post by: phannDOTde on July 13, 2015, 06:49:13 AM
Hi,

 I haven't touched the public interface, so you should not loose variables assignment, I am confused as to what happens in your case.

are you running on Unity 3.5 and with what version of PlayMaker?

I'll need a clear repro case, cause my tests here shows normal behavior.

Bye,

 Jean

Hi Jean
I work with Unity 5.1.1f1 and PM 1.7.8.3 plus I downloaded the "Load Ressources" Action from the Ecosystem. Friend of mine verified the issue and mentioned it might be related to unity auto updating the Actions Script (?)

Best
Peter
Title: Re: Resources Load
Post by: jeanfabre on July 15, 2015, 02:00:45 AM
Hi,

I know... It's because I developed the last feature using an api from the latest beta that is not available in previous version... d'oh!!

so I corrected it, but I also found out what's likely the cause for this action to not work anyway.

 I Can only get the type of the object you want to load from resource if the FsmVariable you will save it into has a reference to one of these object, else the system return the generic type and so I can't assume it's a sprite or an audio or else.

so to fix this, simply assign to your fsmVariable of type Sprite, an actual sprite, then it will work. I'll see with Alex if there is a way to get this without this hack, maybe PlayMaker exposes it but I haven't found it.

So redownload from the ecosystem this action, and apply the fix I describe and let me know how it goes.

 Bye,

 Jean
Title: Re: Resources Load
Post by: phannDOTde on July 28, 2015, 06:45:17 AM
Hi,
I know... It's because I developed the last feature using an api from the latest beta that is not available in previous version... d'oh!!
........
So redownload from the ecosystem this action, and apply the fix I describe and let me know how it goes.

Hey Jean,

SO SORRY for the [very] late reply, something came up and then I forgot about this :-/ I tested it today and it works great, as soon I'll assign a tmp object to the var as you explained - awesome!

Thank you a ton for fixing this :-)
Best
Peter
Title: Re: Resources Load
Post by: craigz on January 04, 2017, 10:58:19 PM
Hey Jenna,

Did this solve your problems here (http://hutonggames.com/playmakerforum/index.php?topic=8450.0)? Or did you need this action possibly extended or more functionality? Just want to make sure it doesn't get buried and be unsolved.

This action is great - thank you Jean!  It looks like it both loads and instantiates prefabs in the scene; would it be possible to adjust this action or create a new one that gives us the option to just load a prefab into a variable?  Then we can use Create Object to define where we want to prefab to load in the scene.

Thank you!
Best,
Jenna

Sorry for the necro on this one, but the functionality that Jenna was talking about is exactly what I was looking for :) any possibility of this?

:D

-craigz
Title: Re: Resources Load
Post by: dudebxl on January 05, 2017, 01:33:18 PM
Maybe ArrayListAddAllPrefab action from ecosystem?
Title: Re: Resources Load
Post by: craigz on January 05, 2017, 02:24:19 PM
Maybe ArrayListAddAllPrefab action from ecosystem?

Saw your post on that :D snagged it!

But I guess I'd be looking for something on a smaller scale that way I don't have to load all prefabs at once? :)

So rather than load/instantiate the prefab automatically as is the current action, something to just put the loaded resource into a variable that can then be instantiated at a later point?
Title: Re: Resources Load
Post by: dudebxl on January 06, 2017, 03:01:27 AM
Well all it does is load into an arraylist for later use.
Title: Re: Resources Load
Post by: craigz on January 06, 2017, 12:12:39 PM
But wouldn't I still need to create some sort of key/index identifier though so I know what game object to get from the array and then instantiate later on?
Title: Re: Resources Load
Post by: Farwest on October 02, 2018, 07:30:32 PM
Hi,
Is it possible to fix the below issue please? It seems this issue stayed unsolved since 2014. I urgently need this action to Load the object only into a variable, not create a new object too (Currently it creates 2 objects for each object to be loaded).

Thanks

This action is great - thank you Jean!  It looks like it both loads and instantiates prefabs in the scene; would it be possible to adjust this action or create a new one that gives us the option to just load a prefab into a variable?  Then we can use Create Object to define where we want to prefab to load in the scene.

Thank you!
Best,
Jenna
Title: Re: Resources Load
Post by: jeanfabre on October 03, 2018, 02:21:47 AM
Hi,

 If you follow the next posts, you'll see that this is the expected behaviour.

or else, can you describe what's not working as expected? Maybe I am missing something :)

 Bye,

 Jean
Title: Re: Resources Load
Post by: Farwest on October 03, 2018, 05:56:16 AM
Before I wrote above post, I already checked all messages here.

Second, I already described the issue I am having on the previous post. But I can repeat again, I want the "loaded resource" to be saved into variable only. I don't want "Resource Load" action to instantiate or create the object I look for again.

If this is an expected behaviour, please fix this and create an alternative action, so it doesn't create duplicate object for me (I am creating the gameobject by using the variable and at the desired location at the desired time. Resource Load creates instantly and at a random place. I don't want this).

Before Resource Load, I had tried to use "FindGameObjectsResourcesWithNameContaining" but it is not saving the object into variable like Find Game Object does (But Find Game Object does not look into assets/resources), then I skipped and started to use Resource Load. As this last one is not working, I won't have any more action that will solve my game mechanic.

I hope I can receive the Support I am looking for soon, my issue is very urgent. I sent you invoice number by PM too.

Title: Re: Resources Load
Post by: djaydino on October 03, 2018, 01:27:59 PM
Hi.
Resource load, loads in the object.
A solution you can use is to disable it right after loading the object.

and activate when needed and set the desired position.
Title: Re: Resources Load
Post by: Farwest on October 03, 2018, 01:54:17 PM
Sorry, I can't do that. If I would be at early stages, I would have the opportunity to alter it that way.

However I am at the Alpha stage of the game and making such changes require me to modify hundreds of gameobject components for each prefab, will require me to replace each of their ready Playmaker components.

What I need is, a simple edit/modification or fix to the current Resource Load action, which such unfulfilled request was already made in 2014, I need this in 2018. Thanks for the reply and suggestion.
Title: Re: Resources Load
Post by: djaydino on October 04, 2018, 01:46:44 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 :)
Title: Re: Resources Load
Post by: jeanfabre on October 04, 2018, 02:34:37 AM
Hi,

 ok, I see. It's important to realize, that ResourcesLoad action is not buggy on that regards, it's a additionnal feature that you are requesting. And yes, disabling straight away is the right way to handle this, and modifying the ResourcesLoad action is one way to achieve this.

 Bye,

 Jean
Title: Re: Resources Load
Post by: djaydino on October 04, 2018, 03:57:19 AM
Hi jean.
The change i did actually does not instantiate, but it does store in a variable and it seems to work also.
Title: Re: Resources Load
Post by: Farwest 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!
Title: Re: Resources Load
Post by: djaydino 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.
Title: Re: Resources Load
Post by: jeanfabre 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
Title: Re: Resources Load
Post by: djaydino 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
Title: Re: Resources Load
Post by: Farwest 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.
Title: Re: Resources Load
Post by: LogLady 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?
Title: Re: Resources Load
Post by: djaydino 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)
Title: Re: Resources Load
Post by: LogLady 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.
Title: Re: Resources Load
Post by: djaydino on August 09, 2019, 09:37:31 AM
Hi.
Just tested on my end and it seems to work fine here.

(https://i.imgur.com/yPH33y7.gif)

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 :

Title: Re: Resources Load
Post by: LogLady 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.
Title: Re: Resources Load
Post by: djaydino on August 10, 2019, 05:53:52 PM
Hi.
indeed.

Maybe something like "Split Text To Array" (Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181)) can help.
you can split as new lines

Title: Re: Resources Load
Post by: LogLady 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!