Animation or scripted movement?

Just out of curiosity, say I wanted to move an object and I had two options. One is a script that moves an object based on a simple curve equation ( in this case moving down a little bit then moving up to a specified location). The second option is obviously just creating an animation and applying it to the object. I’ve got both working to the point where they look identical so the how-to is no issue… the question is the should.

Would one be more expensive than another? I haven’t used the Unity animation system much yet so I don’t really know what the overhead is. I did have to make a script so I can offset objects with animation on them and recycle the same animation so it seems like the same amount of scripting will happen either way.

It’s not a huge issue, I’m just a little curious.

It really depends on the use case. If you need customization or variance down the line, the script option is obviously better suited to provide such. Otherwise, baking it into an animation gives you freedom from having to maintain code.

It’s kind of like the balance between a walk animation and a script to make sure the feet are grounded and in line with a set of stairs or ramp or rocky terrain.