Duplicated prefabs

Hello. Im new to prefabs. I have Prefab named “Enemy”. There is script inside that Enemy gameobject which contains movement and knockback. The problem is when i duplicate prefab in scene, not works as i expected. When i hit enemy, my other duplicated enemies exhibits the same behavior as other prefabs. I tried to unpack completely but not worked. I have 2 script in prefab one of them is knockback other one is movement. Thanks for help.

When you duplicate a prefab in Unity, all instances of the prefab will share the same components and scripts. This means that any changes made to the prefab will be applied to all instances of the prefab in the scene.

In your case, when you hit one enemy prefab, the knockback script is being applied to all instances of the enemy prefab, causing them to exhibit the same behavior. This is the expected behavior when using prefabs in Unity.

If you want each instance of the enemy prefab to behave independently, you will need to create a new script that is specific to each instance of the prefab. You can do this by adding a new script to the prefab and using the “Instantiate” method to create new instances of the prefab in the scene. Each instance will have its own copy of the script, allowing it to behave independently.