LoginSignup
1

More than 5 years have passed since last update.

[解決済み] unity > bug? > InstantiateしたGameObjectのtagを変更できない > Transformで宣言していた

Last updated at Posted at 2015-08-09
動作確認
Unity 5.1.1-f on MacOS X 10.8.5

InstantiateしたGameObjectのtagを変更しても変更されない。

player = Instantiate(myprefab, pos1, Quaternion.identity) as GameObject;
player.tag = "Player";

上記で生成されるXXX(Clone)のTagを見ると"Untagged"のままだ。

いくつか調べたが、似たような現象の例を見る。Unityのバグなのだろうか?
http://answers.unity3d.com/questions/421278/how-to-tag-an-object-when-i-instantiate-it.html



解決した。
public GameObject myprefab;

とするところ

public Transform myprefab;

としていた。GameObjectにしたらtag変更できるようになった。

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
1