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 SirMacJefferson · Dec 23, 2012 at 10:24 PM · networkingnetworknetworkview

Troubles with using NetworkViews on a server

Is there a way to make a server send data via a NetworkView without the server having to apply the data itself? For example:

  • The client sends its position to the server via a NetworkView

  • The server sets the player's position in its Players array, or something similar, so it can keep a record of where the player is

  • The server sends the new position to other players

It seems like Unity wants me to have the server Instantiate its own Player prefab, and send the data through a NetworkView like that. I don't want the server to have players running around in its Scene; I want to save the position in a custom Player class in the server's Players array, and then send the data out to other players so they can extrapolate/interpolate it.

So my question is, is there any way to use the server just to relay the data to other players, without trying to apply the data to the GameObject that has the NetworkView? I also don't want the server to have to Instantiate all of the Player prefabs itself; only the players should do that, otherwise I'd have a bunch of players that aren't even part of the same session running around in the Scene.

Hopefully this is explained clearly enough. Thanks to anyone who tries to help!

Comment
Add comment · Show 2
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 KiraSensei · Dec 23, 2012 at 10:44 PM 0
Share

Create an empty game object with a network view for the server is not what you want ? It avoids a player instantiation for the server.

avatar image SirMacJefferson · Dec 23, 2012 at 11:04 PM 0
Share

I was doing that, but I set the NetworkView's "observed" variable to the Player.js on the client side, and manually Serialize()'d the position in the Player.js script (ins$$anonymous$$d of setting 'observed' to the Transform, because I thought I'd need to Serialize() more values later). However, the server doesn't have a Player.js script to observe.

I just now tried it by giving the Server.js an OnSerializeNetworkView() event that sets the position in the servers' Players array. I had the Server set its NetworkViews to observe the Server script. I put a Debug.Log() in there so I could see if it was getting the calls, and it was (without any errors). But is that O$$anonymous$$ to do? One NetworkView is observing Player.js, and the other is observing Server.js.

I thought they both had to observe the same thing, which was why I thought Unity was going to force me to Instantiate the Players on the server as well...

0 Replies

· Add your reply
  • Sort: 

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

11 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

Related Questions

networkview.RPC not accessible in unity 5.4 1 Answer

UNET - Send update positions at a lower level than using NetworkTransform? 0 Answers

How to load all character previously in game when new player joins 0 Answers

How to send UDP updates form server to each Client? 0 Answers

State synchronization non-functional after mode change? 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