Question by
DaFilmz · Jul 29, 2019 at 01:58 PM ·
script.error message
error CS1503 Cannot convert method group to string.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HeatScript : MonoBehaviour
{
public Material[] material;
Renderer rend;
void start ()
{
rend = GetComponent<Renderer>();
rend.enabled = true;
}
void OnCollisionEnter (Collision col)
{
if(col.gameObject.name == "Anvile")
{
StartCoroutine(ChangeColorToRed);
}
}
public IEnumerator ChangeColorToRed()
{
yield return new WaitForSeconds(4f);
rend.sharedMaterial = material[1];
}
}
There might be something very simple in here I am missing but I can't figure it out. Since I'm new to the whole coding thing I figured posting for help is my best option.
Comment
Best Answer
Answer by Dragate · Jul 29, 2019 at 02:45 PM
Change
StartCoroutine(ChangeColorToRed);
to
StartCoroutine(ChangeColorToRed());
or
StartCoroutine("ChangeColorToRed");
This worked for me. Thanks
Seems like a better error description would help in this case.
Your answer
Follow this Question
Related Questions
Can't Add Script Behavior... 2 Answers
Object reference not set to an instance of an object (c#) 0 Answers
Getting error on lap counter script JS 0 Answers
';' expected. Insert a semicolon at the end. Already have one 1 Answer
Can't add Orbital script - "The script needs to derive from MonoBehaviour!" 0 Answers