Hello, I’ve been following a tutorial I found on youtube, it’s about A* AI by Arongranberg (I think his name was something like that, He wasnt the one doing the tutorial that I was following) anyways, I created my own character from Blender, I rigged it with 2 diffirent animations, Walk animation and Idle animation. I followed the tutorial exactly and put in my animation.play(“Walk”); into the script and I suddenly get a EXTREME lagg, and was wondering what might cause this so I tried to google the problem and I cant find a solution at all.
I hope anyone of you got a solution to the problem.
Besides just looking at the stats window, I have a few things for you to consider.
The blender model. How many faces vertices do you have? Did you optimize the model/mesh at all? It’s hard to be a great artist in blender and then import your models into video games because they absolutely have to be optimized. If you are trying to animate a model with hundreds of thousands of vertices & faces, well, it’s not going to perform so well in the game.
Collision. One thing that will absolutely cause a game to screw up is the collision engine. Are you using colliders on anything (including anything with a rigidbody)? Rigid bodies, colliders, and the works, sometimes if something isn’t colliding properly it will make the game excessively lag. An example is recently I put a tire track in my game for when a vehicle drives. I accidentally left a collider on it and it would intersect with the ground below it, causing the game to horrendously lag. It could be some kind of collision detection problem.
Your script, you said you activated the animation from the script. How did you do this? If you put animation.play(“Walk”) in the update or fixed update methods, it’s going to call that function EVERY frame, you only want to call that once. Make sure you are using this in the correct spot, maybe in the start function if it’s a looped animation.
Besides that, I don’t know what else it could be. If all else fails, restart the tutorial and try again. At least it’s only a tutorial and not some big custom game you are making.