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 Different · Aug 25, 2012 at 02:13 PM · movementmultiplayer

Multiplayer - one player is controlling everyone

I'm using Networking example to create MMO game. And when I connect in 2 places (Unity and Build) everything works fine. Except the thing that when I'll move my player in Unity, me and the 2nd player are moving in the same time. How can I fix this? C# movement script (It's actually from MMO movement from Assets store):

 using UnityEngine;
 using UnityEditor;
 using System.Collections;
 
 [CustomEditor (typeof (ThirdPersonController))]
 public class ThirdPersonControllerEditor : PropertyEditor
 {
     private SerializedProperty targetProperty;
     private SerializedProperty speedProperty;
     private SerializedProperty walkSpeedDownscaleProperty;
     private SerializedProperty turnSpeedProperty;
     private SerializedProperty mouseTurnSpeedProperty;
     private SerializedProperty jumpSpeedProperty;
     private SerializedProperty groundLayersProperty;
     private SerializedProperty groundedCheckOffsetProperty;
     private SerializedProperty showGizmosProperty;
     private SerializedProperty requireLockProperty;
     private SerializedProperty controlLockProperty;
     
     
     private const float rotationSpeedHandleScale = 20.0f;
         // Scales the visualization of the rotation speed handles. Reduce if you're dealing with larger rotation speeds.
     
     
     protected override void Initialize ()
     {
         targetProperty =                 serializedObject.FindProperty ("target");
         speedProperty =                 serializedObject.FindProperty ("speed");
         walkSpeedDownscaleProperty =    serializedObject.FindProperty ("walkSpeedDownscale");
         turnSpeedProperty =             serializedObject.FindProperty ("turnSpeed");
         mouseTurnSpeedProperty =         serializedObject.FindProperty ("mouseTurnSpeed");
         jumpSpeedProperty =             serializedObject.FindProperty ("jumpSpeed");
         groundLayersProperty =             serializedObject.FindProperty ("groundLayers");
         groundedCheckOffsetProperty =     serializedObject.FindProperty ("groundedCheckOffset");
         showGizmosProperty =             serializedObject.FindProperty ("showGizmos");
         requireLockProperty =             serializedObject.FindProperty ("requireLock");
         controlLockProperty =             serializedObject.FindProperty ("controlLock");
     }
     
     
     public override void OnInspectorGUI ()
     {
         BeginEdit ();
             BeginSection ("Target character");
                 PropertyField ("Rigidbody", targetProperty);
             EndSection ();
             
             BeginSection ("Speed");
                 PropertyField ("Movement", speedProperty);
                 PropertyField ("Walk downscale", walkSpeedDownscaleProperty);
                 PropertyField ("Turn", turnSpeedProperty);
                 PropertyField ("Mouse turn", mouseTurnSpeedProperty);
                 PropertyField ("Jump", jumpSpeedProperty);
             EndSection ();
             
             BeginSection ("Grounding check");
                 PropertyField ("Layers", groundLayersProperty);
                 Comment ("This should include anything that the character can land on. Make sure that any part of the character is not in any of these layers.");
                 PropertyField ("Offset", groundedCheckOffsetProperty);
             EndSection ();
             
             BeginSection ("Mouse control");
                 PropertyField ("Require lock", requireLockProperty);
                 PropertyField ("Control lock", controlLockProperty);
             EndSection ();
             
             PropertyField ("Show gizmos", showGizmosProperty);
             
             EndSection ();
             
             WideComment ("This component uses more input than is included in the default input setup:\n\n - An extra axis named \"Sidestep\" - a straight copy of the \"Horizontal\" input axis - mapped to Q (negative) and E (positive).\n\n - An extra button named \"ToggleWalk\" - same setup as the \"Jump\" button, by default mapped to \"+\" (positive).");
         EndEdit ();
     }
     
     
     public override bool RenderSceneHandles
     {
         get
         {
             BeginEdit ();
             return showGizmosProperty.boolValue;
         }
     }
     
     
     public override Color SceneHandlesColor
     {
         get
         {
             return Color.red;
         }
     }
 
     
     protected override void DoSceneGUI ()
     {
         BeginEdit ();
             speedProperty.floatValue = Handles.RadiusHandle (TargetTransform.rotation, TargetTransform.position, speedProperty.floatValue);
                 // Do a wire sphere handle for modifying the speed as a radius
             
             float visualizedRotationAngle = turnSpeedProperty.floatValue * rotationSpeedHandleScale;
                 // Scaling up the angle used in visualization of the rotation speed as we're dealing with low values per default
             
             DrawThickWireArc (TargetTransform, visualizedRotationAngle, speedProperty.floatValue, 20, 0.005f);
                 // Draw the indication of the rotation speed as an angle segment of the planar circle, indicating speed
             
             float change = AngularSlider (
                 TargetTransform,
                 visualizedRotationAngle,
                 speedProperty.floatValue,
                 20.0f * 0.005f * HandleUtility.GetHandleSize (TargetTransform.position)
             ) - visualizedRotationAngle;
                 // Do the slider handle, allowing us to modify the rotation speed from the scene view
             
             if (visualizedRotationAngle + change < 360.0f)
             // Don't allow dragging over 360 degrees. This check is needed since we're scaling up the visual representation of the angle.
             {
                 turnSpeedProperty.floatValue = Mathf.Clamp (turnSpeedProperty.floatValue + change / rotationSpeedHandleScale, 0.0f, 360.0f);
             }
             else
             // Clamp to 360
             {
                 turnSpeedProperty.floatValue = 360.0f / rotationSpeedHandleScale;
             }
         EndEdit ();
     }
 }
 
Comment
Add comment · Show 7
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 Different · Aug 25, 2012 at 02:22 PM 0
Share

Also, don't tell me "Search networkView.is$$anonymous$$ine", I know about it. Just how I can edit this script to make it work.

avatar image ScroodgeM · Aug 26, 2012 at 08:32 PM 2
Share

you'd post a editor for ThirdPersonController that is not used in runtime at all, it's just a editor class for unity editor only. so you needn't edit this script at all.

avatar image ScroodgeM · Aug 27, 2012 at 08:37 AM 1
Share

for TPC that including the unity standard packages, Assets / Standard Assets / Character Controllers / Sources / Scripts / ThirdPersonController.js

avatar image ScroodgeM · Aug 27, 2012 at 09:01 AM 2
Share

what do you want to know about it? this class used to draw inspector in unity editor when you select TPC in project.

avatar image Bunny83 · Aug 27, 2012 at 10:21 AM 1
Share

So since your question asked something completely different what you're asking here in the comments, i suggest to think about your question beforehand and then post it. Can you now please tell us if the question has anything to do with the Custom inspector you've posted here, or with the issue you described in your text?

Show more comments

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

9 People are following this question.

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

Related Questions

Multiple Cars not working 1 Answer

How do I add gravity to my object, and how do I fix my network problem? 1 Answer

Shake and move at the same time 0 Answers

Moving the camera with mouse not working 1 Answer

Command not being called on client 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