Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Afonso-Lage · Sep 06, 2015 at 09:15 PM · networkingclassesclient-server

UNET Server and Client business classes

Hello folks!

I'm reading about UNET to create the Networking structure for our MMORPG (Yeah, I know, but we are planning to launch it on the next 6 years). I have some experience on MMORPG but not in Unity, so I'm used to have client and server as separated projects and just share some classes.

But when learning about UNET (I'm on it about 2 days) I understood how it works on Client and Server instances, but I still have a question: How to have Client and Server business specific classes apart? Since we are creating an authoritative server, there will be many classes where only server need to have, and the same applies for client (the server doesn't need to have some rendering or animation specific classes).

At first I thought on using two Unity Projects, one for Client and one for Server, but this will lead on code duplications, because there are classes (like containers classes such as Player, Monsters and Npc data) that will be used on both - Server and Client.

This may seems a no use question, but I really don't want to spread all Server specifics classes to all clients, because this will help hackers and cheaters to create tools against our MMORPG. I would like to have a build where client have only its classes and same for the server.

Thanks in advice!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Afonso-Lage · Sep 07, 2015 at 11:48 AM

I was able to do it by using custom build script. Here's a script snippet to do it:

 [MenuItem("Build/Client")]
 public static void BuildClient()
 {
     string[] levels = { "Assets/Main.unity" };

     Directory.Move("Assets/Scripts/Server/", "Temp/customBuild_Server/");
     AssetDatabase.Refresh();
     BuildPipeline.BuildPlayer(levels, "Build/Client.exe", BuildTarget.StandaloneWindows, BuildOptions.None);
     Directory.Move("Temp/customBuild_Server/", "Assets/Scripts/Server/");
     AssetDatabase.Refresh();
 }

(Place this script inside a Editor folder on Assets)

Any script that is inside Assets/Scripts/Server folder will not be build on Client, so I have safe develop my business needs on server side.

Hope this helps someone else.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

28 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Issuing orders to Units in Networked Turn-based game 0 Answers

UNET Bug with NetworkHash128 and Saving Prefabs 0 Answers

Since switching to using offline & online scenes in the NetworkManager, Clients will not sync (UNET) 0 Answers

Unity Multiplayer (Mirror) - Problem in syncing game object's variables across all clients. [Trying to send command for object without authority] 0 Answers

[Networking] Changed text does not appear changed for players who just connected 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges