LoginSignup
10
7

More than 5 years have passed since last update.

unity > スクリプトから動的にTagをGameObjectに設定する > .tag = "graphScale" > Tagは登録しておかないといけない

Last updated at Posted at 2015-09-11
動作確認
Unity 5.2.0f3 on MacOS X 10.8.5

GameObjectにtagをスクリプトから設定する。
例として、tagは "graphScale”とする。

ただし、graphScaleは以下のようにタグリストに登録しておかないといけない。

Main_unity_-_150911-textNearPanel_-_PC__Mac___Linux_Standalone__Personal__と_Assembly-CSharp_-_ButtonControl_cs_-_MonoDevelop-Unity.jpg

BottomLeftGOという名前のGameObjectのtagを設定するスクリプトは以下。

BottomLeftGO.tag = "graphScale";

"graphScale"というタグをタグリストに登録していない場合は以下のエラーとなる。

UnityException: Tag: graphScale is not defined.
10
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
7