Check if GameObject is an instance of a Prefab

Is there any way to check if a specific gameobject is an instance of a specific prefab at runtime via scripting?

See this thread.

A very simple solution is to add a “tag” component that just encodes the type of the object. You could use an enum or int or string. Simplest version:

public class TypeOfPrefab : MonoBehaviour
{
    public int PrefabType; // or: string, enum, ..
}

If you’re also looking for an editor-time solution, check out the PrefabUtility and GetPrefabInstanceStatus