我正在尝试统一检测对游戏对象的触摸,但我无法让它工作,而且我在其他任何地方都看不到它。我明白为什么它不起作用。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
public class toucth : MonoBehaviour
{
public string touching_qury = "John";
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void OnCollisionEnter(Collision col)
{
touching_qury = col.gameObject;
Debug.Log(touching_qury == "RC_zombie1");
if(col.gameObject){
Debug.Log("score + 1");
}
}
}