using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CollisionDetection : MonoBehaviour {
public Collision c;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
OnCollisionEnter ();
}
void OnCollisionEnter(Collision c){
if (c.gameObject.name == "Wall") {
Movement.MoveDirection = Vector2.zero;
}
}
}
我可以传递参数Collision c
,但不能将其作为参数传递回来,当我收到错误expected 3
时,会在屏幕上显示以下语法:{{1} },Expected )
答案 0 :(得分:3)
您的方法签名与调用不匹配。详细信息:
void OnCollisionEnter(Collision c) {
...
}
与调用上方(Update
中)的用法不匹配:
OnCollisionEnter ();
答案 1 :(得分:0)
删除两行 公共大肠杆菌病 Oncollision enter()
一切都很好