Martiiic
✅ HAVING TROUBLE CALLING A FUNCTION
So I've made an ingame saving system like the one in hollowknight but Im having trouble with something. My enemies despawn when you enter and that's alright until you want to get out the save point, I want the enemies to respawn after exiting the save point but it doesnt. Sorry for bad englsh.
CLASS1 Enemic:
public void PlayerEnterAltar()
{
Enemic[] enemies = FindObjectsOfType<Enemic>();
foreach (Enemic enemy in enemies)
{
enemy.MortSLS = false;
enemy.IsDead = false;
enemy.CurrentMoveSpeed = enemy.moveSpeed; // Guarda la velocitat actual
enemy.moveSpeed = 0f;
enemy.gameObject.SetActive(false);
}
}
public void PlayerExitAltar ()
{
Debug.Log("Enemics tornen a apareixer");
Enemic[] enemies = FindObjectsOfType<Enemic>();
foreach (Enemic enemy in enemies)
{
Debug.Log("Enemics tornen a apareixer");
enemy.gameObject.SetActive(true);
enemy.MortSLS = false;
enemy.currentHealth = enemy.maxHealth;
enemy.moveSpeed = enemy.CurrentMoveSpeed;
}
}
CLASS 2 Player (where PlayerExitAltar and PlayerEnterAltar are called FILE)
55 replies