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 mabit · Jun 01, 2012 at 05:28 PM · fpsslowmain thread

FPS issues

Any help here would be great.

My game is dropping down to 2 FPS with very little happening. My PC is i7, 8GB Ram and 1GB GFX Card. And my Android Device is a Dual Core 1GB processor.

However when I run the game on both machines the games FPS falls to the point the game breaks.

This a link to the stats.

This is the script that each object is running which does not seem like it would cause problems. One the game gets to approx 20 objects its slowing down, by mid 30's unplayable.

 #pragma strict
 
 var poisonSmoke:GameObject;
 var maleMouse:GameObject;
 var femaleMouse:GameObject;
 
 var newDirection:int;
 var canCollide:boolean = true;
 var moveSpeed:int=5;
 var isShagging:boolean = false;
 var gender:int;
 var poisoned:boolean = false;
 
 
 
 function Start () {
     gameObject.name = "Baby Mouse";
     GameVariables.numberOfMiceAlive++;
     GrowUp();
 }
 
 function Update () {
     
     transform.Translate(Vector3.forward * Time.deltaTime * moveSpeed);
     
     
     var hit : RaycastHit;
     var forwardRay = transform.TransformDirection(Vector3.forward);
     Debug.DrawRay(transform.position, forwardRay * 6, Color.magenta);
     
     if(Physics.Raycast(transform.position, forwardRay, hit, 6)){
         Debug.Log("Hit");
         if(hit.collider.gameObject.tag == "Hedge" || hit.collider.gameObject.tag == "Brick Wall"){
             newDirection = Random.Range(0,4);
             Debug.Log (transform.eulerAngles.y);
             
             switch (newDirection){
                 
                 
                 case 0:
                 transform.eulerAngles = Vector3(0, 90, 0);
                 break;
                 case 1:
                 transform.eulerAngles = Vector3(0, 180, 0);
                 break;
                 case 2:
                 transform.eulerAngles = Vector3(0, 270, 0);
                 break;
                 case 3:
                 transform.eulerAngles = Vector3(0, 0, 0);
                 break;
             }
         }
     }
     if(Physics.Raycast(transform.position, forwardRay, hit, 6)){
         Debug.Log("Hit");
         if(hit.collider.gameObject.tag == "Hedge" || hit.collider.gameObject.tag == "Brick Wall"){
             newDirection = Random.Range(0,4);
             Debug.Log (transform.eulerAngles.y);
             
             switch (newDirection){
                 
                 
                 case 0:
                 transform.eulerAngles = Vector3(0, 90, 0);
                 break;
                 case 1:
                 transform.eulerAngles = Vector3(0, 180, 0);
                 break;
                 case 2:
                 transform.eulerAngles = Vector3(0, 270, 0);
                 break;
                 case 3:
                 transform.eulerAngles = Vector3(0, 0, 0);
                 break;
             }
         }
     }
     if(Physics.Raycast(transform.position, forwardRay, hit, 0.1)){
         if(hit.collider.gameObject.tag == "Rotate Spot"){
             newDirection = Random.Range(0,4);
             Debug.Log("new dir = " +newDirection);
             Debug.Log (transform.eulerAngles.y);
             
             switch (newDirection){
                 
                 
                 case 0:
                 transform.eulerAngles = Vector3(0, 90, 0);
                 break;
                 case 1:
                 transform.eulerAngles = Vector3(0, 180, 0);
                 break;
                 case 2:
                 transform.eulerAngles = Vector3(0, 270, 0);
                 break;
                 case 3:
                 transform.eulerAngles = Vector3(0, 0, 0);
                 break;
             }
         }
         if (hit.collider.gameObject.tag == "Poison"){
             Destroy(gameObject);
             GameVariables.numberOfMiceAlive--;
             
         }
         if (hit.collider.gameObject.tag == "Toxic Gas"){
             Destroy(gameObject);
             GameVariables.numberOfMiceAlive--;
         }
         if (hit.collider.gameObject.tag == "Bomb Explosion"){
             Destroy(gameObject);
             GameVariables.numberOfMiceAlive--;
         }
     }
 }
 
 
 
 function GrowUp(){
     if (!poisoned){
         yield WaitForSeconds(10);
         gender = Random.Range(0,2);
         if(gender == 0){
             Instantiate (maleMouse, Vector3(transform.position.x,transform.position.y, transform.position.z) , Quaternion.identity);
             Destroy(gameObject);
         }
         if (gender == 1){
             Instantiate (femaleMouse, Vector3(transform.position.x,transform.position.y, transform.position.z) , Quaternion.identity);
             Destroy(gameObject);
         }
         GameVariables.numberOfMiceAlive--;
     }
 }




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

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

Answer by Eric5h5 · Jun 01, 2012 at 05:53 PM

Take the Debug.Logs out.

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 mabit · Jun 01, 2012 at 07:05 PM 0
Share

Thanks, I didn't realise they slowed things down so much. Can now get over 100 objects on screen before it slows down....Thanks for the quick answer :)

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

I have a lot of lights but they drops framerate 1 Answer

moving thousands of objects is very slow, Draw calls 2 Answers

i have a fps sniper game and it runs slow on the tablet 1 Answer

Using targetFrameRate forces Main Thread HIGHER? 0 Answers

audio slows down my game (dramatically) 0 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