Why can't I Override my Prefab?

Lecture: Argon Assault Unity 3D (103)

I added Parent Fx Clone to the script and hit override. The Section that I changed does not override the originalprefab and remains bold. I had to drag and drop the GameObject onto each enemy. I checked to see if my duplicates are all connected and each one is connected to the original.
NOTE: I tried Prefabing the EnemyClones and it still does not work.

Screenshot at Jan 06 21-30-54

public class Enemy : MonoBehaviour
{
    [SerializeField] GameObject EnemyDeathFX;
    [SerializeField] Transform parentFxClone;

    private void Start()
    {
        colliderSettings();
    }

    private void colliderSettings()
    {
        Collider enemyCollider = gameObject.AddComponent<BoxCollider>();
        enemyCollider.isTrigger = false;
    }

    public void OnParticleCollision(GameObject other)
    {
        GameObject fx = Instantiate(EnemyDeathFX, transform.position, Quaternion.identity);
        fx.transform.parent = parentFxClone;
        Destroy(gameObject);
    }
}

Hi,

Welcome to our community! :slight_smile:

When a new scene gets loaded, all game objects in it get destroyed by default. Would it be advisable to allow a prefab to reference a game object in the scene? What will happen if the EnemyClones object gets destroyed or simply does not exist? The prefab will not work anymore.

For this reason, prefabs cannot reference any game objects in the Hierarchy.

Does that make sense?

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms