I’m trying to build a generic “Use” button that will activate any object configured to accept it: doors, computers, and so forth. What I would like to do is have the Use button check if there are any objects tagged “Useable” within range, and if they are activate some function “ItemUsed()” in a child script on that object, which would contain all of the animations, stat-setting, and whatever else I want to do.
The problem is, I want there to be different scripts for different objects- is there any way for me to make a bunch of small scripts: door.cs, computer.cs, food.cs and so forth, put a public void ItemUsed() in every one of them with different behaviors depending on what I want the object to do, and configure my Use button to go “Find whatever script is on the tagged object and activate its ItemUsed function”?