playMaker

Author Topic: Can't get Sprite from Hash Table?  (Read 1688 times)

stain2319

  • Playmaker Newbie
  • *
  • Posts: 9
Can't get Sprite from Hash Table?
« 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 -



However when I try the "Hash Table Get" option, there is no "Sprite" available.



"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?



stain2319

  • Playmaker Newbie
  • *
  • Posts: 9
Re: Can't get Sprite from Hash Table?
« Reply #1 on: May 03, 2020, 02:29:46 PM »
So I found that it does work with Object->UnityEngine->Sprite.  Is this expected?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Can't get Sprite from Hash Table?
« Reply #2 on: May 03, 2020, 03:13:27 PM »
Hi.
Yes, Object->UnityEngine->Sprite is correct

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Can't get Sprite from Hash Table?
« Reply #3 on: May 05, 2020, 03:38:25 AM »
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

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
Re: Can't get Sprite from Hash Table?
« Reply #4 on: February 23, 2021, 07:23:38 PM »
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 :)
Have I said how much I love playmaker!!! This is one amazing tool

curb47

  • Sr. Member
  • ****
  • Posts: 256
Re: Can't get Sprite from Hash Table?
« Reply #5 on: February 24, 2021, 01:16:19 AM »
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.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Can't get Sprite from Hash Table?
« Reply #6 on: February 24, 2021, 04:20:58 AM »
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 :


curb47

  • Sr. Member
  • ****
  • Posts: 256
Re: Can't get Sprite from Hash Table?
« Reply #7 on: February 24, 2021, 04:33:30 AM »
Hiya,

Okay, thanks. I'll watch the video and learn something new.

J.