base vs info.Continue()
Options
fake
✭
Hello, i'm reading about plugins and have a simple question. What's the difference between this:
And this:
In manual are examples with info.Continue() processing while TestPlugins in Server SDK uses base.OnCreateGame(info); calls. In case i want to broadcast new event and after this process callback by default, should i use base or info.Continue() and is there is even any difference at all? Thanks.
public override void OnCreateGame(ICreateGameCallInfo info)
{
base.OnCreateGame(info);
}
And this:
public override void OnCreateGame(ICreateGameCallInfo info)
{
info.Continue();
}
In manual are examples with info.Continue() processing while TestPlugins in Server SDK uses base.OnCreateGame(info); calls. In case i want to broadcast new event and after this process callback by default, should i use base or info.Continue() and is there is even any difference at all? Thanks.
0
Comments
-
Hi @fake,
Thank you for choosing Photon!
If the base class isPluginBase
then those two calls are identical.
This question is answered in the FAQ:When overriding callback methods of PluginBase, do I need to call base.XXX()?
All callback methods inside PluginBase include a call to Continue() at the end. The idea is that by inheriting from the PluginBase you only have to override the methods you are interested in. Sometimes you just need to add extra code after or before base.XXX() and sometimes you need to change the default behavior completely. In the first case, you should not add any call to the ICallInfo processing methods. In the second case, you should not call base.XXX(), make your own implementation of the method from scratch then add a call to one of the available ICallInfo processing methods. There is one exception though, which is PluginBase.OnLeave. This method will handle MasterClient change in case the current one is leaving.0