Okay, I’m trying to make a door visible by turning on the mesh renderer, so I made this code, but I’m getting this error: Assets/scripts/NewDoor.cs(18,35): error CS0120: An object reference is required to access non-static member `UnityEngine.Component.GetComponent(System.Type)’
The script (in c#)
using UnityEngine;
using System.Collections;
public class Newdoor : MonoBehaviour {
GameObject [] dr;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
dr = GameObject.FindGameObjectsWithTag("door");
foreach(GameObject go in dr){
go.Component.GetComponent(renderer);
renderer.enabled = true;
}
}
}
I get the error is on line 18, and I’m sure that it’s a very easy answer, but I just don’t get it.
Please help, I’m trying to do this for a class.
Thanks in advance for your help!