Question by
medledan · Sep 09, 2017 at 12:42 PM ·
not workingmissingcomponentexception
Missing Component Exception
Hey guys I am getting the following error :
MissingComponentException: There is no 'MeshRenderer' attached to the "Tutorial Transitional ramp" game object, but a script is trying to access it.
However, I do have a MeshRender attached to the gameObject. The script is working as well. However, I still get this error. Script below.
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class turn_off_renderer : MonoBehaviour {
// Use this for initialization
public MeshRenderer campmeshrend;
void Start()
{
campmeshrend = gameObject.GetComponent<MeshRenderer>();
campmeshrend.enabled = false;
}
// Update is called once per frame
void Update () {
}
}
Comment
Answer by Cuttlas-U · Sep 09, 2017 at 01:20 PM
hi; i think u attach the script to another object in your game too ;
u can use :
Debug.Log(gameObject.name);
to check the object ;
Your answer
