So I guess this is the last question I have, in order to finish my RPG Game.
When I am leaving the first Scene, I wanted to delete a NPC forever from the Scene, cause he is moving as a “Mentor” with me in the second scene. So I made a UnityEvent on the LevelPortal to trigger a Function from a Script that lays on the NPC itself and that is setting a bool and Capture the state.
public class DestroySelf : MonoBehaviour,ISaveable
{
bool isGone;
public void Gone()
{
isGone = true;
}
public object CaptureState()
{
return isGone;
}
public void RestoreState(object state)
{
if ((bool)state)
{
Destroy(gameObject);
}
}
}
So the Capture State is working alright and doing his thing but when I am going back to the first Scene, the NPC is still there and Restore State won’t be even called and I am asking myself why? With other things like Fighter.cs its all working. And yes, the NPC has a Saveable Entetity and everything that is needed.