



代码实例
using UnityEngine;
using System.Collections;
public class Test : MonoBehaviour
{
void Start()
{
}
void Update()
{
}
void OnCollisionEnter(Collision other)
{
}
void OnCollisionStay(Collision other)
{
if (string.Equals("Cube (1)", other.gameObject.name))
{
Debug.Log("产生火花");
}
}
void OnCollisionExit(Collision other)
{
}
void OnTriggerEnter(Collider other)
{
Debug.Log("进入触发范围");
}
void OnTriggerStay(Collider other)
{
Debug.Log("在触发范围");
}
void OnTriggerExit(Collider other)
{
Debug.Log("离开触发范围");
}
}