Question by
willablox · Oct 04, 2016 at 02:57 AM ·
unity 2derror messagenewbiefunctions
Help! I don't know how to fix this. Errors CS1041, CS1525, CS8025
I have been stumped and I don't know how to fix the following problems with the code - CS1041: Identifier expected - CS1525: Unexpected symbol (', expecting
)', ,',
;', [', or
='
I am trying to get a bullet to disappear after colliding with something and can't seem to get it.
I am very new to Unity and coding in general and would be greatly appreciated if someone can help me see my errors. Thanks
using UnityEngine;
using System.Collections;
public class Despawn : MonoBehaviour {
function OnCollisionEnter(other : Collision){
var despawnTime = 1;
yield WaitForSeconds(despawnTime);
Destroy(bullet);
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
Comment
Answer by NoseKills · Oct 04, 2016 at 06:32 AM
You are mixing UnityScript into your C# script
function OnCollisionEnter(other : Collision){
should be
void OnCollisionEnter(Collision other) {