第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

標(biāo)簽在 Unity C# 中不起作用

標(biāo)簽在 Unity C# 中不起作用

C#
侃侃爾雅 2021-08-07 15:23:48
我編寫了以下代碼來損壞我的播放器,但是它不起作用。我已經(jīng)盡可能多地檢查了編碼錯誤,我知道我的問題是標(biāo)簽。使用 Debug.log 功能,我能夠確認(rèn)問題不在于我的命中框,并且標(biāo)簽設(shè)置正確。相同的系統(tǒng)反過來對我的玩家彈丸造成傷害。但是,使用我的播放器進行設(shè)置時它不起作用。using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;public class DamageToPlayer : MonoBehaviour {public float damageAmount;public void OnCollisionEnter(Collision col) {    if(col.gameObject.tag == "Player")    {        Debug.Log("nearlyThere");        PlayerHealth ifPlayer = col.gameObject.GetComponent<PlayerHealth>();        if(ifPlayer != null)        {            ifPlayer.PlayerDamage(damageAmount);            Debug.Log("TOUCH");        }    }}這是敵人的密碼。}using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;public class PlayerHealth : MonoBehaviour {public float PlayerStartHealth;public float playerHealth;public Text text;public void Start () {    playerHealth = PlayerStartHealth;} public void PlayerDamage(float pAmount){    playerHealth -= pAmount;    if (playerHealth <= 0)    {        EndLevel();    }}public void EndLevel(){    Debug.Log("u died m8");}public void FixedUpdate(){    text.text = playerHealth.ToString();}這是更多信息:控制臺上沒有出現(xiàn)任何調(diào)試。這就是我知道問題的方式。}這是玩家健康碼本身。我不知道為什么這不起作用。
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 266 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號