Alright, I want to do the simple solution to make a weapon that is parented to my camera appear when I walk into a trigger.
I unchecked Mesh Renderer to make my weapon invisible.
I made an empty game object.
I added a box collider and I checked the box to make it a trigger.
I made a prefab for my weapon. The weapon is called “bow”.
I tried to make a script with the Mesh Renderer in mind. I put the script on the trigger.
This is the script:
var bow : MeshRenderer;
function OnTriggerEnter() {
bow.MeshRenderer.enabled = true;
}
I dragged the bow prefab into the slot the script has for “bow”.
“I keep getting: Object reference not set to an instance of an object.”
I know I am missing something, but I don’t know what it is.