First off I’m sorry if this is something simple I tried to search for a solution but came up empty.
I’m having trouble using C# with box collider. What I want to have happen is when my capsule enters a box collider it triggers a message to display on a guiText object. I can do this in JavaScript but have been unable to get it to work in C#. I need to use C# because what I eventually want to display is being read in from a txt file. Any help would be greatly appreciated!
Below is my skeleton attempt to get any text to display in a guiText object. I can’t attach a guiText to the script. I can attach it to the collider but just get an error when the capsule enters the box collider.
Any help would be greatly appreciated!
using UnityEngine;
using System.Collections;
using System;
using System.IO;
public class MRoomCS : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter(Collider collision)
{
guiText.text = “Is Working”;
}
void OnTriggerExit(Collider collision)
{
guiText.text = “”;
}
}