C# 在Unity网络中执行命令时发出权限警告

C# 在Unity网络中执行命令时发出权限警告,c#,unity3d,unity3d-unet,C#,Unity3d,Unity3d Unet,我在执行[Command]时收到有关权限的警告消息,但我找不到该警告的来源。当我拖动一个对象时,我得到了这个 a) 我不明白为什么以及从哪里得到警告信息 b) 我不明白为什么它不是localplayer,并且第二次拥有权限 c) 我不明白为什么当localplayer和hasauthority为false时yt为“0” 如果有人能给我解释一下,我会非常感激的?给我解释一下 我使用EasyTouch进行触摸 //===========================================

我在执行[Command]时收到有关权限的警告消息,但我找不到该警告的来源。当我拖动一个对象时,我得到了这个

a) 我不明白为什么以及从哪里得到警告信息

b) 我不明白为什么它不是localplayer,并且第二次拥有权限

c) 我不明白为什么当localplayer和hasauthority为false时yt为“0”

如果有人能给我解释一下,我会非常感激的?给我解释一下

我使用EasyTouch进行触摸

//======================================================================//
//                                                                        //
//                               On_DragStart                                //
//                                                                        //
//======================================================================//

public void On_DragStart (Gesture gesture) {

    print ("On_DragStart");
    if (!isLocalPlayer) 
        return;

    if (!hasAuthority)
        return;

    if (selected_GO == null)
        return;

//        Cmd_SetAuthority(selected_GO.GetComponent<NetworkIdentity>().netId, gameObject.GetComponent<NetworkIdentity>());

}
private bool firstLoop = true;
private int yt = 0;
//======================================================================//
//                                                                        //
//                                  On_Drag                                //
//                                                                        //
//======================================================================//

public void On_Drag (Gesture gesture) {
//        print ("On_Drag");

    print ("a) " + yt + " isLocalPlayer: " + isLocalPlayer);

    if (!isLocalPlayer)
        return;

    print ("b) " + yt + " hasAuthority: " + hasAuthority);

    if (!hasAuthority)
        return;
    print ("c) " + yt + " selected_GO: " + selected_GO.name);

    if (selected_GO == null)
        return;
    print ("d) " + yt);

    if (firstLoop) {
        print ("e) " + yt);
        if (selected_GO.GetComponent<NetworkIdentity> ().hasAuthority == false) {
            print ("f) " + yt);
            var networkIdentity = selected_GO.GetComponent<NetworkIdentity>();
            var otherOwner = networkIdentity.clientAuthorityOwner;      

            networkIdentity.RemoveClientAuthority(otherOwner);  
        }


        print ("g) " + yt);

    }

    // Only allow drag if player own object
    if (selected_GO.GetComponent<NetworkIdentity> ().hasAuthority == true) {
        // Check if there have been a linecast, if so use that Game Object for drag
        print ("h) " + yt);

        if (selected_GO != null) {

            print ("i) " + yt);
            selected_GO.transform.position = Camera.main.ScreenToWorldPoint (new Vector3 (gesture.position.x, gesture.position.y, 1f));
        } else if (gesture.pickedObject != null) {
            print ("j) " + yt);

            gesture.pickedObject.transform.position = Camera.main.ScreenToWorldPoint (new Vector3 (gesture.position.x, gesture.position.y, 1f));
        }
    }
    print ("k) " + yt);
    yt++;
}

//======================================================================//
//                                                                        //
//                               On_DragEnd                                //
//                                                                        //
//======================================================================//

public void On_DragEnd (Gesture gesture) {
    print ("On_DragEnd");
    if (!isLocalPlayer && !hasAuthority) 
        return;

    if (selected_GO == null)
        return;

    if (containerMode) {
        DisableParentChildRelationship (_syncEngine.cardNames_SList);

        // Color all cards in container white to show that this is not a container anylonger
        foreach (string aSTR in _syncEngine.cardNames_SList) {
            temp_GO = GameObject.FindWithTag (aSTR);
            Cmd_Paint (temp_GO, Color.white);
        }
    } else {
        if (selected_GO.GetComponent<NetworkIdentity> ().hasAuthority == true) {
            Cmd_SetAuthority(selected_GO.GetComponent<NetworkIdentity>().netId, gameObject.GetComponent<NetworkIdentity>());
        }
    }


} 

警告是什么?什么对象具有id 9?看起来这没有权威,并且试图做些什么。这是“_H4_Gun”,这是一件奇怪的事情,因为我找不到这个警告是从哪里来的。正如我所看到的,它应该在这段代码中,因为我只是在这种情况下拖动??
On_DragStart
On_DragStart
a) 0 isLocalPlayer: True
b) 0 hasAuthority: True
c) 0 selected_GO: _H4_Gun
d) 0
e) 0
f) 0
g) 0
h) 0
i) 0
k) 0
a) 0 isLocalPlayer: False
Command for object without authority [netId=9]
Command for object without authority [netId=9]
Command for object without authority [netId=9]
Command for object without authority [netId=9]
a) 1 isLocalPlayer: True
b) 1 hasAuthority: True
c) 1 selected_GO: _H4_Gun
d) 1
h) 1
i) 1
k) 1
a) 0 isLocalPlayer: False
Command for object without authority [netId=9]
Command for object without authority [netId=9]
a) 2 isLocalPlayer: True
b) 2 hasAuthority: True
c) 2 selected_GO: _H4_Gun
d) 2
h) 2
i) 2
k) 2
a) 0 isLocalPlayer: False
a) 3 isLocalPlayer: True
b) 3 hasAuthority: True
c) 3 selected_GO: _H4_Gun
d) 3
h) 3
i) 3
k) 3
…etc.