i have a script and a capsule collider with prefabs, i am trying to collide. when i use collisionOnEnter i dont get a callback. i only get onStart. could i use a trigger to fix this without rigidbody?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ground : MonoBehaviour {
public string wb;
void OnCollisionEnter(Collision other){
//if (other.gameObject.name == "") {
wb = "alive";
Debug.Log("I am alive!" + other.collider.name);//}
}
// Use this for initialization
void Start () {
wb = "other";
Debug.Log("I am boid!");
}
// Update is called once per frame
void Update () {
if (wb == "alive"){
//transform.SetParent ();
wb = "sprite";
}
if (wb == "other") {
transform.position += Vector3.back * Time.deltaTime*14;
}
if (wb == "sprite") {
transform.rotation = Quaternion.identity;
Debug.Log("I am sprite!");
}
}
}
any suggestions im using unity 5.5.0.b7