《UnityAPI.Network网络》(Yanlz+Unity+SteamVR+云技术+5G+AI+VR云游戏+Network+isClient+Connect+Server+立钻哥哥++OK++)

《UnityAPI.Network网络》

《UnityAPI.Network网络》(Yanlz+Unity+SteamVR+云技术+5G+AI+VR云游戏+Network+isClient+Connect+Server+立钻哥哥++OK++)_第1张图片

版本

作者

参与者

完成日期

备注

UnityAPI_Network_V01_1.0

严立钻

 

2020.06.16

 

 

 

 

 

 

 

#《UnityAPI.Network网络》发布说明:

++++“UnityAPI.Network网络是对UnityAPINetwork网络类的剖析和拓展

立钻哥哥:Unity是一个入门快、提高难的游戏引擎,想要提升能力,至少需要越过3道坎:API+Shader+综合能力

++1、API的积累:API的合理利用不仅可以减轻自己的编码负担,而且往往可以提高程序的运行效率;这也是钻哥开始“Unity API”独立打造分类的初衷

++2、Shader编程:想要做出一款精品游戏往往需要有高效的Shader的支持;Unity提供了一套改良的“Shader Lab”系统,优化了繁杂的“Open GL”编程

++3、综合能力(技术+业务+管理):一款产品的制作除了功能编程外,往往会涉及很多其他领域,例如产品架构、UI交互设计、模型制作等,作为主要的编程人员,对其他相关领域的了解程序往往会影响到产品制作直至最后的产品体验

++++立钻哥哥一直在推动【VR云游戏=Unity+SteamVR+云技术+5G+AI,这个只是一个引子,抛砖引玉让大家对整个知识体系有一个明确的落地方向,宝宝们可以根据自己的兴趣方向进行拓展:比如Unity这里是指一种“3D游戏引擎”,也可拓展至“UE4Cocos2dx”等游戏引擎;SteamVR是一种跨硬件解决方案,也可拓展至“VRTK”等第三方插件;“云技术+5G”是一种跨平台解决方案的核心技术,同样可拓展至其他平台解决方案;AI也是一种先进技术的举例,也可以拓展至任何一种前沿技术

 

 

@@提示:有些博客可能只是开了头,如果感兴趣的同学,可以“点赞”或“评论区留言”,只要关注的同学多了,那就会继续完善哟!(“++==”,表示没有写完的,如果关注度不高就不完善了;“++ok++”,表示此篇博客已经完成,是阶段性完整的!)

 

$$$$博客溯源:

《UnityAPI.Network网络》(Yanlz+Unity+SteamVR+云技术+5G+AI+VR云游戏+Network+isClient+Connect+Server+立钻哥哥++OK++)_第2张图片

 

++++VR云游戏=Unity+SteamVR+云技术+5G+AI;(说明:AI人工智能不是我们的主要研究技术,只是了解一下,领略一下有风的感觉!但是,VR是我们的研究重点

++++【Unity API】分类:https://blog.csdn.net/vrunsoftyanlz/category_7637520.html

++++【Unity开发基础】分类:https://blog.csdn.net/vrunsoftyanlz/category_7309057.html

++++【Linux系统编程】分类:https://blog.csdn.net/vrunsoftyanlz/category_9694767.html

++++【C++C铸就生存利器】分类:https://blog.csdn.net/vrunsoftyanlz/category_9325802.html

++++【人工智能AI2026】分类:https://blog.csdn.net/vrunsoftyanlz/category_9212024.html

++++【立钻哥哥CSDN空间】:https://blog.csdn.net/VRunSoftYanlz/

 

 

 

 

 

 

 

#Network网络

#Network网络

#Network网络

++A1、Description描述

++B2、Variables变量

++C3、Public Function共有函数

++D4、Message消息

《UnityAPI.Network网络》(Yanlz+Unity+SteamVR+云技术+5G+AI+VR云游戏+Network+isClient+Connect+Server+立钻哥哥++OK++)_第3张图片

 

 

 

 

 

#A1、Description描述

#A1、Description描述

++A1、Description描述

++++立钻哥哥:Network(网络)是网络实现的核心并提供核心函数

++++[namespace]:UnityEngine

++++[Inherits from]

++++Network类配置了网络接口和所有网络参数;可以使用它来设置一个服务器或连接到一个服务器并有一些辅助函数来帮助完成这些功能;

++++【Unity API】分类:https://blog.csdn.net/vrunsoftyanlz/category_7637520.html

++++[Unity快速入门]:https://blog.csdn.net/VRunSoftYanlz/article/details/105776475

++++[UnityAPI目录]:https://blog.csdn.net/VRunSoftYanlz/article/details/106533906

++++[Application应用]:https://blog.csdn.net/VRunSoftYanlz/article/details/106086327

++++[Object对象]:https://blog.csdn.net/VRunSoftYanlz/article/details/106202194

++++[GameObject]:https://blog.csdn.net/VRunSoftYanlz/article/details/106223815

++++[MonoBehaviour]:https://blog.csdn.net/VRunSoftYanlz/article/details/106533256

++++[Component组件]:https://blog.csdn.net/VRunSoftYanlz/article/details/106367004

++++[Transform变换]:https://blog.csdn.net/VRunSoftYanlz/article/details/106607761

++++[Camera摄像机]:https://blog.csdn.net/VRunSoftYanlz/article/details/106148837

++++[Shader着色器]:https://blog.csdn.net/VRunSoftYanlz/article/details/106321040

++++[Material材质]:https://blog.csdn.net/VRunSoftYanlz/article/details/81814303

++++[Physics物理]:https://blog.csdn.net/VRunSoftYanlz/article/details/106268062

++++[Collider碰撞器]:https://blog.csdn.net/VRunSoftYanlz/article/details/106696886

++++[Rigidbody刚体]:https://blog.csdn.net/VRunSoftYanlz/article/details/106698042

++++[RaycastHit]:https://blog.csdn.net/VRunSoftYanlz/article/details/106292370

++++[ParticleSystem]:https://blog.csdn.net/VRunSoftYanlz/article/details/106341995

++++[WWW万维网]:https://blog.csdn.net/VRunSoftYanlz/article/details/106412890

++++[LineRenerer]:https://blog.csdn.net/VRunSoftYanlz/article/details/106306388

++++[WheelCollider]:https://blog.csdn.net/VRunSoftYanlz/article/details/82356217

++++[MovieTexture]:https://blog.csdn.net/VRunSoftYanlz/article/details/106434063

 

 

 

 

 

 

 

#B2、Static Variables静态变量

#B2、Static Variables静态变量

++B2、Static Variables静态变量

++++B2.1、connections

++++B2.2、connectionTesterIP

++++B2.3、connectionTesterPort

++++B2.4、incomingPassword

++++B2.5、isClient

++++B2.6、isMessageQueueRunning

++++B2.7、isServer

++++B2.8、logLevel

++++B2.9、maxConnections

++++B2.10、minimumAllocatableViewIDs

++++B2.11、natFacilitatorIP

++++B2.12、natFacilitatorPort

++++B2.13、peerType

++++B2.14、player

++++B2.15、proxyIP

++++B2.16、proxyPassword

++++B2.17、proxyPort

++++B2.18、sendRate

++++B2.19、time

++++B2.20、useProxy

++++B2.21、YanlzXREngine.Network.StaticVariables

《UnityAPI.Network网络》(Yanlz+Unity+SteamVR+云技术+5G+AI+VR云游戏+Network+isClient+Connect+Server+立钻哥哥++OK++)_第4张图片

 

 

++B2.1、connections

++B2.1、connections

++B2.1、connections

++++立钻哥哥:连接列表

public static NetworkPlayer[] connections;

++++所有连接的玩家

++++在客户端中,该变量只包含服务器

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void OnGUI(){

        if(GUILayout.Button(立钻哥哥:Disconnect first player.)){

            if(Network.connections.Length > 0){

                Debug.Log(立钻哥哥:Disconnecting:  + Network.connections[0].ipAddress + : + Network.connections[0].port);

                Network.CloseConnection(Network.connections[0], true);

            }    //立钻哥哥:if(Network.connections.Length > 0){}

        }    //立钻哥哥:if(GUILayout.Button()){}

    }    //立钻哥哥:void OnGUI(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++B2.2、connectionTesterIP

++B2.2、connectionTesterIP

++B2.2、connectionTesterIP

++++立钻哥哥:连接测试IP

public static string connectionTesterIP;

++++用在Network.TestConnection中的连接测试的IP地址

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void MyResetIP(){

        Network.connectionTesterIP = 127.0.0.1;

        Network.connectionTesterPort = 10000;

    }    //立钻哥哥:void ResetIP(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++B2.3、connectionTesterPort

++B2.3、connectionTesterPort

++B2.3、connectionTesterPort

++++立钻哥哥:连接测试接口

public static int connectionTesterPort;

++++用在Network.TestConnection中的连接测试的接口

 

 

 

 

 

++B2.4、incomingPassword

++B2.4、incomingPassword

++B2.4、incomingPassword

++++立钻哥哥:入站密码

public static string incomingPassword;

++++为服务器设置密码(入站连接)

++++这个必须与客户端上Network.Connect中的相同,传递“”表示没有密码(默认

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void MyConnectToServer(){

        Network.Connect(127.0.0.1, 25000, YanlzGameServ);

    }    //立钻哥哥:void ConnectToServer(){}

 

    void MyLaunchServer(){

        Network.incomingPassword = Helloi360Game;

        Network.InitializeServer(32, 25000);

    }    //立钻哥哥:void MyLaunchServer(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++B2.5、isClient

++B2.5、isClient

++B2.5、isClient

++++立钻哥哥:是否客户端

public static bool isClient;

++++如果端点类型是客户端,返回true

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void OnGUI(){

        if(Network.isServer){

            GUILayout.Label(立钻哥哥:Running as a server.);

        }else{

            if(Network.isClient){

                GUILayout.Label(立钻哥哥:Running as a client.);

            }    //立钻哥哥:if(Network.isClient){}

        }    //立钻哥哥:if(Network.isServer){}

    }    //立钻哥哥:void OnGUI(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++B2.6、isMessageQueueRunning

++B2.6、isMessageQueueRunning

++B2.6、isMessageQueueRunning

++++立钻哥哥:是否消息队列运行

public static bool isMessageQueueRunning;

++++启用或禁用网络消息处理

++++如果这个被禁用,没有RPC调用或网络视图同步会替代

 

 

 

 

 

++B2.7、isServer

++B2.7、isServer

++B2.7、isServer

++++立钻哥哥:是否是服务器

public static bool isServer;

++++如果端点类型是服务器,返回true

 

 

 

 

 

++B2.8、logLevel

++B2.8、logLevel

++B2.8、logLevel

++++立钻哥哥:日志级别

public static NetworkLogLevel logLevel;

++++设置用于网络消息的日志级别(默认是关闭的);也就是说用于调整记录日志中信息的详细程度

++++用于不同日志级别的描述,看NetworkLogLevel枚举设置

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void Start(){

        Network.logLevel = NetworkLogLevel.Full;

    }    //立钻哥哥:void Start(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++B2.9、maxConnections

++B2.9、maxConnections

++B2.9、maxConnections

++++立钻哥哥:最大连接数

public static int maxConnections;

++++设置允许连接(玩家)的最大数量

++++设置0,意味着没有新的连接可以被建立,但现有保持连接;设置为-1表示最大连接数,设置为与当前开发的连接数相同;在这种情况下,如果一个玩家掉线,那么这个空位还是为它开放的;这个不能设置为高于Network.InitializeServer设置的连接数

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void StartMyGameNow(){

        Network.maxConnections = -1;

    }    //立钻哥哥:void StartMyGameNow(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++B2.10、minimumAllocatableViewIDs

++B2.10、minimumAllocatableViewIDs

++B2.10、minimumAllocatableViewIDs

++++立钻哥哥:可分配最小ViewID数

public static int minimumAllocatableViewIDs;

++++ViewID池中获取或设置由服务器分配给客户端ViewID的最小数

++++当玩家使用新的数字连接并被刷新时,ViewID池被分配给每个玩家;服务器和客户端应该同步这个值;在服务器上设置的更高,将会发送比它们真正需要的更多视图ID数到客户端;在客户端上设置更高,意味着它们需要更多视图ID;例如当池需要的ID数,服务器中并不包含足够的数量,则会在一行中使用两次;默认值为100

++++如果一个游戏通过网络实例化大量新的物体,例如每秒超过100个的网络实例,那么这个值需要被设置的更高

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void Awake(){

        Network.minimumAllocatableViewIDs = 500;

    }    //立钻哥哥:void Awake(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++B2.11、natFacilitatorIP

++B2.11、natFacilitatorIP

++B2.11、natFacilitatorIP

++++立钻哥哥:穿透的IP

public static string natFacilitatorIP;

++++用在Network.TestConnection中的连接测试的IP地址

++++通常这与主服务器相同

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void MyResetIP(){

        Network.natFacilitatorIP = 127.0.0.1;

        Network.natFacilitatorPort = 10001;

    }    //立钻哥哥:void MyResetIP(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++B2.12、natFacilitatorPort

++B2.12、natFacilitatorPort

++B2.12、natFacilitatorPort

++++立钻哥哥:穿透的端口

public static int natFacilitatorPort;

++++Facilitator NAT穿透的端口

 

 

 

 

 

++B2.13、peerType

++B2.13、peerType

++B2.13、peerType

++++立钻哥哥:端类型

public static NetworkPeerType peerType;

++++端类型的状态,即disconnected, connecting, serverclient四种

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void OnGUI(){

        if(Network.peerType == NetworkPeerType.Disconnected){

            GUILayout.Label(立钻哥哥:No Connected.);

        }else{

            if(Network.peerType == NetworkPeerType.Connecting){

                GUILayout.Label(立钻哥哥:Not Connected.);

            }else{

                GUILayout.Label(立钻哥哥:Network started.);

            } //立钻哥哥:if(Network.peerType==NetworkPeerType.Connecting){}else{}

        }    //立钻哥哥:if(Network.peerType == NetworkPeerType.Disconnected){}else{}

    }    //立钻哥哥:void OnGUI(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++B2.14、player

++B2.14、player

++B2.14、player

++++立钻哥哥:玩家

public static NetworkPlayer player;

++++获取本地NetworkPlayer实例

 

 

 

 

 

++B2.15、proxyIP

++B2.15、proxyIP

++B2.15、proxyIP

++++立钻哥哥:代理IP

public static string proxyIP;

++++代理服务器的IP地址

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void Awake(){

        Network.proxyIP = 1.1.1.1;

        Network.proxyPort = 1111;

    }    //立钻哥哥:void Awake(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++B2.16、proxyPassword

++B2.16、proxyPassword

++B2.16、proxyPassword

++++立钻哥哥:代理密码

public static string proxyPassword;

++++设置代理服务器的密码

++++这可能制作自己的自定义代理服务器;在这种情况下,也许想用密码保护它;然后Unity玩家必须正确的设置这个值

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void Awake(){

        Network.proxyIP = 1.1.1.1;

        Network.proxyPort = 1111;

        Network.proxyPassword = YanlzTest;

    }    //立钻哥哥:void Awake(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++B2.17、proxyPort

++B2.17、proxyPort

++B2.17、proxyPort

++++立钻哥哥:代理端口

public static int proxyPort;

++++代理服务器的端口

 

 

 

 

 

++B2.18、sendRate

++B2.18、sendRate

++B2.18、sendRate

++++立钻哥哥:发送速率

public static float sendRate;

++++用于所有网络视图,网络更新的默认发送速率

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void Awake(){

        Network.sendRate = 25;

    }    //立钻哥哥:void Awake(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++B2.19、time

++B2.19、time

++B2.19、time

++++立钻哥哥:时间

public static double time;

++++获取带当前网络时间(秒)

++++这个可以用来,例如,比较NetworkMessageInfo中返回的时间;这个脚本例子需要附加到一个带有网络视图的物体上,并使网络视图监视这个脚本;它计算时间,发送这个物体的同步X位置消息

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

    public float something;

    public double transitTime;

 

    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info){

        float horizontalInput = 0.0F;

 

        if(stream.isWriting){

            horizontalInput = transform.position.x;

            stream.Serialize(ref horizontalInput);

        }else{

            transitTime = Network.time - info.timestamp;

            stream.Serialize(ref horizontalInput);

            something = horizontalInput;

        }    //立钻哥哥:if(stream.isWriting){}else{}

    }    //立钻哥哥:void OnSerializeNetworkView(){}

 

    void OnGUI(){

        GUILayout.Label(立钻哥哥:Last transmission time:  + transitTime);

    }    //立钻哥哥:void OnGUI(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++B2.20、useProxy

++B2.20、useProxy

++B2.20、useProxy

++++立钻哥哥:使用代理

public static bool useProxy;

++++表示是否需要代理支持,在这种情况下,流量通过代理服务器传递

++++代理服务器是一种与服务器和客户端连接问题的解决方案;当机器有一个非NAT穿透能力的路由器,其连接的选择非常优先;一个游戏不能没有外部连接(只可以客户端在本地网络);通过使用代理服务器,该机器可以具有完全的连接性,但是额外的成本是所有的流量都会通过另一台服务器传递;一个没有NAT穿透能力的客户端通过代理能够连接到任何服务器,只要在代理服务器设置正确

++++Unity并不提供代理服务器为公众使用;所以需要自己建立代理服务器;当然,用公有IP地址设置代理服务器并保证有大量可用带宽是明智的

++++当作为客户端运行时,只要启用Network.useProxy就可以;像通常使用Network.Connect()连接到服务器;所有浏览通过代理服务器传递;服务器的外部IP和内部IP还像往常一样工作;这样如果它们位于同一网络宏,客户端可直接连接而不经过代理

++++作为一个服务器运行时,OnServerInitialized(NetworkPlayer)返回一个NetworkPlayer结构,表示游戏服务器中继的IP/端口,即,代理服务器分配给游戏服务器的端口是什么;这个是其他客户端可以连接的IP/端口;当连接到服务器时,客户端不会将这个服务器与其他服务器区别对待;严格地说,它们不需要知道这个服务器得到代理服务器的帮助

++++当使用主服务器时,使用代理支持,不能只依赖于为服务器IP/端口注册;服务器使用的代理服务器的IP地址和端口,可以设置在数据域的注释中来发送给主服务器;从主服务器接收主机信息的客户端可以去除注释域并查看它是否能够为那个主机使用另一个可选的IP端口

++++主要事项:不应该同时为连接到它的服务器和客户端启用代理支持,会发生意想不到的事情

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

    public bool imaserver;

    public string serverIP;

    public int serverPort;

    public bool serverUsesNAT;

 

    void Awake(){

        Network.proxyIP = 1.1.1.1;

        Network.proxyPort = 1111;

 

        if(imaserver){

            StartMyServerWithProxy();

        }else{

            ConnectToMyServerWithProxy();

        }    //立钻哥哥:if(imaserver){}else{}

    }    //立钻哥哥:void Awake(){}

 

    void StartMyServerWithProxy(){

        Network.useProxy = true;

        Network.InitializeServer(2, 25000, false);

    }    //立钻哥哥:void StartMyServerWithProxy(){}

 

    void OnMyServerInitialized(NetworkPlayer player){

        if(Network.useProxy && imaserver){

            Debug.LogError(立钻哥哥:Failed to connect to proxy server:  + msg);

        }    //立钻哥哥:if(Network.useProxy){}

    }    //立钻哥哥:void OnServerInitialized(){}

 

    void ConnectToMyServerWithProxy(){

        Network.useProxy = true;

        Network.Connect(serverIP, serverPort);

    }    //立钻哥哥:void ConnectToMyServerWithProxy(){}

 

    void OnConnectedToMyServer(){

        Debug.Log(立钻哥哥:Connected successfully to server.);

    }    //立钻哥哥:void OnConnectedToMyServer(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

 

 

#C3、Static Functions静态函数

#C3、Static Functions静态函数

++C3、Static Functions静态函数

++++C3.1、AllocateViewID

++++C3.2、CloseConnection

++++C3.3、Connect

++++C3.4、Destroy

++++C3.5、DestroyPlayerObjects

++++C3.6、Disconnect

++++C3.7、GetAveragePing

++++C3.8、GetLastPing

++++C3.9、HavePublicAddress

++++C3.10、InitializeSecurity

++++C3.11、InitializeServer

++++C3.12、Instantiate

++++C3.13、RemoveRPCs

++++C3.14、RemoveRPCsInGroup

++++C3.15、SetLevelPrefix

++++C3.16、SetReceivingEnabled

++++C3.17、SetSendingEnabled

++++C3.18、TestConnection

++++C3.19、TestConnectionNAT

++++C3.20、YanlzXREngine.Network.StaticFunctions

《UnityAPI.Network网络》(Yanlz+Unity+SteamVR+云技术+5G+AI+VR云游戏+Network+isClient+Connect+Server+立钻哥哥++OK++)_第5张图片

 

 

++C3.1、AllocateViewID

++C3.1、AllocateViewID

++C3.1、AllocateViewID

++++立钻哥哥:分配网络视图ID

public static NetworkViewID AllocateViewID();

++++查询下一个可用的网络视图ID号并分配它(保留)

++++这个数字可以被分配到一个实例化物体的网络视图;注意:为了可以正常工作,必须有一个NetworkView附加到有这个脚本的物体,并且这个脚本作为它的观察属性;必须有一个Cube预设,带有一个NetworkView监视某个东西(如CubeTransform);脚本中的cubePrefab变量必须设置为cube预设;使用智能的AllocateViewID是最简单的方法;如果有超过一个NetworkView附加在初始化的Cube上将变得更复杂

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

    public Transform cubePrefab;

    public NetworkView nView;

 

    void Start(){

        nView = GetComponent<NetworkView>();

    }    //立钻哥哥:void Start(){}

 

    void OnGUI(){

        if(GUILayout.Button(YanlzSpawnBox)){

            NetworkViewID viewID = Network.AllocateViewID();

            nView.RPC(YanlzSpawnBox, RPCMode.AllBuffered, viewID, transform.position);

        }    //立钻哥哥:if(GUILayout.Button()){}

    }    //立钻哥哥:void OnGUI(){}

 

    [RPC]

    void YanlzSpawnBox(NetworkViewID viewID, Vector3 location){

        Transform clone;

        clone = Instantiate(cubePrefab, location, Quaternion.identity) as Transform;

 

        NetworkView nView;

        nView = clone.GetComponent<NetworkView>();

        nView.viewID = viewID;

    }    //立钻哥哥:void SpawnBox(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++C3.2、CloseConnection

++C3.2、CloseConnection

++C3.2、CloseConnection

++++立钻哥哥:关闭连接

public static void CloseConnection(NetworkPlayer target, bool sendDisconnectionNotification);

++++关闭与其他系统的连续

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void OnGUI(){

    

        if(GUILayout.Button(立钻哥哥:Disconnect form server.)){

            Debug.Log(立钻哥哥:Disconnecting:  + Network.connections[0].ipAddress + : + Network.connections[0].port);

            Network.CloseConnection(Network.connections[0], true);

        }else{

            if(Network.connections.Length == 0){

                Debug.Log(立钻哥哥:No one is connected.);

            }else{

                if(Network.connections.Length > 1){

                    Debug.Log(立钻哥哥:Too many connections. Are we running a server?);

                }    //立钻哥哥:if(Network.connections.Length > 1){}

            }    //立钻哥哥:if(Network.connections.Length == 0){}else{}

        }    //立钻哥哥:if(GUILayout.Button(Disconnect form server)){}else{}

 

        if(GUILayout.Button(立钻哥哥:Disconnect first player.)){

            if(Network.connections.Length > 0){

                Debug.Log(立钻哥哥:Disconnecting:  + Network.connections[0].ipAddress + : + Network.connections[0].port);

                Network.CloseConnection(Network.connections[0], true);

            }    //立钻哥哥:if(Network.connections.Length>0){}

        }    //立钻哥哥:if(GUILayout.Button(立钻哥哥:Disconnect first player.)){}

 

    }    //立钻哥哥:void OnGUI(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++C3.3、Connect

++C3.3、Connect

++C3.3、Connect

++++立钻哥哥:连接

public static NetworkConnectionError Connect(string IP, int remotePort, string password=””);

public static NetworkConnectionError Connect(string[] IPs, int remotePort, string password=””);

public static NetworkConnectionError Connect(string GUID, string password=””);

public static NetworkConnectionError Connect(HostData hostData, string password=””);

++++连接到特定的主机(IP或域名)和服务器端口

++++参数是主机的IP地址,无论是带点的IP地址或域名;remotePort,指定连接到远端及其的端口;password是一个可选的用于服务器的密码;这个密码必须匹配Network.incomingPassword在服务器的设置

++++可以接受一个IP地址数组

++++可以用于当一个主服务器的主机信息返回多个内部IP地址时,IP数据结构可以被直接传入这个函数;它实际连接到相应ping的第一个IP(可连接)

++++连接到一个服务器GUIDNAT穿透只能在这种方式执行;主机的GUID值,通过NetworkPlayer结构暴露在本地;主服务器还提供这个在HostData结构

++++连接到主机,通过主服务器由一个HostData结构返回

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void ConnectToMyServer(){

        Network.Connect(127.0.0.1, 25000);

    }    //立钻哥哥:void ConnectToMyServer(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++C3.4、Destroy

++C3.4、Destroy

++C3.4、Destroy

++++立钻哥哥:销毁

public static void Destroy(NetworkViewID viewID);

public static void Destroy(GameObject gameObject);

++++跨网络销毁与该viewID相关的物体

++++本地的和远端的都会被销毁

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

    public float timer = 0;

 

    void Awake(){

        timer = Time.time;

    }    //立钻哥哥:void Awake(){}

 

    void Update(){

        if(Time.time - timer > 2){

            Network.Destroy(GetComponent<NetworkView>().viewID);

            //Network.Destroy(gameObject);

        }    //立钻哥哥:if(Time.time-timer>2){}

    }    //立钻哥哥:void Update(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++C3.5、DestroyPlayerObjects

++C3.5、DestroyPlayerObjects

++C3.5、DestroyPlayerObjects

++++立钻哥哥:销毁玩家物体

public static void DestroyPlayerObjects(NetworkPlayer playerID);

++++基于viewID销毁所有属于这个玩家的所有物体

++++这个只能在服务器上调用;例如,清理一个已断开的玩家留下的网络物体

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void OnPlayerDisconnected(NetworkPlayer player){

        Debug.Log(立钻哥哥:Clean up after player  + player);

 

        Network.RemoveRPCs(player);

        Network.DestroyPlayerObjects(player);

    }    //立钻哥哥:void OnPlayerDisconnected(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++C3.6、Disconnect

++C3.6、Disconnect

++C3.6、Disconnect

++++立钻哥哥:断开

public static void Disconnect(int timeout = 200);

++++关闭所有开发的连接并关闭网络接口

++++timeout参数表示网络接口在未收到信号的情况下,多长时间会断开;网络状态,如安全和密码,也会被重置

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void OnGUI(){

        if(GUILayout.Button(立钻哥哥:Disconnect.)){

            Network.Disconnect();

            MasterServer.UnregisterHost();

        }    //立钻哥哥:if(GUILayout.Button()){}

    }    //立钻哥哥:void OnGUI(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++C3.7、GetAveragePing

++C3.7、GetAveragePing

++C3.7、GetAveragePing

++++立钻哥哥:获取平均Ping时间

public static int GetAveragePing(NetworkPlayer player);

++++到给定player的最后平均ping时间,以毫秒计

++++如果没有发现玩家,返回-1Ping会每隔几秒自动发出

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void OnGUI(){

        GUILayout.Label(立钻哥哥:Player ping values.);

 

        int i = 0;

        while(i < Network.connections.Length){

            GUILayout.Label(立钻哥哥:Player  + Network.connections[i] +  -  + Network.GetAveragePing(Network.connections[i]) +  ms);

            i++;

        }    //立钻哥哥:while(){}

    }    //立钻哥哥:void OnGUI(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++C3.8、GetLastPing

++C3.8、GetLastPing

++C3.8、GetLastPing

++++立钻哥哥:获取最后Ping时间

public static int GetLastPing(NetworkPlayer player);

++++到给定player的最后ping时间,以毫秒计

++++如果没有发现玩家,返回-1Ping会每隔几秒自动发出

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void OnGUI(){

        GUILayout.Label(立钻哥哥:Player ping values.);

 

        int i = 0;

        while(i < Network.connections.Length){

            //GUILayout.Label(立钻哥哥:Player  + Network.connections[i] +  -  + Network.GetAveragePing(Network.connections[i]) +  ms);

            GUILayout.Label(立钻哥哥:Player  + Network.connections[i] +  -  + Network.GetLastPing(Network.connections[i]) +  ms);

 

            i++;

        }    //立钻哥哥:while(){}

    }    //立钻哥哥:void OnGUI(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++C3.9、HavePublicAddress

++C3.9、HavePublicAddress

++C3.9、HavePublicAddress

++++立钻哥哥:有公网地址?

public static bool HavePublicAddress();

++++检测这台机器是否有一个公网IP地址

++++检查所有网络接口来获取IPV4公网地址,如发现返回true

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void OnGUI(){

        if(GUILayout.Button(立钻哥哥:Start Server.)){

            bool useNat = !Network.HavePublicAddress();

            Network.InitializeServer(32, 25002, useNat);

            MasterServer.RegisterHost(YanlzTestUniqueGameType, Yanlz VRGame, i360 game for all.);

        }    //立钻哥哥:if(GUILayout.Button()){}

    }    //立钻哥哥:void OnGUI(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++C3.10、InitializeSecurity

++C3.10、InitializeSecurity

++C3.10、InitializeSecurity

++++立钻哥哥:初始化安全层

public static void InitializeSecurity();

++++初始化安全层

++++需要在Network.InitializeServer调用之后在服务器上调用这个函数;不要在客户端调用该函数

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

  

    void Start(){

        Network.InitializeSecurity();

        Network.InitializeServer(32, 25000);

    }    //立钻哥哥:void Start(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++C3.11、InitializeServer

++C3.11、InitializeServer

++C3.11、InitializeServer

++++立钻哥哥:初始化服务器

public static NetworkConnectionError InitializeServer(int connections, int listenPort);

publis static NetworkConnectionError InitializeServer(int connections, int listenPort, bool useNat);

++++初始化服务器

++++connections是允许的入站连接或玩家的数量,listenPort是要监听的端口,useNat设置NAT穿透功能;如果想要这个服务器能够接受连接使用NAT穿透,使用facilitator,设置这个为true

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void MyLaunchServer(){

        Network.incomingPassword = HolyMoly;

        bool useNat = !Network.HavePublicAddress();

        Network.InitializeServer(32, 25000, useNat);

    }    //立钻哥哥:void MyLaunchServer(){}

  

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++C3.12、Instantiate

++C3.12、Instantiate

++C3.12、Instantiate

++++立钻哥哥:实例化

public static Object Instantiate(Object prefab, Vector3 position, Quaternion rotation, int group);

++++网络实例化预设

++++给定的预设将在所有的客户端上实例化;同步被自动设置,因此没有额外的工作要做;位置、旋转和网络组数值作为给定的参数;这是一个RPC调用,因此,当为该组数Network.RemoveRPCs被调用,这个物体将被移除;注意在编辑器中必须设置playerPrefab,在Object.Instantiate物体参考中获取更多实例化信息

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

    public NetworkView nView;

 

    void Start(){

        nView = GetComponent<NetworkView>();

    }    //立钻哥哥:void Start(){}

 

    void OnMyNetworkInstantiate(NetworkMessageInfo info){

        Debug.Log(nView.viewID +  spawned.);

 

        if(Network.isServer){

            Network.RemoveRPCs(nView.viewID);

            Network.Destroy(gameObject);

        }    //立钻哥哥:if(Network.isServer){}

    }    //立钻哥哥:void OnNetworkInstantiate(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++C3.13、RemoveRPCs

++C3.13、RemoveRPCs

++C3.13、RemoveRPCs

++++立钻哥哥:移除RPC

public static void RemoveRPCs(NetworkPlayer playerID);

public static void RemoveRPCs(NetworkPlayer playerID, int group);

public static void RemoveRPCs(NetworkViewID viewID);

++++移除所有属于这个玩家的IDRPC函数

++++移除属于这个玩家ID和发送基于给定组的所有RPC函数

++++移除所有与这个viewID数相关的RPC函数调用

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void OnMyPlayerDisconnected(NetworkPlayer player){

        Debug.Log(立钻哥哥:Clean up after player  + player);

 

        Network.RemoveRPCs(player);

        Network.DestroyPlayerObjects(player);

    }    //立钻哥哥:void OnPlayerDisconnected(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++C3.14、RemoveRPCsInGroup

++C3.14、RemoveRPCsInGroup

++C3.14、RemoveRPCsInGroup

++++立钻哥哥:移除所在组RPC

public static void RemoveRPCsInGroup(int group);

++++移除属于给定组的所有RPC函数

 

 

 

 

 

++C3.15、SetLevelPrefix

++C3.15、SetLevelPrefix

++C3.15、SetLevelPrefix

++++立钻哥哥:设置关卡前缀

public static void SetLevelPrefix(int prefix);

++++设置关卡前缀,然后所有网络ViewID数都会使用该前缀

++++此处提供了一些保护,可以防止来自前一个关卡的旧网络更新影响新的关卡;此处可以设置为任何数字并随着新关卡的加载而增加;这不会带来额外的网络负担,只会稍微减少网络ViewID

 

 

 

 

 

++C3.16、SetReceivingEnabled

++C3.16、SetReceivingEnabled

++C3.16、SetReceivingEnabled

++++立钻哥哥:设置接收启用

public static void SetReceivingEnabled(NetworkPlayer player, int group, bool enabled);

++++启用或禁用一个特定组中来自特定玩家的信息接收

++++在不想任何处理的网络消息进入的时候可以使用这个函数,然后在准备好后启用;例如,可用于停止网络消息,直到关卡被加载

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void MyTestFunc(){

        foreach(NetworkPlayer player in Network.connections){

            Network.SetReceivingEnabled(player, 0, false);

        }    //立钻哥哥:foreach(){}

    }    //立钻哥哥:void MyTestFunc(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++C3.17、SetSendingEnabled

++C3.17、SetSendingEnabled

++C3.17、SetSendingEnabled

++++立钻哥哥:设置发送启用

public static void SetSendingEnabled(int group, bool enabled);

public static void SetSendingEnabled(NetworkPlayer player, int group, bool enabled);

++++启用或禁用在特定网络组的信息传输和RPC调用

++++当知道不发送任何有用的信息到其他客户端时,可以设置这个;例如在完全加载在关卡之前

++++基于目标玩家以及网络组,启用或禁用消息传输和RPC调用

++++当在客户端使用时,唯一可能的NetworkPlayer就是服务器

 

 

 

 

 

++C3.18、TestConnection

++C3.18、TestConnection

++C3.18、TestConnection

++++立钻哥哥:测试连接

public static TestConnection TestConnection(bool forceTest=false);

++++测试这台机器的网络连接

++++测试执行两种测试,这取决机器是公网IP还是一个私有IP

++++公网IP测试主要用于服务器,不需要测试具有公网IP的客户端;为了公网IP测试成功,必须开启一个服务器实例;一个测试服务器将尝试连接到本地服务器的IP地址和端口,因此它被显示在服务器中是可连接状态;如果不是,那么防火墙是最有可能阻断服务端口的;服务器实例需要运行以便测试服务器已经连接

++++另一个测试检测NAT穿透能力;服务器和客户端都可以进行,无需任何事先设定;如果用于服务器NAT测试失败,那么不设置端口转发是一个坏主意;本地LAN网络之外的客户端将不能连接;如果测试失败,客户端就不能使用NAT穿透连接到服务器,这些服务器将不会提供给用户作为主机

++++这个函数是异步的,并可能不会返回有效的结果;因为这个测试需要一些时间来完成(1-2秒);测试完成之后,测试结果只在函数被再次调用时返回;这样,频繁访问该函数是安全的;如果需要其他的测试,如网络连接已更改,那么forceTest参数应该为true

++++该函数返回一个ConnectionTesterStatus枚举

 

 

 

 

 

++C3.19、TestConnectionNAT

++C3.19、TestConnectionNAT

++C3.19、TestConnectionNAT

++++立钻哥哥:测试连接NAT穿透

public static ConnectionTesterStatus TestConnectionNAT(bool forceTest=false);

++++用于测试特定连接的NAT穿透连接性

++++这个就像Network.TestConnection,只不过NAT穿透测试是强制的,即使该机器没有一个NAT地址(私有IP地址),单有一个公有地址

 

 

 

 

 

 

 

#D4、Message消息

#D4、Message消息

++D4、Message消息

++++D4.1、OnConnectedToServer

++++D4.2、OnDisconnectedFromServer

++++D4.3、OnFailedToConnect

++++D4.4、OnNetworkInstantiate

++++D4.5、OnPlayerConnected

++++D4.6、OnPlayerDisconnected

++++D4.7、OnSerializeNetworkView

++++D4.8、OnServerInitialized

++++D4.9、YanlzXREngine.Network.Message

《UnityAPI.Network网络》(Yanlz+Unity+SteamVR+云技术+5G+AI+VR云游戏+Network+isClient+Connect+Server+立钻哥哥++OK++)_第6张图片

 

 

++D4.1、OnConnectedToServer

++D4.1、OnConnectedToServer

++D4.1、OnConnectedToServer

++++立钻哥哥:当连接到服务器

Network.OnConnectedToServer();

++++当成功连接到服务器时,在客户端调用这个函数

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void OnConnectedToServer(){

        Debug.Log(立钻哥哥:Connected to server.);

    }    //立钻哥哥:void OnConnectedToServer(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++D4.2、OnDisconnectedFromServer

++D4.2、OnDisconnectedFromServer

++D4.2、OnDisconnectedFromServer

++++立钻哥哥:当从服务器断开

Network.OnDisconnectedFromServer(NetworkDisconnection info);

++++在服务器上当连接已经断开,在客户端调用这个函数,但当连接已经被禁用,也在服务器上调用

++++当这个连接已经丢失或从服务器断开,在客户端调用这个函数;NetworkDisconnection枚举将表示,如果连接已经干净断开或如果连接已经丢失;当在服务器上调用,该连接已经成功地断开(调用Network.Disconnect之后)

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void OnDisconnectedFromServer(NetworkDisconnection info){

        if(Network.isServer){

            Debug.Log(立钻哥哥:Local server connection disconnected.);

        }else{

            if(info == NetworkDisconnection.LostConnection){

                Debug.Log(立钻哥哥:Lost connection to the server.);

            }else{

                Debug.Log(立钻哥哥:Successfully disconnected from the server.);

            }    //立钻哥哥:if(info==NetworkDisconnection.LostConnection){}else{}

        }    //立钻哥哥:if(Network.isServer){}else{}

    }    //立钻哥哥:void OnDisconnectedFromServer(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++D4.3、OnFailedToConnect

++D4.3、OnFailedToConnect

++D4.3、OnFailedToConnect

++++立钻哥哥:当连接失败

Network.OnFailedToConnect(NetworkConnectionError error);

++++当一个连接因为某些原因失败时,从客户端调用这个函数

++++失败的原因作为NetworkConnectionError枚举传入

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void OnFailedToConnect(NetworkConnectionError error){

        Debug.Log(立钻哥哥:Could not connect to server:  + error);

    }    //立钻哥哥:void OnFailedToConnect(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++D4.4、OnNetworkInstantiate

++D4.4、OnNetworkInstantiate

++D4.4、OnNetworkInstantiate

++++立钻哥哥:当网络实例化

Network.OnNetworkInstantiate(NetworkMessageInfo info);

++++当一个物体使用Network.Instantiate已经网络实例化,在该物体上调用这个函数;这个对于禁用或启用一个已经实例化的物体组件来说是非常有用的,它们的行为取决与它们是在本地还是在远端

++++注意:NetworkMessageInfo里的networkView属性不能在OnNetworkInstantiate里使用

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void OnNetworkInstantiate(NetworkMessageInfo info){

        Debug.Log(立钻哥哥:New object instantiated by  + info.sender);

    }    //立钻哥哥:void OnNetworkInstantiate(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++D4.5、OnPlayerConnected

++D4.5、OnPlayerConnected

++D4.5、OnPlayerConnected

++++立钻哥哥:当玩家连接

Network.OnPlayerConnected(NetworkPlayer player);

++++每当一个新玩家成功连接时,在服务器上调用这个函数

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

    private int playerCount = 0;

 

    void OnPlayerConnected(NetworkPlayer player){

        Debug.Log(立钻哥哥:Player  + playerCount++ +  connected from  + player.ipAddress + : + player.port);

    }    //立钻哥哥:void OnPlayerConnected(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++D4.6、OnPlayerDisconnected

++D4.6、OnPlayerDisconnected

++D4.6、OnPlayerDisconnected

++++立钻哥哥:当玩家断开

Network.OnPlayerDisconnected(NetworkPlayer player);

++++每当一个玩家从服务器断开时,在服务器调用这个函数

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

 

    void OnPlayerDisconnected(NetworkPlayer player){

        Debug.Log(立钻哥哥:Clean up after player  + player);

 

        Network.RemoveRPCs(player);

        Network.DestroyPlayerObjects(player);

    }    //立钻哥哥:void OnPlayerDisconnected(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++D4.7、OnSerializeNetworkView

++D4.7、OnSerializeNetworkView

++D4.7、OnSerializeNetworkView

++++立钻哥哥:当序列化网络视图

Network.OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info);

++++用来在一个由网络视图监控的脚本中自定义变量同步

++++它自动决定被序列化的变量是否应该发送或接收;这取决于谁拥有该物体,即所有者发送,其他所有人接收

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

    public int currentHealth;

 

    void OnSerializeNetworkView(){

        int health = 0;

 

        if(stream.isWriting){

            health = currentHealth;

            stream.Serialize(ref health);

        }else{

            stream.Serialize(ref health);

            currentHealth = health;

        }    //立钻哥哥:if(stream.isWriting){}else{}

    }    //立钻哥哥:void OnSerializeNetworkView(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

++D4.8、OnServerInitialized

++D4.8、OnServerInitialized

++D4.8、OnServerInitialized

++++立钻哥哥:当服务器已初始化

Network.OnServerInitialized();

++++每当一个Network.InitializeServer被调用并完成时,在服务器上调用这个函数

using UnityEngine;

using System.Collections;

using YanlzXREngine;

 

public class YanlzNetwork : MonoBehaviour{

    

    void OnServerInitialized(){

        Debug.Log(立钻哥哥:Server initialized and ready.);

    }    //立钻哥哥:void OnServerInitialized(){}

 

}    //立钻哥哥:public class YanlzNetwork{}

 

 

 

 

 

 

 

 

#E5、立钻哥哥对Network类的拓展

#E5、立钻哥哥对Network类的拓展

《UnityAPI.Network网络》(Yanlz+Unity+SteamVR+云技术+5G+AI+VR云游戏+Network+isClient+Connect+Server+立钻哥哥++OK++)_第7张图片

++++【Unity API】分类:https://blog.csdn.net/vrunsoftyanlz/category_7637520.html

++++[Unity快速入门]:https://blog.csdn.net/VRunSoftYanlz/article/details/105776475

++++[UnityAPI目录]:https://blog.csdn.net/VRunSoftYanlz/article/details/106533906

++++[Application应用]:https://blog.csdn.net/VRunSoftYanlz/article/details/106086327

++++[Object对象]:https://blog.csdn.net/VRunSoftYanlz/article/details/106202194

++++[GameObject]:https://blog.csdn.net/VRunSoftYanlz/article/details/106223815

++++[MonoBehaviour]:https://blog.csdn.net/VRunSoftYanlz/article/details/106533256

++++[Component组件]:https://blog.csdn.net/VRunSoftYanlz/article/details/106367004

++++[Transform变换]:https://blog.csdn.net/VRunSoftYanlz/article/details/106607761

++++[Camera摄像机]:https://blog.csdn.net/VRunSoftYanlz/article/details/106148837

++++[Shader着色器]:https://blog.csdn.net/VRunSoftYanlz/article/details/106321040

++++[Material材质]:https://blog.csdn.net/VRunSoftYanlz/article/details/81814303

++++[Physics物理]:https://blog.csdn.net/VRunSoftYanlz/article/details/106268062

++++[Collider碰撞器]:https://blog.csdn.net/VRunSoftYanlz/article/details/106696886

++++[Rigidbody刚体]:https://blog.csdn.net/VRunSoftYanlz/article/details/106698042

++++[RaycastHit]:https://blog.csdn.net/VRunSoftYanlz/article/details/106292370

++++[ParticleSystem]:https://blog.csdn.net/VRunSoftYanlz/article/details/106341995

++++[WWW万维网]:https://blog.csdn.net/VRunSoftYanlz/article/details/106412890

++++[LineRenerer]:https://blog.csdn.net/VRunSoftYanlz/article/details/106306388

++++[WheelCollider]:https://blog.csdn.net/VRunSoftYanlz/article/details/82356217

++++[MovieTexture]:https://blog.csdn.net/VRunSoftYanlz/article/details/106434063

++++[Joint关节]:https://blog.csdn.net/VRunSoftYanlz/article/details/106771226

++++[Collision碰撞]:https://blog.csdn.net/VRunSoftYanlz/article/details/106697669

++++[Matrix4x4矩阵]:https://blog.csdn.net/VRunSoftYanlz/article/details/106504027

++++[Renerer渲染器]:https://blog.csdn.net/VRunSoftYanlz/article/details/106481994

++++[AudioSource]:https://blog.csdn.net/VRunSoftYanlz/article/details/106462679

++++[AudioClip]:https://blog.csdn.net/VRunSoftYanlz/article/details/106448955

++++[Texture纹理]:https://blog.csdn.net/VRunSoftYanlz/article/details/106448589

++++[AssetBundle]:https://blog.csdn.net/VRunSoftYanlz/article/details/106412190

++++[ScriptableObject]:https://blog.csdn.net/VRunSoftYanlz/article/details/106392769

《UnityAPI.Network网络》(Yanlz+Unity+SteamVR+云技术+5G+AI+VR云游戏+Network+isClient+Connect+Server+立钻哥哥++OK++)_第8张图片

 

 

 

 

 

@@提示:有些博客可能只是开了头,如果感兴趣的同学,可以“点赞”或“评论区留言”,只要关注的同学多了,那就会继续完善哟!(“++==”,表示没有写完的,如果关注度不高就不完善了;“++ok++”,表示此篇博客已经完成,是阶段性完整的!)

 

 

《UnityAPI.Network网络》(Yanlz+Unity+SteamVR+云技术+5G+AI+VR云游戏+Network+isClient+Connect+Server+立钻哥哥++OK++)_第9张图片

++++VR云游戏=Unity+SteamVR+云技术+5G+AI;(说明:AI人工智能不是我们的主要研究技术,只是了解一下,领略一下有风的感觉!但是,VR是我们的研究重点

++++【Unity API】分类:https://blog.csdn.net/vrunsoftyanlz/category_7637520.html

++++【Unity开发基础】分类:https://blog.csdn.net/vrunsoftyanlz/category_7309057.html

++++【Linux系统编程】分类:https://blog.csdn.net/vrunsoftyanlz/category_9694767.html

++++【C++C铸就生存利器】分类:https://blog.csdn.net/vrunsoftyanlz/category_9325802.html

++++【人工智能AI2026】分类:https://blog.csdn.net/vrunsoftyanlz/category_9212024.html

++++【立钻哥哥CSDN空间】:https://blog.csdn.net/VRunSoftYanlz/

 

 

 

 

 

 

【XR游戏开发QQ群:784477094

++立钻哥哥推荐的拓展学习链接(Link_Url)

立钻哥哥推荐的拓展学习链接(Link_Url)

++++立钻哥哥Unity 学习空间: http://blog.csdn.net/VRunSoftYanlz/

++++虚拟现实VR资讯: https://blog.csdn.net/VRunSoftYanlz/article/details/89165846

++++HTC_VIVE开发基础https://blog.csdn.net/VRunSoftYanlz/article/details/81989970

++++Oculus杂谈https://blog.csdn.net/VRunSoftYanlz/article/details/82469850

++++Oculus安装使用https://blog.csdn.net/VRunSoftYanlz/article/details/82718982

++++Unity+SteamVR=>VRhttps://blog.csdn.net/VRunSoftYanlz/article/details/88809370

++++Unity减少VR晕眩症https://blog.csdn.net/VRunSoftYanlz/article/details/89115518

++++SteamVR简介https://blog.csdn.net/VRunSoftYanlz/article/details/86484254

++++SteamVR脚本功能分析https://blog.csdn.net/VRunSoftYanlz/article/details/86531480

++++SteamVR2.0开发指南https://blog.csdn.net/VRunSoftYanlz/article/details/86618187

++++SteamVR2.2.0开发指南https://blog.csdn.net/VRunSoftYanlz/article/details/88784527

++++SteamVR2.2.0快速入门https://blog.csdn.net/VRunSoftYanlz/article/details/88833579

++++SteamVR2.2.0交互系统https://blog.csdn.net/VRunSoftYanlz/article/details/89199778

++++SteamVR2.2.0传送机制https://blog.csdn.net/VRunSoftYanlz/article/details/89390866

++++SteamVR2.2.0教程(一)https://blog.csdn.net/VRunSoftYanlz/article/details/89324067

++++SteamVR2.2.0教程(二)https://blog.csdn.net/VRunSoftYanlz/article/details/89894097

++++SteamVR_Skeleton_Poserhttps://blog.csdn.net/VRunSoftYanlz/article/details/89931725

++++SteamVR实战之PMCorehttps://blog.csdn.net/VRunSoftYanlz/article/details/89463658

++++SteamVR/Extrashttps://blog.csdn.net/VRunSoftYanlz/article/details/86584108

++++SteamVR/Inputhttps://blog.csdn.net/VRunSoftYanlz/article/details/86601950

++++OpenXR简介https://blog.csdn.net/VRunSoftYanlz/article/details/85726365

++++VRTK杂谈https://blog.csdn.net/VRunSoftYanlz/article/details/82562993

++++VRTK快速入门(杂谈)https://blog.csdn.net/VRunSoftYanlz/article/details/82955267

++++VRTK官方示例(目录)https://blog.csdn.net/VRunSoftYanlz/article/details/82955410

++++VRTK代码结构(目录)https://blog.csdn.net/VRunSoftYanlz/article/details/82780085

++++VRTK(SceneResources)https://blog.csdn.net/VRunSoftYanlz/article/details/82795400

++++VRTK_ControllerEventshttps://blog.csdn.net/VRunSoftYanlz/article/details/83099512

++++VRTK_InteractTouchhttps://blog.csdn.net/VRunSoftYanlz/article/details/83120220

++++虚拟现实行业应用https://blog.csdn.net/VRunSoftYanlz/article/details/88360157

++++Steam平台上的VRhttps://blog.csdn.net/VRunSoftYanlz/article/details/88960085

++++Steam平台热销VRhttps://blog.csdn.net/VRunSoftYanlz/article/details/89007741

++++VR实验:以太网帧的构成https://blog.csdn.net/VRunSoftYanlz/article/details/82598140

++++实验四:存储器扩展实验https://blog.csdn.net/VRunSoftYanlz/article/details/87834434

++++FrameVR示例V0913https://blog.csdn.net/VRunSoftYanlz/article/details/82808498

++++FrameVR示例V1003https://blog.csdn.net/VRunSoftYanlz/article/details/83066516

++++SwitchMachineV1022https://blog.csdn.net/VRunSoftYanlz/article/details/83280886

++++PlaySceneManagerV1022https://blog.csdn.net/VRunSoftYanlz/article/details/83280886

++++Unity5.x用户手册https://blog.csdn.net/VRunSoftYanlz/article/details/81712741

++++Unity面试题ABChttps://blog.csdn.net/vrunsoftyanlz/article/details/78630687

++++Unity面试题Dhttps://blog.csdn.net/VRunSoftYanlz/article/details/78630838

++++Unity面试题Ehttps://blog.csdn.net/vrunsoftyanlz/article/details/78630913

++++Unity面试题Fhttps://blog.csdn.net/VRunSoftYanlz/article/details/78630945

++++Cocos2dx面试题https://blog.csdn.net/VRunSoftYanlz/article/details/78630967

++++禅道[zentao]https://blog.csdn.net/VRunSoftYanlz/article/details/83964057

++++Lua快速入门篇(Xlua拓展):https://blog.csdn.net/VRunSoftYanlz/article/details/81173818

++++Lua快速入门篇(XLua教程):https://blog.csdn.net/VRunSoftYanlz/article/details/81141502

++++Lua快速入门篇(基础概述)https://blog.csdn.net/VRunSoftYanlz/article/details/81041359

++++框架知识点https://blog.csdn.net/VRunSoftYanlz/article/details/80862879

++++游戏框架(UI框架夯实篇)https://blog.csdn.net/vrunsoftyanlz/article/details/80781140

++++游戏框架(初探篇)https://blog.csdn.net/VRunSoftYanlz/article/details/80630325

++++.Net框架设计https://blog.csdn.net/VRunSoftYanlz/article/details/87401225

++++从零开始学架构https://blog.csdn.net/VRunSoftYanlz/article/details/88095895

++++设计模式简单整理https://blog.csdn.net/vrunsoftyanlz/article/details/79839641

++++专题:设计模式(精华篇)https://blog.csdn.net/VRunSoftYanlz/article/details/81322678

++++U3D小项目参考https://blog.csdn.net/vrunsoftyanlz/article/details/80141811

++++Unity小游戏算法分析https://blog.csdn.net/VRunSoftYanlz/article/details/87908365

++++Unity案例(Vehicle)https://blog.csdn.net/VRunSoftYanlz/article/details/82355876

++++UML类图https://blog.csdn.net/vrunsoftyanlz/article/details/80289461

++++PowerDesigner简介https://blog.csdn.net/VRunSoftYanlz/article/details/86500084

++++Unity知识点0001https://blog.csdn.net/vrunsoftyanlz/article/details/80302012

++++Unity知识点0008https://blog.csdn.net/VRunSoftYanlz/article/details/81153606

++++U3D_Shader编程(第一篇:快速入门篇)https://blog.csdn.net/vrunsoftyanlz/article/details/80372071

++++U3D_Shader编程(第二篇:基础夯实篇)https://blog.csdn.net/vrunsoftyanlz/article/details/80372628

++++Unity引擎基础https://blog.csdn.net/vrunsoftyanlz/article/details/78881685

++++Unity面向组件开发https://blog.csdn.net/vrunsoftyanlz/article/details/78881752

++++Unity物理系统https://blog.csdn.net/vrunsoftyanlz/article/details/78881879

++++Unity2D平台开发https://blog.csdn.net/vrunsoftyanlz/article/details/78882034

++++UGUI基础https://blog.csdn.net/vrunsoftyanlz/article/details/78884693

++++UGUI进阶https://blog.csdn.net/vrunsoftyanlz/article/details/78884882

++++UGUI综合https://blog.csdn.net/vrunsoftyanlz/article/details/78885013

++++Unity动画系统基础https://blog.csdn.net/vrunsoftyanlz/article/details/78886068

++++Unity动画系统进阶https://blog.csdn.net/vrunsoftyanlz/article/details/78886198

++++Navigation导航系统https://blog.csdn.net/vrunsoftyanlz/article/details/78886281

++++Unity特效渲染https://blog.csdn.net/vrunsoftyanlz/article/details/78886403

++++Unity数据存储https://blog.csdn.net/vrunsoftyanlz/article/details/79251273

++++Unity中Sqlite数据库https://blog.csdn.net/vrunsoftyanlz/article/details/79254162

++++WWW类和协程https://blog.csdn.net/vrunsoftyanlz/article/details/79254559

++++Unity网络https://blog.csdn.net/vrunsoftyanlz/article/details/79254902

++++Unity资源加密https://blog.csdn.net/VRunSoftYanlz/article/details/87644514

++++PhotonServer简介https://blog.csdn.net/VRunSoftYanlz/article/details/86652770

++++编写Photon游戏服务器https://blog.csdn.net/VRunSoftYanlz/article/details/86682935

++++C#事件https://blog.csdn.net/vrunsoftyanlz/article/details/78631267

++++C#委托https://blog.csdn.net/vrunsoftyanlz/article/details/78631183

++++C#集合https://blog.csdn.net/vrunsoftyanlz/article/details/78631175

++++C#泛型https://blog.csdn.net/vrunsoftyanlz/article/details/78631141

++++C#接口https://blog.csdn.net/vrunsoftyanlz/article/details/78631122

++++C#静态类https://blog.csdn.net/vrunsoftyanlz/article/details/78630979

++++C#中System.String类https://blog.csdn.net/vrunsoftyanlz/article/details/78630945

++++C#数据类型https://blog.csdn.net/vrunsoftyanlz/article/details/78630913

++++Unity3D默认的快捷键https://blog.csdn.net/vrunsoftyanlz/article/details/78630838

++++游戏相关缩写https://blog.csdn.net/vrunsoftyanlz/article/details/78630687

++++UnityAPI.Rigidbody刚体https://blog.csdn.net/VRunSoftYanlz/article/details/81784053

++++UnityAPI.Material材质https://blog.csdn.net/VRunSoftYanlz/article/details/81814303

++++UnityAPI.Android安卓https://blog.csdn.net/VRunSoftYanlz/article/details/81843193

++++UnityAPI.AndroidJNI安卓JNIhttps://blog.csdn.net/VRunSoftYanlz/article/details/81879345

++++UnityAPI.Transform变换https://blog.csdn.net/VRunSoftYanlz/article/details/81916293

++++UnityAPI.WheelCollider轮碰撞器https://blog.csdn.net/VRunSoftYanlz/article/details/82356217

++++UnityAPI.Resources资源https://blog.csdn.net/VRunSoftYanlz/article/details/83155518

++++JSON数据结构https://blog.csdn.net/VRunSoftYanlz/article/details/82026644

++++CocosStudio快速入门https://blog.csdn.net/VRunSoftYanlz/article/details/82356839

++++Unity企业内训(目录)https://blog.csdn.net/VRunSoftYanlz/article/details/82634668

++++Unity企业内训(第1讲)https://blog.csdn.net/VRunSoftYanlz/article/details/82634733

++++Unity企业内训(第2讲)https://blog.csdn.net/VRunSoftYanlz/article/details/82861180

++++Unity企业内训(第3讲)https://blog.csdn.net/VRunSoftYanlz/article/details/82927699

++++Unity企业内训(第4讲)https://blog.csdn.net/VRunSoftYanlz/article/details/83479776

++++Unity企业内训(第5讲)https://blog.csdn.net/VRunSoftYanlz/article/details/83963811

++++Unity企业内训(第6讲)https://blog.csdn.net/VRunSoftYanlz/article/details/84207696

++++钻哥带您了解产品原型https://blog.csdn.net/VRunSoftYanlz/article/details/87303828

++++插件https://blog.csdn.net/VRunSoftYanlz/article/details/83963905

++++计算机组成原理(教材篇)https://blog.csdn.net/VRunSoftYanlz/article/details/82719129

++++5G接入:云计算和雾计算https://blog.csdn.net/VRunSoftYanlz/article/details/88372718

++++云计算通俗讲义https://blog.csdn.net/VRunSoftYanlz/article/details/88652803

++++立钻哥哥Unity 学习空间: http://blog.csdn.net/VRunSoftYanlz

--_--VRunSoft:lovezuanzuan--_--

你可能感兴趣的:(VR云游戏实战零碎技术点,Unity开发基础,UnityAPI)