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 /
  • Help Room /
avatar image
0
Question by Gatling-Hawk-youtube · Feb 18, 2016 at 10:05 PM · animationsshrinking

shrinking charactor script help please...

so im toying around with animations, and i want my First person capsule to shrink, i created an animation for that... i want to play the animation when i press "q". and when i press "e" i want to go back to normal size...i only know basic java script can someone help me please??? i dont know how to assign buttons to a function...

Comment
Add comment · Show 1
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 Gatling-Hawk-youtube · Feb 18, 2016 at 10:07 PM 0
Share

i know it has to do with bools, trigger, or whatever, i think... please help

1 Reply

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

Answer by Zoogyburger · Feb 18, 2016 at 10:17 PM

Have a look at this: http://docs.unity3d.com/Documentation/ScriptReference/Animation.Play.html http://docs.unity3d.com/Documentation/ScriptReference/Animation.html

Here's an example:

  function Update()
 {
  if(Input.GetKeyDown("q"))
  {
   // Plays the animation
   animation.Play("Animation Name ");
  }
 }

Comment
Add comment · Show 8 · 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 Gatling-Hawk-youtube · Feb 18, 2016 at 10:25 PM 0
Share

wow, i didnt think it was that simple.. Thank you so much.

avatar image Zoogyburger · Feb 18, 2016 at 10:34 PM 0
Share

Hey, @Gatling Hawk youtube, I'm glad I could help! Please accept my answer by clicking the check-mark icon!

avatar image Gatling-Hawk-youtube Zoogyburger · Feb 19, 2016 at 03:52 PM 0
Share

also, quick question, where do i apply the script?

avatar image Gatling-Hawk-youtube · Feb 19, 2016 at 03:27 PM 0
Share

also, quick question, where do i apply the script?

avatar image Zoogyburger · Feb 19, 2016 at 05:01 PM 0
Share

Sorry for the prolonged reply. You put the lines of code into the Player script or on any other object that you want to animate when you press the button!

avatar image Gatling-Hawk-youtube Zoogyburger · Feb 19, 2016 at 08:29 PM 0
Share

ok ill try that. its ok about the prolonged thing. everyones got something to do

avatar image Gatling-Hawk-youtube Zoogyburger · Feb 25, 2016 at 04:02 PM 0
Share

is there a way to play an audio clip i have when i shrink?

avatar image Zoogyburger · Feb 25, 2016 at 08:01 PM 1
Share

http://docs.unity3d.com/ScriptReference/AudioSource.Play.html

Something like this:

  var soundFile : AudioClip;
   
  function Update() {
      if (Input.Get$$anonymous$$eyDown("q")) { 
          audio.clip = soundFile;
          audio.Play();
      }
  }

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

43 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

Related Questions

Player(Cube) shrinks on KeyCode.F and back to original scale 2 Answers

Question about reduce file size when creating sprite(2D) animations 1 Answer

duplicate enemies animations wont work? 0 Answers

Animation window not showing current gameobject animations 0 Answers

Best practice to handle mirrored body hit animations? 1 Answer


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