Hey Guys,
I have created a prefab . I wanted to instantiate this prefab just once. To do this I wrote the line of code in Start function. But Prefabs is being instantiated like I wrote in Update function. I couldn’t solve why.
Here are my codes :
[CreateAssetMenu(menuName = "Create An Enemy")]
public class EnemyConfig : ScriptableObject
{
// It shows which enemy is it
public GameObject enemyPrefab;
}
- ``
- ``
- ``
public class FollowThePath : MonoBehaviour
{
[SerializeField]
EnemyConfig enemyConfig;
private void Start()
{
Instantiate(enemyConfig.enemyPrefab, enemyConfig.enemyPathPrefab[0].position ,Quaternion.identity );
}