- Home /
This post has been wikified, any user with enough reputation can edit it.
Using arrays with OnTriggerEnter
I would like my FPC to enter various spaces and when it does, HUD to display the name. Next I'm trying to see if I could assign triggers and the text I want to display in the Inspector by using arrays but once I do that the OnTriggerEnter doesn't work. Is there any other way to be able to code so that I can make changes in Inspector. Thanks
var testInput : GameObject; var testOutput : String;
function OnTriggerEnter (myTrigger : Collider) {
if(myTrigger.gameObject == testInput)
{
print("You are in the Isolation Room with Dialysis!");
TextHints.message = testOutput;
TextHints.textOn=true;
if(SelectionMenu.scenaristep == 0)
{
SelectionMenu.step1 = "DONE";
}
}
if(myTrigger.gameObject.name == "P4459")
{
Debug.Log("You are in the Clinical Care Documentation Station!");
TextHints.message = "You are in the Clinical Care Documentation Station!";
TextHints.textOn=true;
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613120349im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
GUIs for Power ups? No idea. 1 Answer
CoolDown Animation on the GUI 1 Answer
Off Screen direction indicator HUD element / wrestling with Quaternion 1 Answer
GUI font size? 1 Answer
StoreGUI problems 1 Answer