Hello Guest

Author Topic: Multiple sprites in a single frame??  (Read 6828 times)

bon

  • Newbie
  • *
  • Posts: 3
    • View Profile
Multiple sprites in a single frame??
« on: June 10, 2013, 08:17:43 am »
Can I add multiple sprite in one frame?

I have a large building texture, and I only want to make animations at its small parts in order to save the memory for texture.
Can I do this in 2d ToolKit?

Thanks a lot!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Multiple sprites in a single frame??
« Reply #1 on: June 10, 2013, 11:18:16 am »
2D Toolkit 2.1 hashes individual tile chunks when dicing - it will remove duplicates when it finds them. Animating these isn't as efficient as animating normal sprites, but you could save quite a lot.

One caveat - this isn't a solution to make video, for instance ;) You couldn't throw 1000s of frames with tiny bits moving in there - it will run out of memory building the atlas. It will also take forever.

bon

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Multiple sprites in a single frame??
« Reply #2 on: June 13, 2013, 10:39:14 am »
Maybe you misunderstood my question? Let me clarify it a bit more.

I want to make an animation with more than one texture in one frame, like the picture below (ignore the skeletal animation).



In this way I can make 1000 animation for a character without using more than one set of texture.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Multiple sprites in a single frame??
« Reply #3 on: June 13, 2013, 10:41:01 am »
So if you're not doing the skeletal animation, what exactly do you want to do with all the articulated parts? How do you want to animate them?

bon

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Multiple sprites in a single frame??
« Reply #4 on: June 13, 2013, 02:29:00 pm »
If every frame of the animation can have multiple sprite, I can edit them frame by frame.
I wanna know whether 2d toolkit support this.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Multiple sprites in a single frame??
« Reply #5 on: June 13, 2013, 02:35:28 pm »
No it doesn't - but you could code it yourself. One frame of animation can only have one sprite.

Edit - you could also sync multiple animations together if you wanted to, that will be easy enough to code in there.

EvilDeathCrab

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Multiple sprites in a single frame??
« Reply #6 on: June 20, 2013, 06:19:37 am »
In a similar vein:
Is there a way to stack multiple sprites into a single prefab/gameobject? If I wanted to make a character that's made of a number of "parts" but each part is a single sprite, is there a good way to create a natural grouping of sprites? For example, in the OP's picture above let's break it into 4 pieces: head, arms, body, legs. I'm wondering if there's a way for me to take those sprites and link them into a single unit that I can use elsewhere instead of having to copy/instantiate those 4 pieces every time. I think using that method you could create code that would swap out the sprites to create your "animation."

I tried adding multiple Sprite components to a single object, but that didn't have my intended effect. Is this possible to do?

Sorry if this isn't inline with your topic, OP. I think they're similar enough problems that I didn't want to split it off into a redundant thread.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Multiple sprites in a single frame??
« Reply #7 on: June 20, 2013, 11:03:08 am »
Why not just create a prefab of the root object, you won't need to instantiate 4 pieces every time?
You can't have multiple sprite components on a single object - it relies on a meshfilter, and there can be only one of those on a component.