- Home /
Getting Monobehavior script from inspector
Hi all, I'm working on creating a generic trigger script where the level designer can place trigger box or zone, and have certain things activated with it.
So far, I was able to accomplish making enable/disable/setposition to work right, but now I want to go further into advance and say if I want a player in the trigger, I want to be able to access another script in another gameobject. So like if the Target has been assigned, I wanted to find a way to get the object's variable and have it assigned.
Note, it has to be generic as possible!
OnTriggerEnter gives you the collider, so collider.gameObject... sounds like what you are asking for?
No, I wanted it to work where if I add the Target gameobject in the inspector, I wanted to find what this target's variable. Like if the Target has a script on it, with some variable as to enable or disable, floats, and booleans. I wanted to be able to select that in the inspector of the trigger script.
So that the changes I made to the target should apply when the player hits the trigger script.
Here's for an example, http://www.youtube.com/watch?v=$$anonymous$$kfmJlePfOU
Around 4:20 - Something like what he did, when I get a target in there, I wanted to have additional options to apply changes to the target via different ways of input/output. So I wanted to figure it out how I can say if I get the target of one object, I wanted to see what are my output commands for this target because I wanted to like enable a script or toggles some boolean in the script.
Your answer
Follow this Question
Related Questions
Plugging a script into another script when gameobject is selecte 1 Answer
Access a Script from Another Scene? "Object Reference not set..." 0 Answers
Get GameObject From Another Script 1 Answer
Access a Script from Another Scene? "Object Reference not set..." 1 Answer
Decrease life from another script 1 Answer