So I’ve built an awesome conversation mechanic for my game, where players can navigate through by clicking buttons to discuss different topics and all that part’s working great. Now, I also want to be able (at some point in the future) to semi-randomly assign quests to different NPCs - so for example, ‘guard’ NPCs might have various quests to slay so-and-so creature or such-and-such many of so-and-so pest, and so on. So when designing my quest system, I decided to make ‘quests-objects’, or empty gameobjects on which to store scripts with all the data necessary for the quest they’re associated with. That part went great too!
Now, though, I’m trying to put the two together. I want to be able to click a conversation option like ‘Do you need any help?’ and check if the NPC I’m speaking to has a quest-object attached. I figured that making a tag for all the quest-objects was the best way, but…then I realized I’m not sure how to check if an object has a component by anything but name or type (and if so, to get a reference to that component). And each of these quest-objects has a different name, and is really just the generic script type.
Anyone able to point me the right way here? In short, I need an easy way to tell if an object has one of several different components, and I don’t want to have to update a list of included components all the time.