I maked two appication for chating. server and client application.
It works no problem. But, When server lost focus, client cannot connect with server.
So, I find this function and use it. ‘Application.runInBackground = true;’
But still have same problem.
Please help me.
P.S. server maked ‘for Standalone’ and client maked ‘for Web player’.
did not have any problem running the server in background, neither with the graphical one nor with the non-graphics one.
did you ensure that your server has code that runs on his own and does not require userinput?
by the way: you can set the run in background in the player settings already
private var textcont = "Start server :\n";
private var PlayerCount : int = 0;
function Awake()
{
Application.runInBackground = true;
}
function Start()
{
Network.InitializeSecurity();
Network.incomingPassword = "password";
Network.InitializeServer(16,26002);
}
function Update () {
}
function OnGUI()
{
textcont = GUI.TextArea(Rect(0,0,800,600), textcont);
}
function OnPlayerConnected( player : NetworkPlayer )
{
PlayerCount++;
textcont = textcont + "New Player(" + player.ipAddress + ") - Total" +
PlayerCount + " Users\n";
}
function OnPlayerDisonnected( player : NetworkPlayer )
{
PlayerCount--;
textcont = textcont + "Logout Player(" + player.ipAddress + ") - Total" +
PlayerCount + " Users\n";
Network.RemoveRPCs(player);
Network.DestroyPlayerObjects(player);
}
function AddChat( username : String, chatstring : String )
{
textcont += "User talk : "+username+" :"+chatstring+"\n";
}
@RPC
function Chatting_Receive( otheruser : String, chatstring : String )
{
AddChat( otheruser, chatstring );
}
If server window focus, no problem. If server window not focus, client cannot connect. ^^; Please help me more.