1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

UnityでInstantiateしたにもかかわらずParentが無いと言われる場合

Last updated at Posted at 2019-06-17

背景・エラー文

Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption
あるオブジェクトをSetParentしたいが、SetParentする親が無いと言われる。インスペクタ上では親オブジェクトが存在する。

原因

親オブジェクトはDontDestroyOnLoadでないにもかかわらず、SetParentで子にしたいオブジェクトはDontDestroyOnLoadだった。
親オブジェクトをInstantiateする際に、DontDestroyOnLoadをつけてインスタンス化する。

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?