简体   繁体   English

Unity3d + Facebook SDK-切换场景

[英]Unity3d + Facebook SDK - Switching Scenes

Before trying to do anything stupid I wanted to ask the experts: what are the best practices on the scenario of switching scenes? 在尝试做任何愚蠢的事情之前,我想问一下专家:切换场景时的最佳实践是什么?

Does Unity3D retain the information of FB.Login() on the first scene forever, or do I need to initialize FB on every scene I loaded? 是Unity3D永远在第一个场景上保留FB.Login()的信息,还是我需要在加载的每个场景上初始化FB

Sorry to ask before testing it, I am away from my dev machine and really curious! 对不起,在测试之前,我离开了我的开发机器,真的很好奇!

I made some research and found out that if we create a static class, with a static property it will remain the same as long as the game runs. 我进行了一些研究,发现如果我们创建一个具有静态属性的静态类,则只要游戏运行,它将保持不变。

So I created 1 static class with a static property of my FacebookUser class and it remained active while switching scenes. 因此,我创建了1个静态类,其静态属性为FacebookUser类,并且在切换场景时该类保持活动状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM