arma_best
arma_best

Reputation: 65

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 ?

I add my prefab to script

When I run the game it just disappears !!??

enter image description here

Upvotes: 0

Views: 1330

Answers (2)

Milad Qasemi
Milad Qasemi

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

Christopher G
Christopher G

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

Related Questions