Performance of rigidbody.moveposition vs. manually setting transform.position

I’m working on a roguelike game, since all movement and collision logic is tested with regards to the map grid no physics or collision is necessary; all I need to do is smoothly move the player’s sprite from one location to another.

With a single character, Vector3.MoveTowards(currentposition, destination, speed) works just fine, but if I try to move more than 5-6 characters at once, everything begins to lag quite badly and my CPU thread jumps from around 12ms to 30-40ms until everyone has stopped moving.

My first thought is that moving sprites this way is unintended, and I’m unknowingly making the operation much more expensive than it has to be. Would doing this with rigidbody2ds be any cheaper than manually changing the vector?

Honestly, I dont know but you could always make a copy of your project to test it on. If you do this than I would love to see the results.

Hmm, my super-nonscientific, hastily taped-together test says “Not really”; 20 NPCs using Vector3.MoveTowards every update bump the CPU up from around 10ms to 30-36ms until they stop moving, doing the same thing with RigidBody2D.AddForce averages 36-38. It’s really too close to compare, but I think it speaks more to the inadvisability of doing this much work on tick than to the comparative efficiency of either method.

That having been said, it escapes me how else you could effect smooth movement with sprites, since the very nature of the beast is to move a bit every frame.