Plugin doesn't work

hi.i have tried to use photon plugin documentation.here:
https://doc.photonengine.com/en-us/onpremise/current/plugins/manual

i have build my plugin dll and the LoadBalancing app can recognize it.and i used this code for my plugin to be simple.

using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyPlugin
{
class my_plugin : PluginBase
{
public override void OnRaiseEvent(IRaiseEventCallInfo info)
{

string hi = "hello i have called u from unity";
string filePath = "E:\\log.txt";

// flush every 20 seconds as you do it
File.AppendAllText(filePath, hi);

}

}
}


so when i use my unity app to connect to the server in loadbalancing Log plugin will be created but my code wont work.

as johntube mentioned in this tread.
https://forum.photonengine.com/discussion/10264/how-to-handle-unity-events-from-server

There is no special flow for Unity clients.
Make a plugin (start with simple one: e.g. log OnRaiseEvent calls to file)
Build it
Configure it
Start server
Connect client to server (e.g. connect from Unity Editor)
See plugin in action

i will connect my unity editor to my photon server.it will connect to master, game server , and it will create a room but nothing will happen in my text file.
and i just confused with your plugin manual's page.
so so so confusing.as there is no simple plugin app tutorial from scrach.
so can u help me to work with plugins?

i don't know how to send data from unity to plugin o plugin to unity.





Comments

  • can u plz answer my question.i cant wait for 2 days!
  • helooooooooooooooooooooooooooooooooooooooooooooooooooooo
  • Aidin0181Aidin0181
    edited March 15
    i am using PUN for unity.here is my client code:

    public virtual void OnConnectedToMaster()
    {
    Debug.Log("we succesfully joind to master");

    PhotonNetwork.CreateRoom("roomNum1");


    }

    for example


    so according to photon plugins manual when clients calls createRoom the OnCreateGame callback should be call in plugin.

    OnCreateGame(ICreateGameCallInfo info)
    Precondition: client called OpCreateRoom or OpJoinOrCreateRoom or OpJoinRoom and room cannot be found in Photon Servers memory.

    in my plugin codes i used OnCreateGame(ICreateGameCallInfo info) . and in the body i just used pluginhost.loginfo("somethin happend").but never get a log in GSGame.log .i just get a plugin created log when i join a room.
    so can u help to print a little log for this plugin.i don't want big thing.
    and please answer my question a little bit faster.


  • well in time 5:40 AM the magic things happend.i just created a new ptoject in unity and import again pun.and after writing my client code for unity withought changing the plugin codes when i start my unity editor it connect to server and when i look at my GSGame.log window,i got stunned. O_O

    somehow i got the massage hello from plugin.what exactly happend there???
  • Aidin0181Aidin0181
    edited March 15
    omg.it gone away the hello massage again.i am ..... done with your framework!!!!!!!!!!
  • hi, @Aidin0181

    We are sorry, but nobody promissed realtime support. One business day is common practice.

    As to your question about plugin. Without logs it is difficutl to say anything. Please enable debug logging for LoadBalancing. you may do this by changing appropriate log4net.config. Also you may use logging from plugin, not you hack. just write something like PhotonHost.LogError(....) from OnCreateGame hook and you will see this log in log file Plugin.log

    best,
    ilya
  • Aidin0181Aidin0181
    edited March 15
    hi @chvetsov

    i changed the log config to DEBUG,now i'm looking at GSGame.log window.it says this

    2018-03-15 17:46:53,078 [14] DEBUG Photon.Hive.Plugin.CreateGameCallInfo - Continue.

    i think it means that OnCreateGame callback has been call from plugin.
    but why didn't print this log??


    public override void OnCreateGame(ICreateGameCallInfo info)
    {
    this.PluginHost.LogDebug("hello");
    }

    i use every log properties.inclued LogError,LogInfo,Logwarning.
    nothing happend.

    so here is my GSGame.log file.plz look at it and tell me what's happening?

    s9.picofile.com/file/8321785484/GSGame.log.html

    just click on دریافت لینک دانلود and دانلود فایل
  • Aidin0181Aidin0181
    edited March 15
    and after adding these xml codes to my log4net.config in gameserver folder it just create a plugin.log file but no log message will be appear in it.


    https://doc.photonengine.com/en-us/onpremise/current/plugins/manual#log


    :neutral:
  • Aidin0181Aidin0181
    edited March 15
    well i could bring the log files to my Plugin.log

    i change

    1- logger name="Photon.Hive.HiveGame.HiveHostGame.Plugin" additivity="false"

    to this

    2- logger name="Photon.Hive.Plugin.PluginManager" additivity="false"

    because in my GSGame.log file there is no Photon.Hive.HiveGame.HiveHostGame.Plugin logger.so am i right????or i should get the 1 logger name in my log file????
  • this is my plugin log files content when i connect to server.

    2018-03-15 22:20:56,931 [24] DEBUG Photon.Hive.HivePeer - RemovePeerFromCurrentRoom: Room Reference is null for p:GameClientPeer: PID 3, IsConnected: True, IsDisposed: False, Last Activity: Operation 227 at UTC 3/15/2018 6:50:56 PM in Room , IP 192.168.43.59:60873,
    2018-03-15 22:20:56,937 [24] INFO Photon.Hive.Plugin.PluginManager - Plugin successfully created:Type:MyPlugin.PluginFactory, path:E:\Photon-OnPremise-Server-SDK_v4-0-29-11263\deploy\Plugins\my_plugin\\bin\MyPlugin.dll
    2018-03-15 22:20:56,943 [24] DEBUG Photon.Hive.Caching.RoomCacheBase - Created room instance reference: roomName=roomNum1, referenceCount=1
    2018-03-15 22:20:56,950 [24] DEBUG Photon.Hive.Plugin.CreateGameCallInfo - Continue.
    2018-03-15 22:20:56,956 [24] DEBUG Photon.Hive.HiveGame - Processing Join from IP: 192.168.43.59 to port: 5056
    2018-03-15 22:20:56,962 [24] DEBUG Photon.Hive.Collections.ActorsManager - Actor added: 1 to game: roomNum1 -- peer:GameClientPeer: PID 3, IsConnected: True, IsDisposed: False, Last Activity: Operation 227 at UTC 3/15/2018 6:50:56 PM in Room roomNum1, IP 192.168.43.59:60873,
    2018-03-15 22:20:56,967 [24] DEBUG Photon.Hive.HiveGame - JoinApplyGameStateChanges: Actor 1 is added. MasterClientId is 1
    2018-03-15 22:20:56,973 [24] DEBUG Photon.Hive.HiveGame - Created Game - name=roomNum1, lobyName=, lobbyType=Default, maxPlayers=0, IsOpen=True, IsVisible=True, EmptyRoomLiveTime=0, PlayerTTL=0, CheckUserOnJoin=True, PublishUserId=False, ExpectedUsers=
    2018-03-15 22:21:03,031 [23] DEBUG Photon.Hive.HivePeer - OnDisconnect: conId=3, reason=ClientDisconnect, reasonDetail=
    2018-03-15 22:21:03,037 [23] DEBUG Photon.Hive.HivePeer - RemovePeerFromCurrentRoom: Removing peer from room. p:GameClientPeer: PID 3, IsConnected: False, IsDisposed: False, Last Activity: Operation 227 at UTC 3/15/2018 6:50:56 PM in Room roomNum1, IP 192.168.43.59:0,
    2018-03-15 22:21:03,043 [21] DEBUG Photon.Hive.HiveGame - ProcessMessage 1
    2018-03-15 22:21:03,049 [21] DEBUG Photon.Hive.Plugin.LeaveGameCallInfo - Continue.
    2018-03-15 22:21:03,055 [21] DEBUG Photon.Hive.HiveGame - Clean up actor Actor: 1; Peer:'GameClientPeer: PID 3, IsConnected: False, IsDisposed: True, Last Activity: Operation 227 at UTC 3/15/2018 6:50:56 PM in Room roomNum1, IP 192.168.43.59:0, ', DeactivationTime:'', UserId:'',nick:'' - DeleteCacheOnLeave:
    2018-03-15 22:21:03,061 [21] DEBUG Photon.Hive.HiveGame - Actor 1 left. MasterClientId is 0
    2018-03-15 22:21:03,068 [21] DEBUG Photon.Hive.Collections.ActorsManager - Actor removed: 1 to game: roomNum1 -- peer:GameClientPeer: PID 3, IsConnected: False, IsDisposed: True, Last Activity: Operation 227 at UTC 3/15/2018 6:50:56 PM in Room roomNum1, IP 192.168.43.59:0,
    2018-03-15 22:21:03,043 [20] DEBUG Photon.Hive.Caching.RoomCacheBase - Removed room instance reference: roomName=roomNum1, referenceCount=0
    2018-03-15 22:21:03,088 [20] DEBUG Photon.Hive.Caching.RoomCacheBase - Room has no references. Tring to remove it. room:roomNum1
    2018-03-15 22:21:03,094 [20] DEBUG Photon.Hive.Caching.RoomCacheBase - Room BeforeRemoveFromCache returned 'false'. Removing stopped. room:roomNum1
    2018-03-15 22:21:03,094 [9] DEBUG Photon.Hive.Plugin.BeforeCloseGameCallInfo - Continue.
    2018-03-15 22:21:03,114 [9] DEBUG Photon.Hive.Plugin.CloseGameCallInfo - Continue.
    2018-03-15 22:21:03,119 [11] DEBUG Photon.Hive.Caching.RoomCacheBase - Removed room instance: roomId=roomNum1
    2018-03-15 22:21:03,125 [11] DEBUG Photon.Hive.Room - Tried to remove room: roomName=roomNum1, removed=True
    2018-03-15 22:21:03,132 [11] DEBUG Photon.Hive.HiveHostGame - we are actually beeing released - not sure this should be called.
  • Aidin0181Aidin0181
    edited March 15
    well i got that message my plugin at last.i just wrote in wrong file.now i can see log output.tnx
  • good that you managed to get it working.

    best,
    ilya
Sign In or Register to comment.