Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
4
Question by CanCo · Nov 23, 2013 at 05:18 AM · spritenew4.3

Sprite Animation

Now, with the new sprite system I would like to know how to cycle through all the sprites in a texture.

So, I have a character with a walking animation and they're staying on the exact same frame, how can I change the current texture?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
14
Best Answer

Answer by Shinugami · Nov 26, 2013 at 04:30 AM

You need your sprites put into one image file. So, for me, I used photoshop to make many sprites. Then I pasted the sprites all into a 1024x1024 sheet. I then imported the file by selecting 'multiple' instead of single for sprite mode.

Once you have your sprite atlas in Unity. In the import panel, set the sprite mode to multiple and select sprite editor. Drag boxes around your sprites. The trick is to remember that despite the shape of the sprite it will fit into a box shape in the atlas so be careful to not overlap your sprites. In photoshop I line up the sprite so it is adjacent to another sprites pixels and then I hold Shift and move the sprite on a straight axis until it fits into the position I want.

In the sprite editor of the import panel, once you have setup the different boxes around each of your sprites on your 'sprite atlas' click apply in the top right of the sprite editor and close it or move it out of the way. You will not lose any data by closing it.

Next you will see in the project panel that your sprite now has an arrow you can expand to reveal all the boxes that you made in the sprite editor. These boxes will contain your sprites.

Ok, now to answer your question. Open the animation panel. Select your object in the Hierarchy that you want to animate. Perhaps the animation panel is empty? No problem. Where it says 'sample' to the left of that you will see a horizontal rectangle that can either contain the name of an animation clip OR it can be blank. Click on that and select "create new clip"

Once you have selected the clip you will animate in, click the record button (red circle). Once it is in record mode and the 'play game' buttons are now red you will be able to see the time slider. Move the time slider to the time you want and select any object in the hierarchy that you want to animate or change the sprite.

Once you have selected the object, go to your project panel and select the sprite atlas that you created. Drag one of the sub-components (one of the boxes in the list of boxes that you created in the sprite editor) into the timeline on the animation panel.

The object you selected in the Hierarchy to edit animation for will now change it's sprite to the sprite you dragged in at that point in the timeline.

If you need more help, let me know. I'm pretty advanced with this however I have a problem where the 2D sprite's movement is only animating on world axis instead of local axis.

PS: If you want a clean transition from one sprite to the next, you will need to select the keyframes in the animation panel and right click on them and select 'both tangents' and select 'constant'. This will also set the curve type to 'broken' which is good if you do not want crazy transitions for your sprite sheet. Sometimes these transitions are good but sometimes they are not the desired result. I use a mix of both. For example, I have a character with legs and arms that are hand-drawn animation and I like broken curves with constant transitions but for some accessories on the character I use smooth animation by using smooth curve transitions to rotate them. But if I use smooth transition for the hand drawn animation the result looks very retarded.

PS: Hot Tip! Animation to the X,Y,Z transform.position will be in world axis regardless of having a parent object. I don't know of anyway to overcome this other than to code an animation however you can get some effects by using 2DTK and using attach points to control the position of objects on certain frames.

UPDATE: Since 4.3 the animation has been fixed. My turrets etc will recoil back on the local axis and the alien's head animates side to side instead of north to south.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image justinpatterson · Feb 12, 2014 at 07:44 PM 1
Share

Thanks for the tips! This worked for me. I only had one issue using it - it seems to not let me drag in sprite frames faster than 1 per second. Is there a way to break down the drag/drop slots to lower than 1 second intervals?

EDIT: Found it - sampling size.

avatar image
0

Answer by zgamesoft · Jul 15, 2014 at 01:31 PM

Check this video https://www.youtube.com/watch?v=baFr-6Tafuc

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Is it possible to animate a sprite on a 3d mesh? 0 Answers

Sprites Become Invisible (SOLVED) 4 Answers

How to put multiple sprites in one click inside of a game object? 0 Answers

When is new GUI coming ? 2 Answers

Sprite's alpha visible with lighting 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges