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
0
Question by surfistinhu · Jan 19, 2014 at 03:19 AM · forum

Unity 3D 4.3.2 , animation.Play("name"); not working

First, the Unity 3D Hello guys , I liked the program that creates games :) ! Come to that I have a problem , I saw a video of how to add weapons and etc , but I reached a point where I wanted to add an animation when the gun shot was fired , and edited the script etc , but the animation is not performed. Script I use :

https://dl.dropboxusercontent.com/u/99253328/Riffle.js

END OF CODE IS MORE LINE DO NOT PART OF THE SCRIPT

good, the animation of the firing of the bullet is not forfeit by Weapon tab Hierarchy has the Animation component , this is finally someone help me I am grateful , sorry for my bad english , I am Brazilian and I used the google translator to help me ! Images that might help you : http://imagizer.imageshack.us/v2/800x600q90/706/f5w3.jpg

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by gameboyforlike · Jan 19, 2014 at 05:22 AM

try to use animation.crossfade("Name of animation"); or animation.play("Name of animation");

or else

 OnMouseDown()
 {
 if(Input.GetMouseButtonDown(0)) {
        animation.Play("tiro", PlayMode.StopAll);           
        Instantiate(bala,transform.position,transform.rotation);
 }
 
 
 or
 
 function OnMouseUpAsButton(){
  animation.Play("tiro");//, PlayMode.StopAll);           
        Instantiate(bala,transform.position,transform.rotation);
 }
Comment
Add comment · Show 2 · 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 Rgalaxy · Jan 19, 2014 at 05:34 AM 0
Share

sorry if OOT, may i know what is Play$$anonymous$$ode.StopAll used for?

avatar image surfistinhu · Jan 19, 2014 at 06:45 PM 0
Share

Sorry, that did not work in my script, must be why the spaces of the new script you asked me to replace the lines of the animation, in answer.unity3d.com they decrease the spaces, I could write the same scripts on some site Hosts file for me to download? Thanks for responding, I am grateful if you help me, animation.crossfade not work here! :/

avatar image
0

Answer by Frostbite23 · Jan 19, 2014 at 05:55 AM

it could be that your animation is not marked as legacy, meaning that it was created in the animation editor but it could not be read by the animation component. or it may be the PlayMode.StopAll affecting it and also to point out you are setting the PlayMode of the animation to stop or stop all (don't know what StopAll is used for). and why are you using the PlayMode.StopAll for? you can just use animation.Play("tiro");

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 surfistinhu · Jan 19, 2014 at 06:57 PM 0
Share

Thanks for answering first, but how do I do that? I did the animation in the 3d-editor of unity and saved everything correctly but the unity talks that when I press "Play Game" and try to shoot the gun:

The animation state shot Could Not Be played because it could not be found!

shot which is the name of the animation! And I think the script may be correct but the animation is not found by the script, also tried the animation "walk" which already comes in unity to use Third Person Character

Thank you, I am grateful if you answer me: (

avatar image
0

Answer by blenderblender · Sep 22, 2014 at 12:42 PM

I think that the animation function does just work in the Update

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

22 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

Related Questions

Game name incorrect on android build 0 Answers

Why cant I download anything off the forum? 1 Answer

Running a 2D game in a 3D environment - can it be done? 2 Answers

Extra black space when embedding webplayer game 0 Answers

Access Denied 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