0
votes

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 !!??

enter image description here

2
Can you provide the script?John Boher
It's ok now, I found another way of solving this problem.. Thanks to everybody :Darma_best

2 Answers

1
votes

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

0
votes

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.