First of all, terminology is confusing, so let’s make sure we’re on the same page. A “prefab” is an object which is not in the scene, but is ready to be created, or, instantiated into the scene. You have to keep a reference to that prefab through a variable that you set in the editor before you run the game. An “instance” of a prefab is one that you have instantiated, or created, in the scene. It is now an object in the scene, an instance of the prefab, but not a prefab anymore. But you should still keep your reference to the original prefab, so you can create more if you want to.
If you create an instance of a prefab, and then continue to duplicate the instance after that, instead of the prefab, you’re just making copies of copies, instead of making a bunch of copies from the original. This could result in unexpected behavior.
You probably want to create a “public GameObject CarPrefab”, or something like that, and place the prefab into that in the editor before you run the game. Then, during the game, you don’t want to set “CarPrefab” as anything new. Just leave that as the prefab reference, and use that when you instantiate:
gNew = Instantiate(CarPrefab, hit.point, transform.rotation) as GameObject ;
Now, gNew is always the new object instance, but CarPrefab always remains as a reference to the prefab.
And in this case, you should need “gObj” and “gNew”. Just use one of them. You can Destroy gObj before you instantiate a new object, and then set gObj as that new instance. Like this:
if (gObj != null )
{
Destroy(gObj);
}
gObj = Instantiate(CarPrefab, hit.point, transform.rotation) as GameObject ;
Hope that helps.