I'm trying to adjust tagged objects meshrenderer in C# code.

I want the objects with the tag “Appear” to be invisible (meshrenderer off) on game start.

But I want them to become visible once the player has passed through a trigger.

using UnityEngine;
using System.Collections;


public class Trig1 : MonoBehaviour {
	public GameObject Appear;

	void start()
	{
	Appear = GameObject.FindGameObjectWithTag ("Appear");
	Appear.GetComponent<MeshRenderer> ().enabled = false;
	}

	void OnTriggerEnter(Collider other) 
	{
	Appear.GetComponent<MeshRenderer>().enabled = false;
	Debug.Log ("Object has entered the trigger!");
	}
}

Could you help identify what I’m doing wrong?

A friend walked me through making the code that I wanted.

using UnityEngine;
using System.Collections;
public class TRIGGIFER : MonoBehaviour {
	
	public GameObject[] visibleList;

	void Start(){
	visibleList = GameObject.FindGameObjectsWithTag("Appear");

	foreach (GameObject child in visibleList)
	{
	child.GetComponentInChildren<Renderer>().enabled=false;
	}
	}
	
	void Update(){}
	
	void OnTriggerEnter(Collider other) {
	Debug.Log ("Success");
	foreach (GameObject child in visibleList)
	{
	child.GetComponentInChildren<Renderer>().enabled=true;
	}
}}

For future viewers.