Reputation: 65
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 ?
I add my prefab to script
When I run the game it just disappears !!??
Upvotes: 0
Views: 1330
Reputation: 3059
the bomb prefab that you attach must be in under your asset folder , not in the scene , I mean when you click on the bomb that you assigned it must open project tab and shows it to you if it only exist in scene , it will be disappeared
Upvotes: 1
Reputation: 11
It could be that the bomb prefab you are assigning to your public GameObject variable is somehow being destroyed when you start the game.
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.
Upvotes: 0