Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: mhovland on May 15, 2013, 04:04:45 PM

Title: Get texture name
Post by: mhovland on May 15, 2013, 04:04:45 PM
Is there a way I'm not seeing for getting the name of the texture from a material, as a string?

Thanks for any pointers in the right direction.
Title: Re: Get texture name
Post by: mhovland on May 15, 2013, 05:21:57 PM
For more clarity, I have the texture name as a string, and I need to convert it to a Texture, so I can set the texture component of an object.

Ex. I have "texture_00" stored in a string variable, I strip off the _00 and replace it with _05. Now I have "texture_05" stored in a string variable. How can I convert the string variable into a Texture variable, so I can use Set Property to change the texture? If there is a more direct way someone knows about, I am all ears.

Thanks again.
Title: Re: Get texture name
Post by: jeanfabre on May 17, 2013, 02:30:56 AM
Hi,

 ok, basically you can, ONLY if your textures are in a "Resources" folder and then you can load them at runtime by simply defining the path to it.

http://hutonggames.com/playmakerforum/index.php?topic=3916.msg18214;topicseen#msg18214

else, your texture need to be stored in a FsmVar. You can also use arrayMaker to store more texture conveniently, but that's less flexible then Resources.Load.

bye,

 Jean
Title: Re: Get texture name
Post by: mhovland on May 17, 2013, 11:45:17 AM
Thanks for the custom action Jean.

For even more clarity, I am using ArrayMaker to store all my textures, but I have two separate arrays, each with their own reference name.

Here is what I need to happen, when in certain states, I need to use the textures stored in the "main" ArrayList, and when in other states, I need to use the textures stored in the "alternate" ArrayList.

Is it possible to have two ArrayLists on the same GO, with the same reference name, and just enable or disable the appropriate list in the appropriate states? That would surely be easy to do, but it really is good for organizational purposes.

Thanks for your help.

m
Title: Re: Get texture name
Post by: jeanfabre on February 26, 2014, 01:14:24 PM
Hi,

 I would not recommand that, but this would work I guess. It's better to properly account for two different references in your logic.

bye,

 Jean
Title: Re: Get texture name
Post by: Lane on February 26, 2014, 01:58:33 PM
This isn't directly applicable here it seems, but for reference:

GetFsmTextureName (http://hutonggames.com/playmakerforum/index.php?topic=6339.msg30885#msg30885)