Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
This question was closed Sep 04, 2018 at 08:50 PM by Obsessi0n for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by Obsessi0n · Sep 02, 2018 at 07:56 PM · animationanimatoranimator controller

Changing Animationclip Sprites.

I've created a system where a player can equip diferent clothes and it will change the player appearence ingame.

There is a sprite in which the player is naked and on top there is a specific sprite for each clothing type with an animatorOverride. alt text

In this Image I only have the Leg and Torso socket created.

They have an AnimatorOverride that will recieve an animationClip array with all the animations for each specific item and change them in-game.

This is working fine, the problem is that I would need to create diferent aniamtionClip for each item with all the player animations .

Right now there is 16 animations, 4 unarmed idles 4 armed Idles 4 walking unarmed 4 armed idle so it would take a massive amount of time to create AnimationClips for each item like this, it would require 16 AnimationClips per item.

The sprites are all in a SpriteSheet like so: alt text

Is there a way to have just one animationClip for each type and change its sprites on the go?

Is there other simplier way to do this?

Here is a part of the code this one Changes the clips on the animatorOverride to the correctOnes

     public void Equip(AnimationClip[] animations)
     {
         spriteRenderer.color = Color.white;
 
         legsAnimatorOverrideController["PlayerLeftIdle"] = animations[0];
         legsAnimatorOverrideController["PlayerRightIdle"] = animations[1];
         legsAnimatorOverrideController["PlayerStanding"] = animations[2];
         legsAnimatorOverrideController["playerStandingDownArmed"] = animations[3];
         legsAnimatorOverrideController["playerStandingLeftArmedIdle"] = animations[4];
         legsAnimatorOverrideController["playerStandingRightArmedIdle"] = animations[5];
         legsAnimatorOverrideController["playerStandingUpArmed"] = animations[6];
         legsAnimatorOverrideController["playerStandingUpArmedIdle"] = animations[7];
         legsAnimatorOverrideController["PlayerUpIdle"] = animations[8];
         legsAnimatorOverrideController["PlayerWalkingDown"] = animations[9];
         legsAnimatorOverrideController["PlayerWalkingDownArmed"] = animations[10];
         legsAnimatorOverrideController["PlayerWalkingLeft"] = animations[11];
         legsAnimatorOverrideController["PlayerWalkingLeftArmed"] = animations[12];
         legsAnimatorOverrideController["PlayerWalkingRight"] = animations[13];
         legsAnimatorOverrideController["playerWalkingRightArmed"] = animations[14];
         legsAnimatorOverrideController["PlayerWalkingUp"] = animations[15];
     }


And this one is going to get the correct animationClips from the resources folder

         tempObj0 = Resources.Load<AnimationClip>("Animations/" + tempSlug + "0");
         tempObj1 = Resources.Load<AnimationClip>("Animations/" + tempSlug + "1");
         tempObj2 = Resources.Load<AnimationClip>("Animations/" + tempSlug + "2");
         tempObj3 = Resources.Load<AnimationClip>("Animations/" + tempSlug + "3");
         tempObj4 = Resources.Load<AnimationClip>("Animations/" + tempSlug + "4");
         tempObj5 = Resources.Load<AnimationClip>("Animations/" + tempSlug + "5");
         tempObj6 = Resources.Load<AnimationClip>("Animations/" + tempSlug + "6");
         tempObj7 = Resources.Load<AnimationClip>("Animations/" + tempSlug + "7");
         tempObj8 = Resources.Load<AnimationClip>("Animations/" + tempSlug + "8");
         tempObj9 = Resources.Load<AnimationClip>("Animations/" + tempSlug + "9");
         tempObj10 = Resources.Load<AnimationClip>("Animations/" + tempSlug + "10");
         tempObj11 = Resources.Load<AnimationClip>("Animations/" + tempSlug + "11");
         tempObj12 = Resources.Load<AnimationClip>("Animations/" + tempSlug + "12");
         tempObj13 = Resources.Load<AnimationClip>("Animations/" + tempSlug + "13");
         tempObj14 = Resources.Load<AnimationClip>("Animations/" + tempSlug + "14");
         tempObj15 = Resources.Load<AnimationClip>("Animations/" + tempSlug + "15");
 
         legsAnimationclips[0] = tempObj0;
         legsAnimationclips[1] = tempObj1;
         legsAnimationclips[2] = tempObj2;
         legsAnimationclips[3] = tempObj3;
         legsAnimationclips[4] = tempObj4;
         legsAnimationclips[5] = tempObj5;
         legsAnimationclips[6] = tempObj6;
         legsAnimationclips[7] = tempObj7;
         legsAnimationclips[8] = tempObj8;
         legsAnimationclips[9] = tempObj9;
         legsAnimationclips[10] = tempObj10;
         legsAnimationclips[11] = tempObj11;
         legsAnimationclips[12] = tempObj12;
         legsAnimationclips[13] = tempObj13;
         legsAnimationclips[14] = tempObj14;
         legsAnimationclips[15] = tempObj15;


1.png (7.1 kB)
pants-cheappickton-blue.png (770 B)
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

1 Reply

  • Sort: 
avatar image
0
Best Answer

Answer by Obsessi0n · Sep 04, 2018 at 08:49 PM

Here is how to do it

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

Follow this Question

Answers Answers and Comments

241 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 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 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 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 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 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 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 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 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 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 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 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 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

how to make multiple transition from one state? 1 Answer

Blending animations for a bow with differing charges 1 Answer

2DAnimator Freezes first time an animation is played 0 Answers

End of animation with animator. 0 Answers

How to trigger the same animator state in unity5 with script? 2 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