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 pjcarey97 · Aug 30, 2012 at 06:14 PM · animationlagframerateslowprototype

Why does simple animation make my game lag?

In my prototype, I'm trying to script an elevator, (of maybe twenty vertices at most), to go up via animation. While the animation is playing though, the frame rate drops like an anvil in Dragonball Z training gravity. The scene is highly simple, (it's all cubes).

 if(elevator)
 {
 // Makes player imobile and follow elevator.
 playerMove = GameObject.FindWithTag ("player").GetComponent<cube_move>();
 playerMove.enabled = false;
 playerMove.gameObject.transform.parent = platform.transform;
 //plays animation
 models.animation.Play(step1);
 yield return new WaitForSeconds(3.2f);
 if(step2 != "none")
 {
     models.animation.Play(step2);
     yield return new WaitForSeconds(2.5f);
 }
 //Lets player move again.
 playerMove.gameObject.transform.parent = null;
 playerMove.enabled = true;
Comment
Add comment · Show 15
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 Screenhog · Aug 30, 2012 at 06:21 PM 0
Share

That's not the whole code, is it? Are you doing this within an Update function?

Is the frame rate actually changing? What are the numbers you're getting?

Does the frame rate lag happen every time the elevator animates, or only when your character is in it?

avatar image pjcarey97 · Aug 30, 2012 at 07:12 PM 0
Share

It's in a function that's called every time the player enters it.

I think it's changing because everything just gets skippy, I don't know hot to check the framerate.

It's only during the actual animation.

avatar image Screenhog · Aug 30, 2012 at 07:16 PM 0
Share

In Game View, there will be a bar at the top of the screen, and on the right hand side, it says "Stats". Click that for the frame rate and other valuable info.

It might be valuable to watch what's happening from both the Scene View and the Game View. If the elevator moves up smoothly when viewed from the Scene View, then it's more likely a camera issue.

avatar image pjcarey97 · Aug 30, 2012 at 07:26 PM 0
Share

It goes from about 140 to 23, (thanks for the tip by the way). So yeah, it's in both scene and game view.

avatar image Screenhog · Aug 30, 2012 at 08:34 PM 0
Share

Wow, that is quite a dip. Is the function called every frame that it's in the elevator, or just once at the beginning of the elevator animation?

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by pjcarey97 · Aug 31, 2012 at 11:02 PM

The animations were from a Blender file and stored in the root. So the root had like thirty child objects, and the more child objects it had, the lower the frame rate. When I unparent most of them, the animation worked just fine. So do I need to store the animations in nodes and keep them as separate objects or do I have some kind of obscure setting that caused this?

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 pjcarey97 · Aug 31, 2012 at 11:19 PM 0
Share

Oh wait, is it because Unity is adding frames for things that aren't even moving.

avatar image
0

Answer by moinchdog · Apr 01, 2013 at 09:03 AM

Do you have a collider on any of the submeshes. For some reason Unity lags up when a collider is animated.

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

13 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

Related Questions

What's causing scene to slow down? 1 Answer

Animation of terrain causes drastic performance drop (fps) 0 Answers

Can I make animations snap to a frame? 1 Answer

Why does the asset store freeze unity and refuse to load? 1 Answer

Animation Inspector is suddenly Unbearably Laggy 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