playMaker

Author Topic: set u gui sprite error playmaker[solved]  (Read 165 times)

Carmichael

  • Full Member
  • ***
  • Posts: 229
    • View Profile
set u gui sprite error playmaker[solved]
« on: June 22, 2017, 07:40:49 PM »
hey guy,

i keep getting this error whenever i try to set sprites to a gameobject's image component,

i have an array of type "object" and i'm setting the sprite as object because there's no sprite variable so that works, but when i get to setting the sprite with the "set ugui sprite action " this error pops up.

InvalidCastException: Cannot cast from source type to destination type.

please help,
thanks!
« Last Edit: June 24, 2017, 04:48:30 PM by Carmichael »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12405
  • Official Playmaker Support
    • View Profile
Re: set u gui sprite error playmaker
« Reply #1 on: June 23, 2017, 12:34:36 AM »
Hi

there is a dedicated action for this, make sur your FsmObject variable is set to UnityEngine.Sprite and it will work fine



is this the action you use?


Bye,

 Jean

Carmichael

  • Full Member
  • ***
  • Posts: 229
    • View Profile
Re: set u gui sprite error playmaker
« Reply #2 on: June 23, 2017, 10:52:24 AM »
hi Jean, yes , that's the action i used, but i'm updating the variable through an array, like switching sprites, but from my observation, the sprites had to be within a sprite sheet in order to stop that error.

maybe it's something worth checking out. but that was how i solved the issue. (putting my sprites in one sprite sheet)