Error That Doesn't Affect My Game Is Spammed Every Frame.

I keep getting 999+ of the error “NullReferebceException: Object reference not set to an instance of an object” The line of code:
var rb = object.GetComponent(Rigidbody);

In the script I have it where if you click it instantiates a prefab there, and attached to the prefab are some scripts, colliders, and rigidbodies. After getting its Rigidbody I apply force to it. My script works just as I wanted it to. How can I fix this error, or is there anyway I can just ignore it? I would just disable error popups in the console but I still need to check for other errors. Thanks in advance.

Errors like this should never be “ignored” per say, thats a very dangerous approach to take, especially given that unity will stop running scripts that throw them at runtime.

I’d advise just putting null checks around the offending lines, for example.

var rb = null;
if( object != null)
{
    rb = object.GetComponent(Rigidbody);
}

but keep in mind going down this route would mean that now rb is null, and similar checks would need to be placed around code that uses that.