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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by bob brazil · Oct 03, 2013 at 08:18 PM · networkcontrollerserver

character controller problem on network

Hi i have a simple network system ,but when I instantiate a player ,He controls the cliente .,and client controls the server ,what i do ?

//Network script in C#

using UnityEngine;

using System.Collections; public class ServerController : MonoBehaviour {
public string ipToConnect; public int portToConnect; public int numberPlayers;


// Use this for initialization void Start () { ipToConnect = Network.player.ipAddress; }
// Update is called once per frame void Update () {
}
void StartServer(){ if(Network.peerType == NetworkPeerType.Disconnected){ Debug.Log(Network.InitializeServer(numberPlayers, portToConnect, false)); } }
void ConnectToServer(){ if(Network.peerType == NetworkPeerType.Disconnected){ Debug.Log(Network.Connect(ipToConnect, portToConnect)); } }
void OnGUI(){ if(Network.peerType == NetworkPeerType.Disconnected){ if(GUI.Button(new Rect(Screen.width/2-100, 10, 200, 30), "Inicializar Servidor")){ StartServer(); } ipToConnect = GUI.TextField(new Rect(Screen.width/2-100, 40, 200, 30), ipToConnect); if(GUI.Button(new Rect(Screen.width/2-100, 70, 200, 30), "Conectar ao Servidor")){ ConnectToServer(); } } }
//Player script in Java #pragma strict var velocidadeFrente : float; var velocidadeCima : float; var velocidadeLado : float;
function Start () { if (!networkView.isMine) { enabled =false; } }


function Update () {
if (networkView.isMine)


velocidadeCima = 30*Time.deltaTime; velocidadeFrente = 50*Time.deltaTime; velocidadeLado = 40*Time.deltaTime;






if(Input.GetKey("w")) { transform.Translate(0,0,velocidadeFrente); }
if(Input.GetKey("s")) { transform.Translate(0,0,-velocidadeFrente); }
if(Input.GetKey("a")) { transform.Translate(-velocidadeLado,0,0); } if(Input.GetKey("d")) { transform.Translate(velocidadeLado,0,0); } }
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 FrankStarsKo · Oct 03, 2013 at 10:05 PM 0
Share

does this help you? http://answers.unity3d.com/questions/206617/network-fps-help-asap.html

by the way are you using a server in particular? i wanted to start making multiplayer game but with no good documentation i just left my project behind

avatar image bob brazil · Oct 04, 2013 at 11:59 PM 0
Share

pls Somebody help me

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

15 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

Related Questions

Multiple Cars not working 1 Answer

other players and the server does not receive networkView.RPC 1 Answer

Orbit Script V2 Walking Problem 0 Answers

How can i set up a server then connect to it? 0 Answers

Unity networking,Cant see each other move 2 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