Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: cc099183 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?
-
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?
-
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.
public string spriteSheetName;
public int arrayNumber;
void LateUpdate () {
var subSprites = Resources.LoadAll<Sprite>(spriteSheetName);
GetComponent<SpriteRenderer>().sprite = (Sprite)subSprites[arrayNumber];
}
-
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
-
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!
-
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
-
Hi Jean!
I make a package for you.
If it doesn't work, I will reupload.
-
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
-
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!
-
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