have a gameObject that requires a component

I truly did search for the solution.
I find some answers online, but what I have found is not the solution I want because I also want it to work well with the editor if possible.

Anyway, If I have this:

public GameObject tile_set;

then in the unity editor I can use every gameobject with the selector.
But I want to limit it to only GameObjects that contain a WangTileSet script.

If I change it to

public WangTileSet tile_set;

Then it becomes more about the script and not the gameObject.

So what I’m looking for is something like (this won’t work cause it’s not a generic).

public GameObject<WangTileSet > tile_set;

So if I use the editor to point to the right prefab that only the ones with the WangTileSet show up.
So not like this where also the foundation prefabs show up:

Is something like this possible?

If I change it to

public WangTileSet tile_set;

Then it becomes more about the script and not the gameObject.

No, it will do exactly what you want. You will have a field in the inspector and only GameObjects with this components will be allowed.