Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: stain2319 on May 03, 2020, 02:12:45 PM
-
I am using Unity 2019.3 and ArrayMaker - everything is the latest version - and trying to get a sprite from a hash table but I don't see how it is done...
I have set up a Hash Table Proxy in a gameobject called arrayManager in my scene.
I have the type set to "Sprite" with 1 sprite in there -
(https://i.imgur.com/w9uFkJg.png)
However when I try the "Hash Table Get" option, there is no "Sprite" available.
(https://i.imgur.com/GrJdF4K.png)
"Texture" does not appear to work as I get an error:
The fsmVar value <UnityEngine.Texture2D> doesn't match the value <UnityEngine.Sprite> on stateAdd To Inventory on fsm:FSM on GameObject:Player
How can I get a Sprite out of a hash table?
-
So I found that it does work with Object->UnityEngine->Sprite. Is this expected?
-
Hi.
Yes, Object->UnityEngine->Sprite is correct
-
Hi,
for this, I recommend using Resources, your array will reference sprites as their names using strings, and you then use Resources to load that name.
but I agree this would be a great addition that we could have a new FsmSprite variable.
also, if you want to simply have a texture in the UI, you can use RawImage component, and you can then display a regular texture, that works too, I am using this very often.
Bye,
Jean
-
Thank you guys for the answer and the poster for posting I just stumbled across the same issue glad to see there’s a quick solution :)
-
Ummm... what's the difference between a Hash Table and an Array?
Like, under what circumstances would you use a Hash Table, and not an Array?
I don't know what a Hash Table is.
-
Hi.
A hash table uses keys to reference (string)
an Array uses index numbers.
Both array list and hash table can be populated with different value types.
in this video i'm using xml with hash tables :
-
Hiya,
Okay, thanks. I'll watch the video and learn something new.
J.