B1 中級 英國腔 1473 分類 收藏
開始影片後,點擊或框選字幕可以立即查詢單字
字庫載入中…
回報字幕錯誤
Tags are a way of identifying game objects in Unity.
As a name of a single object could identify it,
it can be useful to set tags also.
For example you may have an object called Ork or Tank
but these could all be tagged Enemy,
and in your code you could check for any objects
that have the tag Enemy.
Likewise a script on an enemy could check for a player character
by looking for a player tag.
To assign a tag to an object, select it and use the
drop-down menu at the top of the inspector.
If the tag you want isn't already present then add a new tag.
You can add a tag by clicking the option at the bottom of the menu
and then entering it in the list of tags at the top
of the tag manager.
Once you've done this, return to the object you
wish to place the tag on
and select it from the drop-down.
There are a number of functions in code,
which will allow you to find objects with tags,
the simplest one of these is GameObject.FindWithTag,
which allows you to specify a string with the name
of the tag inside it.
This script is attached to my enemy object
and I can use that to find an object with the tag Player.
So I'll set my robot to be tagged Player
and when the game starts my enemy is seeking out that
object and looking at it.
Likewise you could find multiple objects with the same tag
by using FindGameObjectWithTag.
See the scripting reference for more examples of this.
提示:點選文章或是影片下面的字幕單字,可以直接快速翻譯喔!

載入中…

标签-Unity 官方教程 (Tags - Unity Official Tutorials)

1473 分類 收藏
朱瑛 發佈於 2014 年 5 月 2 日
看更多推薦影片
  1. 1. 單字查詢

    在字幕上選取單字即可即時查詢單字喔!

  2. 2. 單句重複播放

    可重複聽取一句單句,加強聽力!

  3. 3. 使用快速鍵

    使用影片快速鍵,讓學習更有效率!

  4. 4. 關閉語言字幕

    進階版練習可關閉字幕純聽英文哦!

  5. 5. 內嵌播放器

    可以將英文字幕學習播放器內嵌到部落格等地方喔

  6. 6. 展開播放器

    可隱藏右方全文及字典欄位,觀看影片更舒適!

  1. 英文聽力測驗

    挑戰字幕英文聽力測驗!

  1. 點擊展開筆記本讓你看的更舒服

  1. UrbanDictionary 俚語字典整合查詢。一般字典查詢不到你滿意的解譯,不妨使用「俚語字典」,或許會讓你有滿意的答案喔