Detect key press when there is a collision/trigger

后端 未结 2 1406
感情败类
感情败类 2021-01-23 09:10

I have an object and I\'m trying to get the player to enter the trigger and press a key, swap the camera.

My code:

public class Canhao : MonoBehaviour
{
         


        
2条回答
  •  再見小時候
    2021-01-23 09:46

    You are puting TRIGGER || KEYPRESS you must replace the || with &&.

    if(other.gameObject.CompareTag("Player") && Input.GetKeyDown(KeyCode.C))
    

提交回复
热议问题