playMaker

Author Topic: Resourses Load Sprite  (Read 2791 times)

cc099183

  • Playmaker Newbie
  • *
  • Posts: 17
Resourses Load Sprite
« on: May 24, 2016, 01:12:13 AM »
Hello!

I have some problem about Resourses Load this action.

When I use this action to get sprite,what I only get is the first of sprite.

How can I get another sprite in the same sprite?

Zeldag

  • Full Member
  • ***
  • Posts: 198
Re: Resourses Load Sprite
« Reply #1 on: May 24, 2016, 12:25:41 PM »
Hi and welcome to the forum!

Firstly I don't really understand what you are trying to do, so a better explanation could be useful.

But I think you could first slice up your sprites in the import settings and load them one after another.

You could also first animate your sprites and then just play the animation?


cc099183

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Resourses Load Sprite
« Reply #2 on: May 24, 2016, 09:30:32 PM »
Thanks!

I want to 2D reskin animation, so I need to use Resourses Load to get sprite.

I find some easy way to get the sprite, but it need to use script.

It seems difficult for Playmaker to do this action.

Quote
    public string spriteSheetName;
    public int arrayNumber;

   void LateUpdate () {

        var subSprites = Resources.LoadAll<Sprite>(spriteSheetName);
        GetComponent<SpriteRenderer>().sprite = (Sprite)subSprites[arrayNumber];

}

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Resourses Load Sprite
« Reply #3 on: May 25, 2016, 01:58:35 AM »
Hi,

 a <SpriteSheet> is not a <Sprite>. I think this is your problem here.

If you have no use for the SpriteSheet I would simply import all your images as regular sprites. I had no real success with SpriteSheet everytime I tried unfortunatly.

If SpriteSheet is unavoidable in your project, can you let me know and explain why. I am all up for trying to support this, but I need a proper case.

Bye,

 Jean

cc099183

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Resourses Load Sprite
« Reply #4 on: May 25, 2016, 11:44:37 AM »
Hi Jean!


I want to make a action use for 2D sprites reskin.

Because the sprites of characters is too many, I can't do such many AnimationClip.


Thanks for your help!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Resourses Load Sprite
« Reply #5 on: May 25, 2016, 03:41:01 PM »
Hi,

 Can you send me a package with the spriteSheet so that I have a case for this? I'll then try to extract one of them

Bye,

 Jean

cc099183

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Resourses Load Sprite
« Reply #6 on: May 25, 2016, 10:40:02 PM »
Hi Jean!


I make a package for you.

If it doesn't work, I will reupload.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Resourses Load Sprite
« Reply #7 on: May 26, 2016, 04:14:51 AM »
Hi,

 ok, the big problem here is that Sprite is not supported as a built in Fsm variable.

 So, the possibilities are the following:

Using ArrayMaker, I can load a spriteSheet in an ArrayList and you'll have Sprites.

Using PlayMaker, I can give you access to the Texture of the Sprite, but not the Sprite directly. Future versions will likely introduce FsmSprite, but for the time being it's not possible otherwise.

What do you want to do once you get a Sprite from the SpriteSheet?

 Bye,

 Jean

cc099183

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Resourses Load Sprite
« Reply #8 on: May 26, 2016, 07:52:24 AM »
Hi Jean!


I want to make a action use for 2D sprites reskin.

Because the sprites of characters is too many, I can't do such many AnimationClip.

So it need to use script to get Sprites from the SpriteSheet and set them as Animation.



Thanks for your help!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Resourses Load Sprite
« Reply #9 on: August 10, 2016, 03:26:10 AM »
Hi,

Ok. I am not sure how to do this without this huge memory penalty that is a no go basically.

Hopefully, as soon as we have an FsmSprite variable inside PlayMaker, this will be easier to provide without any scripting.


 Bye,

 Jean