How do I get a callback when the server starts?

edited October 9 in Photon Server
I'm new to Photon Server and writing my first plugin. I need to setup a lot of stuff when the server first starts that should be available to all plugin/room instances. What is the simplest way I can do this?

Comments

  • hey, hey, @HackersOnTheFly

    use your plugin factory constructor. it is called once before all plugins

    best,
    ilya
  • chvetsov wrote: »
    hey, hey, @HackersOnTheFly

    use your plugin factory constructor. it is called once before all plugins

    best,
    ilya

    I thought it was called once per plugin instantiation? Doesn't one room = one plugin instance? So in this case the plugin factory constructor would be called once for each room? I need something that is called once when the server is first started.
  • @HackersOnTheFly Plugin's constructor is called every time when room is created. PluginFactory's constructor (class that creates plugin instances) is called once

    best,
    ilya
  • edited October 16
    chvetsov wrote: »
    @HackersOnTheFly Plugin's constructor is called every time when room is created. PluginFactory's constructor (class that creates plugin instances) is called once

    best,
    ilya

    oh gotcha! Makes sense, thanks! How can I log there? Usually I would use pluginHost.LogInfo(), but pluginHost doesn't appear to be available in the PluginFactory constructor.
  • hi, @HackersOnTheFly

    there is no good way right now provided by us. only what you will find out your self

    best,
    ilya
  • JohnTubeJohnTube mod
    edited October 19
    Hi @HackersOnTheFly,

    Thank you for choosing Photon!

    If you use IFactoryPlugin2 interface from Photon Server v5 you can do more.
    Read more here.
Sign In or Register to comment.