我使用Unity和PlayFab。
我有一个带PlayFabLogin脚本的GameObject。每当我更改场景并返回菜单时,此脚本为空,并且不会加载我的数据。我该如何解决
我尝试了Dontdestroy,但是没有用
private void OnEnable()
{
if (PlayFabLogin.PFL == null)
{
PlayFabLogin.PFL = this;
}
else
{
if (PlayFabLogin.PFL != this)
{
Destroy(this.gameObject);
}
}
DontDestroyOnLoad(this.gameObject);
}