error CS0029:无法将类型“string”隐式转换为“bool”

问题描述 投票:0回答:0

我想统一检测触摸,但我遇到了一个奇怪的错误

我期待得到调试日志

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class toucth : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {

    }
    void OnCollisionEnter(Collision col){
        if(col.gameObject.name = "Cube(10)"){
            Debug.Log("col");
        }
    }
}
unity3d
© www.soinside.com 2019 - 2024. All rights reserved.