Export Unity WebGL Solution

I am using Unity 5.3.3f1 Personal and I need to use the Unity Ping class ( http://docs.unity3d.com/ScriptReference/Ping.html ) in my code . Build and execute in the internal Unity Player ( http://i.stack.imgur.com/0kHmN.jpg ) is performed correctly. However, when I try to export this solution to WebGL, I get the following error:

"CS0246: Could not find the name or name of the Ping namespace. Are there any missing usage directives or assembly references?"

This is the C # source code with the corresponding Ping code:

 using UnityEngine;
 using System.Collections;
 using System.Text;
 using System.Collections.Generic;
 using LitJson;

 public class PingScript : MonoBehaviour
 {
     string Url = null, pingAddress = "192.168.0.180";

     float pingStartTime;

     // Use this for initialization
     void Start()
     {        
         CheckServerIp();
         if (Url == null)
         {                        
             pingAddress = "192.168.1.210";
             CheckServerIp();
         }
         print(Url);
     }

     // Update is called once per frame
     void Update()
     {
         if (Url != null)
         {
             //Do something
         }
     }

     void CheckServerIp()
     {
         bool internetPossiblyAvailable;
         switch (Application.internetReachability)
         {
             case NetworkReachability.ReachableViaLocalAreaNetwork:
                 internetPossiblyAvailable = true;
                 break;
             default:
                 internetPossiblyAvailable = false;
                 break;
         }
         if (!internetPossiblyAvailable)
         {
             Url = null;
         }
         Ping ping = new Ping(pingAddress);
         pingStartTime = Time.time;
         if (ping != null)
         {            
             if (ping.isDone)
             {                
                 if (ping.time >= 0)
                 {                    
                     Url = "http://" + pingAddress + ":3200/api/pumpvalues";
                 }
             }
         }
     }
 }
+4
source share
1 answer

, Unity WebGL, WWW UnityWebRequest. ping WWW, , , , .

+4

All Articles