- Home /
Question by
TetroLancer · Jul 17, 2015 at 07:42 AM ·
hi im trying to delete the mesh renderer on collision but get the error cs1525 any pointers?the problems occur on line 5
using UnityEngine; using System.Collections;
public class deathOnTouch : MonoBehaviour {
void OnCollisionEnter (Collision col)
{
if(col.gameObject.name == "character")
{
Destroy(col.(GetComponent<MeshRenderer>));
}
}
}
Comment
Best Answer
Answer by BiG · Jul 17, 2015 at 07:43 AM
Your synthax is a bit messy. It should be
Destroy(col.GetComponent<MeshRenderer>());
thanks just that didnt do the job but what i did was change it to Destroy(col.gameObject.GetComponent()); and that worked fine :)
Fine! :-) Can you please mark the answer as accepted? Thanks!
Your answer
Follow this Question
Related Questions
Rigidbody slowly moves 1 Answer
GI Stuck on bake indirect 2 Answers
OnCollisionEnter2D(coll: Collision2D) function not being triggered 0 Answers