To learn the unity3d tutorial, you must get started with the Photon server

For the scholars of Unity3d, to learn the Unity3D tutorial, you must get started with the Photon server, so the editor will share the content of the tutorial for you below.
First go to PhotonServer SDK to download the server-side SDK. There are four files after decompression:
deploy: Mainly store photon's server control program and server-side Demo
doc: As the name suggests, document
lib: Photon class library,
src-server that needs to be referenced by the development server: server-side Demo source code
Step 1: Configure the server side to
open the deploy folder, see the Photon directory that contains the compiled photon on different platforms, name the directory with "bin_" as the prefix, select the folder corresponding to your computer to open, see PhotonControl.exe, after running, you can run it in There is an icon in the lower right corner of Windows , click the icon to see the photon server control menu, which will be described in detail later.
Open visual stadio, create a new project, select the c# class library, and the application name is MyServer.
After completion, rename our Class1.cs to MyApplication.cs as the server-side main class. Then add a reference to the current project, link it to the lib folder mentioned just now, and add the following references:
ExitGamesLibs.dll,
Photon .SocketServer.dll,
PhotonHostRuntimeInterfaces.dll
and then create a new class: MyPeer.cs, written as follows: 3D game" /> Connected, the MyApplication.cs class is written like this:

 
unity3d tutorial, unity<a style=

unity3d tutorial, unity3d game
 
unity3d tutorial, unity3d game
After completion, select the current project in the solution explorer, open the properties, select the build tab, change the output path to bin\\, and then generate the class library.
Copy the MyServer folder under the current project to the deploy folder, Delete all files and folders except the bin folder, then open the deploy\\bin_Win64\\PhotonServer.config configuration file with a text editor (mine is a win7 64-bit machine, just choose this), add the following configuration: this code Put it under the node here Name: project name BaseDirectory: root directory, under the deploy folder is the base directory Assembly: is the name of the .dll file with the same name as our project in the bin directory in the generated class library Type: is the main The full name of the class is here: MyServer.MyApplication, and it must include the namespace EnableAutoRestart: whether it is an automatic start, which means that when we replace the server file, we do not need to stop the server. After the replacement, photon will automatically load the files WatchFiles and ExcludeFiles and save them after completion. Run the tray program deploy\\bin_Win64\\PhotonControl.exe, (the certificate is placed in the deploy\\bin_Win64\\ directory) to start writing the client code, first download the Unity SDK from the official website to open the Unity3D editor, first put Photon-Unity3D_v3- 0-1-14_SDK\\libs\\Release\\Photon3Unity3D.dll is imported into Unity, and a new script TestConnection.cs is created. The script code is as follows:
unity3d tutorial, unity3d game
 
unity3d tutorial, unity3d game











unity3d tutorial, unity3d game
unity3d tutorial, unity3d game
 
unity3d tutorial, unity3d game
unity3d tutorial, unity3d game
Bind the script to the object in the scene, after running, you can see a button, click the connection, if the connection is successful, it will print "Connect Success!" The
above is the content of the unity3d tutorial for scholars, all for scholars' reference 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326920044&siteId=291194637