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 JM9721 · Jun 01, 2016 at 08:39 AM · c#speedgl

Unusual Unit Slowdown

My hobby project for a while is a little rts just to learn some programming, yesterday I added gl.lines to draw movement arrows from the unit to its end position, and I figured it out and got it working.

However, I went to test it and it works fine, but it seems when I send several units & they get in close proximity(seems like that is when the error happens at least), they lose like 90% of their speed and it seems like the game is lagging to death, running at ~400-900fps. At first their were two errors the speed loss and the gl.lines would noticeably turn off and on cycling through units, but I fixed that by adding some generic lists to the script on the camera to hold the unit#, source&dest x,y,z; so the OnPostRender() would never not have the unit's info to not render the line it just updates it when the unit's move method sends it (7 list later). The strange thing is that if I comment out of line on the unitScript to call the gl script the units move around perfectly(no error). I have tried messing with the gl script to the point of commenting out everything but an empty void OnPostRender() and two other methods(also commented out inside) with no global variables saved and when I ran the game with the unitScript line not commented out I get the same unit speed loss I get when I am drawing lines. I am clueless at this point what the problem might be.

Notes: None of the units have colliders, cast/receive shadows, the unit's move method is a coroutine that properly ends at destination & ends & re-creates if unit is sent elsewhere, the units speed is calculated by a speed * deltaTime(so if the game is lagging the unit should just jump further each step), and when this error occurs it doesn't recover and it effects every unit in the game until I restart it.

Comment
Add comment · Show 2
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 JM9721 · Jun 13, 2016 at 05:34 AM 0
Share

While I haven't found a permanent solution I have somewhat worked around the issue, because by using the list on the script that holds the information until it is updated again I was able to add a simple float timer that limits the update script to once every 0.1 seconds which reduces the lag-like effect a bit.

avatar image JM9721 · Aug 14, 2016 at 10:02 AM 0
Share

Note: I have been testing with only like 3-5 units. When I put 14 units on screen for another piece of code testing, this exact issue reappears.

0 Replies

· Add your reply
  • Sort: 

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

165 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

Related Questions

Speed of the script 1 Answer

fastest way to draw millions of lines? 1 Answer

How to change Animator speed with the state name 0 Answers

currentSpeed doesnt change when pressing Shift (C#) 1 Answer

Move enemy to a specific movepoint with an array (C#) 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