[英]My Prefab disappears from script when I run the game?
I have Script attached on my Player, that script has Public GameObject variable.When I attach my Prefab to it and run game it disappears from script ? 我在Player上附加了脚本,该脚本具有Public GameObject变量。当我将Prefab附加到它并运行游戏时,它从脚本中消失了?
I add my prefab to script 我将预制件添加到脚本中
When I run the game it just disappears !!?? 当我运行游戏时,它就消失了!
您所连接的炸弹预制件必须位于资产文件夹下,而不是在场景下,我的意思是,当您单击分配给它的炸弹时,它必须打开“项目”选项卡并显示给您,如果它仅存在于场景中,它将是消失了
It could be that the bomb prefab you are assigning to your public GameObject variable is somehow being destroyed when you start the game. 您分配给公共GameObject变量的炸弹预制件可能在启动游戏时以某种方式被破坏。
For example: 例如:
public GameObject other;
private void Awake()
{
Destroy(other);
}
Check to see if you have any Destroy functions that could be causing the prefab to be destroyed. 检查是否有任何破坏功能可能会导致预制件被破坏。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.