Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 fgembry · Jan 08, 2014 at 06:47 PM · c#networkingmultiplayerrpc

Networking GameManager/GameState Sync

Hello Everyone,

I am new to Unity Networking and networking in general. I have a prototype game I created and would like to add in multiplayer. My issue is that I currently have a GameManager that controls and stores all the info for the current game. When I have a client connect to my host, the client GameManager does not have the correct game info and do to the lack of variable types RPC's can send I don't know of a way to fill out the client side GameManager's info.

I would like to know if there is a way I can transfer my GameManager data to the clients or if there is a way I can just access the server GameManager and not worry about the clients manager at all.

Thank you in advance and if you need more info on this problem please ask.

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

Answer by nastasache · Jan 09, 2014 at 11:47 AM

I think the way is to adapt some GameManager variables to be compatible with RPC's variables types. By my experience RPC's variables types are enough for any logical needs. I am using something similar and all works well; when a RCP type doesn't exist I simple store lists with integer index, send index with RPC and read and apply values on targets by the integer index.

Comment
Add comment · Show 3 · 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
avatar image fgembry · Jan 09, 2014 at 03:02 PM 0
Share

Hey Nastasache,

Thanks for the reply, I did try this out on my own but I cant seem to get it correct.

I have a List of GameObjects(tile$$anonymous$$ap) that have a script attached to them. They all have a NetworkView attached and are set to reliable.

I created an RPC that will send over the viewID and just for now the tileID for each tile.

         networkView.RPC ("SetTiles", RPC$$anonymous$$ode.AllBuffered, floorList[index].networkView.viewID, floorList[index].GetComponent<FloorCubeScript1>().floorID);

Then on the client side when I receive the call I get all tile objects in the scene and check for the matching viewID's.

     [RPC]
     void SetTiles(NetworkViewID viewID, int floorID){
         GameObject[] floor = GameObject.FindGameObjectsWithTag ("Floor");
         GameObject go = null;
         FloorCubeScript1 newTile, oldTile = null;
         for(int index = 0; index < floor.Length; ++index){
             if(floor[index].networkView.viewID == viewID)
             {
                 go = floor[index];
                 
                 go.GetComponent<FloorCubeScript1>().floorID = floorID;
                 floorList.Add (go);
             }
         }
     }

The issue now is that I can not access the client sides tile script member vars to set them up with the server side info that i am passing over.

I get a $$anonymous$$onoDev. error:

alt text

Any help would be appreciated. Thank you.

debuggee.png (26.2 kB)
avatar image nastasache · Jan 09, 2014 at 07:18 PM 0
Share

I never saw this error. Looks related with virtual machines. Do you have installed Unity on a V$$anonymous$$? As your your code, I see no reason not to work.

avatar image fgembry · Jan 09, 2014 at 08:23 PM 0
Share

No I do not run on a V$$anonymous$$. This is really bothering me as I thought this should work and your answer reaffirmed that but this is beyond me.

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

19 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

Related Questions

How To Deal With Lingering Prefabs in Multiplayer Scene ? 0 Answers

SyncVar issue 0 Answers

[Error] RPC function undefined in IRRELEVANT file? 0 Answers

Unity networking tutorial? 6 Answers

Network how to send data/activate function 1 Answer


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