Home Forums Support Example of Unity3D development

Tagged: 

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #4412
    Anonymous
    Inactive

    The Unity3D – android platform example is appreciate.

    After test the code using Unity3d in PC , the client code works.But after building of app and attach the app to android device,the app crash after pressing the button. this is the code on client.

    
    using UnityEngine;
    using NetworkCommsDotNet;
    using NetworkCommsDotNet.Connections;
    using NetworkCommsDotNet.Connections.TCP;
    public class NetworkTest : MonoBehaviour {
    
        public void StartClient()
        {
            string serverIP = "192.168.1.104";
            int serverPort = 10000;
    
            ConnectionInfo connInfo = new ConnectionInfo(serverIP, serverPort);
    
            Connection newTCPConn = TCPConnection.GetConnection(connInfo);
            int loopCounter = 1;
            string messageToSend = "This is message " + loopCounter;
            NetworkComms.SendObject("Message", serverIP, serverPort, messageToSend);  
        }
    
        void OnGUI()
        {
            if(GUILayout.Button("Hello", GUILayout.Width(300),
            GUILayout.Height(300)))
            {
                StartClient();
            }
        }
    }
    
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.