1
\$\begingroup\$

I am making a TD game in unity, Initially I made all of my enemy movements frame rate dependent say:

I had a grid point1 at -22.65 and other at -21.1, diagrammatically:

(-22.65) _________(-21.1)_______(-21.1+1.55) ......

so the distance on x axis between two points is 1.55, divided it by 25 jumps with each enemy jump of 0.062 of each frame. On reaching on next point of grid the enemy find again its path. All went fine until I have requirement of FastForward and Pause feature. I used timeScale property of unity but it wont work as they are frame dependent. I also tried double speed of enemy on clicking fast forward button at any time, it has some issues that enemy jumps are now less and it fails to reach on next grid point.

Could someone suggest me solution to my problem. Do I need to change the enemy movement code to make it frame independent ?? I need the enemy to reach on the grid specific point I also need later to slow down any one enemy's speed when tower fires on it. Thnx

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

If you are using fixedUpdate() then could change the fixedDeltaTime. Otherwise if it's in the update() function then the movement should use the delta time so you could use the timeScale property you mentioned.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .