- Home /
Multiple coins rotation using script eats draw calls
Hi,
I am using following code to rotate my coins
void FixedUpdate(){
transform.Rotate(0, 200 * Time.deltaTime, 0, Space.World);
}
the thing is , it does rotate on one axis but it eats lot of draw calls .I checked it on profiler, it took around 100 draw calls..
What is the solution to it?
Rotating an object doesn't increase draw calls.
Yes that should be the case,
but when I deactivate script it do not freezes game, but when I activate the script in profiler it shows 100+ draw calls....In my script I only have above code mention...
Answer by dudester · Nov 29, 2014 at 02:28 PM
what you could. try is if your coins are models not simple cylinders try compress the mesh just click on the model there will be an option called mesh compression just set it to high.or add a rigid body to it.cause moving non rigid body's is quite expensive as far as I 've read.hope I've helped a bit.
Answer by keni4 · Nov 29, 2014 at 02:29 PM
Don't know how about draw calls, but at first Time.deltaTime is for Update() and Time.fixedDeltaTime is for FixedUpdate(). Second - Time.fixedDeltaTime - is a constant, so you can create global variable in the top of a script somthing like this:
Quaternion deltaRot = Quaternion.Euler(0f, 200f * Time.fixedDeltaTime, 0f);
Then in FixedUpdate() just use this in that way:
transform.rotation *= deltaRot;
May be this will help)
p.s. use float numbers with "f"... "0f" instead of "0" etc.; and sorry for my english
Answer by FlashX · Nov 29, 2014 at 11:25 AM
Have you tried banging just that line of code in a new project to eliminate everything else?
I just did that, but no luck,
Similar problem I found here but not sure whats the thing, Check in
http://answers.unity3d.com/questions/353427/how-to-do-one-draw-call-out-of-a-rotating-coins.html
Answer by psycocrusher · Nov 29, 2014 at 08:41 PM
They all need to have the same material an respect the dynamic batching guide lines:
Your answer
Follow this Question
Related Questions
Best rotation function to use 1 Answer
My GameObject does not rotates. 2 Answers
how do I make a obeject (player) move the way it's pointing ? (like a jetpack) (c#) 1 Answer
Rotate a gameobject by a specific angle and stop when character doesnt move anymore 0 Answers
Rotate object based on FPSCamera 1 Answer