GameObject.Find, Inactive GameObjects, and Instantiating

Hi everyone, this is my first question here, but something tells me not the last. I’ve just started working with Unity and have a conceptual question.

Imagine that with a click on a certain GUI element I want to instantiate a prefab which has a script attached to it handling mouse movements and clicks until a certain action is performed by the user. I have created such a prefab, added it to the scene, and I can instantiate a clone of it.

Now, I certainly don’t want my original prefab (which serves as a template for instantiating) to handle mouse movements or whatever; in fact, I just want it to sit still and do nothing apart from being used as a reference for instantiating new gameobjects.

I see two options here: either to set it inactive, or add some code to my prefab which would help discriminate the original prefab from all “working” prefabs in the future, something like this:


void Update()
{
    if (isOriginal) return;
    // do some stuff
}

The first option makes finding the original gameobject in the scene for purposes of cloning it rather complicated (but not impossible; answers how to do it can be found in other related topics here on Unity Answers). The second option I personally don’t like because it just seems sort of cumbersome to me.

I wonder what is the common practice in such cases, because it would seem that this should be a very common pattern in the prototype-based Unity instantiating model. Should the original prefab be inactive? Should it be handled manually in the prefab’s script? Or maybe the whole approach is wrong? If so, what is the best way of doing what I’m trying to achieve?

Any input will be greatly appreciated!

The point of prefabs is that they should only exist in your project folder, not in your scene. So you don’t have to be concerned with any of the inactive stuff and so on.