Change Renderer to GameObject in script?

In my script for shooting, to make the muzzleflash, it simply enables / disables the mesh renderer. But I no longer want this. What is the destroying/instantiating version of enabling/ disabling? For example “muzzleflash.______ = true;”
Thanks in advance!

Im sorry but that doesnt help me

What is the problem then?

There you go.

its checking if its enabled, how would i check if its “instantiated”?

if(muzzleFlash){
//the muzzleFlash exists
}

Is this what you’re looking for?

yes! But can i check without IF? Like _____ = true; ?

You mean something like this?

var isTargetInstantiated : Boolean = (myTarget != null);
if (isTargetInstatiated == true)
{
}

Beyond that, there is no:

myTarget.IsInstantiated property.

Reason is is simply that “myTarget” is null, so trying to access data on it makes no sense and throws errors. Instead if you want to check if something exists you check if it’s equal to null.

Well i just found another way to accomplish my problem but thanks for helping anyway!

You can’t really check “if” something is true without “if”.