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 rednax20 · Oct 07, 2014 at 12:33 AM · transformnetworkserverclient

Client movements not registering on Server

okay, as much as I try to keep my posts brief, this one is a bit long.

I'm making a game. In it, the players have to find each other in a large area, and then shoot each other. It's online. There are a few little things, but for the most part, all I need to do over the network is connect, then, I need to track the position of each player on each machine.

First I tried just attaching a networkveiw component to each player and have it observe the transforms. It appeared to be working, but I'm not sure.

then I changed the way the game worked. to allow for matches with more than 2 players I instantiate player prefabs, one for each player (you really don't want me to go into how i do this). That's when it seemed to not be working; although, it might not have ever been working (I might have always been the client when i tested).

the players only register movement on the client's game. The server (I never tested this with more than 2 people) saw himself, but not the client. the client could see everyone. I don't get it. I thought networkveiw would do that for me.

I decided to lookup a way to track network transforms, I found this script

 using UnityEngine;
 using System.Collections;
 
 public class trackposition : MonoBehaviour
 {
     public void OnSerializeNetworkView( BitStream stream, 
                                        NetworkMessageInfo info )
     {
         // we are currently writing information to the network
         if( stream.isWriting )
         {
             // send the object's position
             Vector3 position = transform.position;
             stream.Serialize( ref position );
         }
         // we are currently reading information from the network
         else
         {
             // read the first vector3 and store it in 'position'
             Vector3 position = Vector3.zero;
             stream.Serialize( ref position );
             
             // set the object's position to the value we were sent
             transform.position = position;
         }
     }
 }


This yielded the same result.

I don't know I'm not sure I'm going to be able to fix this. Could it have to do with how I insantiate the objects? I would really appreciate all help.

thanks.

Comment
Add comment · Show 1
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 Tornado92 · Oct 09, 2014 at 11:13 PM 0
Share

Did you make the network views on your characters observe that script?

1 Reply

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

Answer by StarCrossedGaming · Oct 09, 2014 at 05:42 AM

Try using PUN(Photon Unity Networking) for your networking. It works really well. With this, find some tutorials. I suggest Quill18Creates. He goes in-depth on multiplayer, He could fix this problem, and even make your game better. try that out!

Comment
Add comment · Show 1 · 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 rednax20 · Oct 09, 2014 at 10:12 PM 0
Share

thanks for your help, but I don't want to learn a whole new documentation, but I've made some progress and narrowed down the problem a little more, so I'm going to ask a different question to get to the answer to my problem.

Here's an up vote for your time though!

Edit : heck, I'll give you the best answer too

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

30 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 avatar image avatar image

Related Questions

Smooth network communication like Unity remote 1 Answer

NetworkView Component state update 2 Answers

Pass an array from server to clients 0 Answers

"Trying to send command for object without authority" warning but the object is the localPlayer 1 Answer

Network. Send to client server info. 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