UnityException:标记:未定义 [英] UnityException: Tag: is not defined

查看:249
本文介绍了UnityException:标记:未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注 Unity掷球教程,但我捡起旋转的物体时遇到问题.每当我将鼠标悬停在它们上面时,都会出现此错误:

I'm following the Unity Roll A Ball Tutorial but I'm having an issue picking up the spinning objects. Whenever I roll over them I get this error:

UnityException:标记:未定义拾取. PlayerController.OnTriggerEnter(UnityEngine.Collider其他)(位于Assets/Scripts/PlayerController.cs:30)

UnityException: Tag: PickUp is not defined. PlayerController.OnTriggerEnter (UnityEngine.Collider other) (at Assets/Scripts/PlayerController.cs:30)

我已经确保我的标签PickUp与代码中的标签完全相同,但仍然无法正常工作.我一直在尝试修复此问题很长时间,因此我们将不胜感激.

I've made sure my tag PickUp is exactly the same as in the code, and still it doesn't work. I've been trying to fix this for a long some so any help is appreciated.

推荐答案

您必须先从编辑器添加标签(PickUp),然后才能从脚本中引用它.

You have to add the tag(PickUp) from the Editor before you can reference it from script.

这篇关于UnityException:标记:未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆