1. I am trying to make ping to an external IP.

    Code:
    void PingGoogle(BasePlayer player)
            {
                IPAddress ip = IPAddress.Parse("google.com");
                Ping ping = new Ping();
                for (int i = 0; i < 4; i++)
                {
                    PingReply pr = ping.Send(ip);
                }
            }
    Code:
    error CS1061: Type `UnityEngine.Ping' does not contain a definition for `Send' and no extension method `Send' of type `UnityEngine.Ping' could be found. Are you missing an assembly reference?
     
  2. Wulf

    Wulf Community Admin

    You need to define where Ping is coming from, as it thinks you are trying to get it from UnityEngine.dll, but it can't find any method called "Send" under there.
     
  3. You mean that I am missing a using reference?
     
  4. Wulf

    Wulf Community Admin

    I'm saying where is Send for Ping supposed to come from? The error is saying it can't find where you expect it to be, it's not in the only reference your plugin is making to UnityEngine.dll.
     
  5. I guess Ping come from "System.Net.NetworkInformation" but I am a little confused.
     
  6. Wulf

    Wulf Community Admin

    I don't think you can access that in plugins due to the sandbox, but if you could, you'd need to add a using statement and/or specify that inline as the compiler thinks it is coming from UnityEngine.
     
  7. You are right. Now I see it's impossible haha.

    I did use alies for the ambiguous using refence, but the problem is that you can't acess System.Net.NetworkInformation.

    Well, at least I tried. :p
     
  8. Wulf

    Wulf Community Admin

    What are you trying to get the ping for?
     
  9. I have a big system (not that big) that connect's my web with external mysql and rust server, and I have a timer that show info about server state like server fps, client fps, tickrate, and ping. It's a very nice system that players love but sometimes my website gets overloaded and ping goes high, so I was trying to get the website ping by rust server side, but I think I can do that otherwise. It was just a whim.
     
  10. Wulf

    Wulf Community Admin

    Unity - Scripting API: Ping.Ping should work.