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 /
avatar image
0
Question by brewster2110 · Apr 13, 2018 at 10:45 PM · animationanimatortriggerscript.

Animation Starts on begin play

Hi, I have this really annoying problem and I am far too much of a beginner to unity to know how to fix it. I have an animation clip that I only want to play if a certain 'If' statement is fulfilled. But at the moment it just plays on repeat whenever I begin play.

 public class BloodScreenScript : MonoBehaviour
 {
     public GameObject DeathArea;
     Animator blanim;

     public void OnTriggerStay(Collider collider)
     {
         if (DeathArea.GetComponent<EnterDarknessScript>().counterdeath >= 7)
         {
             blanim = GetComponent<Animator>();

             blanim.SetTrigger("ShowText");
         }
     }

 }

I have set up an animator composition for this as well. It goes from Entry to New State to My Animation. I have made a Parameter which is 'ShowText' (also featured in the script) and the conditions for the connection between the New State and My Animation is set to that Condition.

I just have no idea what is wrong so any help would be muchly appreciated.

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
0
Best Answer

Answer by brewster2110 · Apr 14, 2018 at 01:28 AM

I fixed it. I ended up having to set up a whole new Animation Trigger and just messing with the get component setting in my scripts. Thanks for the help!

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
avatar image
1

Answer by ThePixelatedSword · Apr 13, 2018 at 10:58 PM

The reason this is happening is because the animation controller needs a default animation to go to. If that is the only animation you have in the controller, it will play. The best way the solve this is to create another animation in which nothing happens. Then set it as the default animation by right clicking on it and selecting "Set as layer default state". It will then become orange. You then must make a transition between them by right clicking the new animation and selecting "Make Transition" and then clicking on the old one. Click on the transition and make sure "Has Exit Time" is false.

Comment
Add comment · Show 3 · 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 brewster2110 · Apr 14, 2018 at 12:02 AM 0
Share

I tried to do this as you said, but was a little unclear on what you meant by creating a new animation. I added a new state and gave it an animation where nothing happened. Didn't work though. Not sure if i''m doing it right. I attached an image Thanks alt text

untitled.png (24.5 kB)
avatar image ThePixelatedSword · Apr 14, 2018 at 12:17 AM 0
Share

I'm sorry for being unclear. Did you make sure "Has Exit Time". That's the only thing I can think of that would stop the animation from playing unless you did set up your parameters in the controller.

avatar image brewster2110 ThePixelatedSword · Apr 14, 2018 at 12:35 AM 0
Share

The transition which is highlighted in blue is the one that I unchecked "Has Time Exit". Whenever I start the game it still shows up straight away still and doesn't wait for it to be called upon. Thanks though

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

225 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

Related Questions

Why when creating new animator controller for the character the character is not walking right ? 0 Answers

Strange animation behaviour trying to implement hover functionality 1 Answer

2D animation diferent right and left 0 Answers

Animator Trigger Not Working 1 Answer

Has Exit Time causes between trigger and transition. How can I stop this? 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