Instantiated rigidbody lags before applying .Addforce

Hello, everyone.

So, i instantiate an object using a code below. Right after it spawns it just stay still for ~0.3 seconds and only after that it starts moving. If i change interpolate of that object from “none” to “interpolate”, the object jumps further and back a few times in the direction it should go after instantiating and then move normally.

void Fire()
    {
        Rigidbody2D FireballInstance = Instantiate(Fireball, transform.position, transform.rotation) as Rigidbody2D;
        FireballInstance.AddForce(transform.right);
    }

The Fire() is called from Update function, because Update checks if mouse is pressed more correctly than FixedUpdate. Tried to make it from FixedUpdate though and nothing changes, object freezes for a moment and then start moving.

I also tried to move:

FireballInstance.AddForce(transform.right);

Into that object code in Awake. But result was the same.

What am i doing wrong? (And sorry for bad English, if anywhere).

You’re going to want to make use of an object pooling system. Instantiate is relatively slow. So in your scripts you’ll have some instantiation code in a Start() method that makes a few of the fireballs, deactivates them, and puts them in a List. This is your pool that you will take fireballs from. Remove them while they’re in action, then put them back when they are no longer in action.

Here’s a beginner’s tutorial on the subject.