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 Tim-A · Aug 04, 2012 at 08:29 PM · multiplayer

MUltiplayer

I have made a multiplayer game that makes a first person controller spawn when they press start server. Now i went on another computer to do the same and it spawned in the same spot and one person moves both of them. HELP please.

Comment
Add comment · Show 4
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 williampigmeu · Aug 04, 2012 at 10:33 PM 0
Share

Search for tutorials on Youtube, they are a lot.

avatar image Chris12345 · Aug 04, 2012 at 10:37 PM 0
Share

look at unity's multiplayer tutorial.

avatar image Chesley · Sep 03, 2012 at 07:22 PM 0
Share

are you using Unity's Networkng? or SmartFox or something else?

avatar image Tim-A · Sep 03, 2012 at 09:25 PM 0
Share

Unity's network

5 Replies

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

Answer by williampigmeu · Sep 04, 2012 at 02:42 AM

function Start(){ if(!NetworkView.ismine){ MovementControlScript.enabled = false; } }

This will work fine.

Comment
Add comment · 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
0

Answer by strachpr01 · Aug 05, 2012 at 12:21 PM

Add a network view to your objects then use

Void Start(){

If(!NetworkView.is mine){

Playercontrolscript.enabled=false;

}

}

Comment
Add comment · Show 6 · 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 Tim-A · Sep 02, 2012 at 05:20 PM 0
Share

Is that C#?

avatar image PProductions · Sep 02, 2012 at 05:32 PM 0
Share

that is C#, a javascript conversion would look like this:

function Start() { If(!NetworkView.is $$anonymous$$e){

Playercontrolscript.enabled=false;

}

}

avatar image Tim-A · Sep 02, 2012 at 06:20 PM 0
Share

There is a error that says, BCE0044: expecting ), found '$$anonymous$$e'.

and BCE0043: Unexpected token: ).

and lastly BCE0044: expecting :, found '='.

What did I do wrong?

avatar image by0log1c · Sep 02, 2012 at 06:28 PM 1
Share

There are mistakes in these examples, guys. C# should read 'void' and not 'Void', also 'is $$anonymous$$e' is not even a valid variable name, you meant 'is$$anonymous$$ine'.

avatar image Tim-A · Sep 02, 2012 at 06:52 PM 0
Share

Parsing error Unexpected symbol `{'

A namespace can only contain types and namespace declarations.?

what am I doing worng????

Show more comments
avatar image
0

Answer by draulleo · Sep 02, 2012 at 07:15 PM

Nonono, Just go to Player Setting and do Run in Background at one of the options :D

Comment
Add comment · Show 6 · 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 Tim-A · Sep 02, 2012 at 07:51 PM 0
Share

I still control both people.

avatar image williampigmeu · Sep 08, 2012 at 07:06 PM 0
Share

function Start(){ if(!NetworkView.is$$anonymous$$e){ $$anonymous$$ovementControlScript.enabled = false; } }

Works fine for me.

avatar image Tim-A · Sep 08, 2012 at 07:44 PM 0
Share

I got this error,BCE0005: $$anonymous$$ identifier: '$$anonymous$$ovementControlScript'.

avatar image strachpr01 · Sep 09, 2012 at 07:47 PM 0
Share

$$anonymous$$ovementcontrolscript needs to be changed to the name of the script that is controlling your player

avatar image Tim-A · Sep 09, 2012 at 07:52 PM 0
Share

So it would be fpsinputcontroller.enabled = false; right

Show more comments
avatar image
0

Answer by rokyed · Sep 29, 2012 at 07:21 AM

i suggest only to implement this :

in the controller script :

define a variable as boolean like :

 var thisOneIsMine=false;
 
 function Start(){
  if(networkView.isMine){
   thisOneIsMine=true;
  }else{   
   thisOneIsMine=false;
  }
 }
 
 function Update(){ 
  //or FixedUpdate or whatever function u want
 
  if(thisOneIsMine){
   //do here all the controller implementation
   //like : inputs , speeds directions rotations 
  }
 }


this is how i did it and i am new to network

Comment
Add comment · 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
0

Answer by FaZeY Designs · Dec 16, 2012 at 01:53 PM

Im new to scripting but i edited on of your scripts and found this worked. If you are using the FPS Controller that came with the standard assets do the following:

  1. create a C# script and name it IsMyPlayer.

  2. Copy and past the script below.

  3. Save and add to camera.

using UnityEngine; using System.Collections;

public class IsMyPlayer : MonoBehaviour {

void Start() {

if(! networkView.isMine) { GetComponent().enabled=false;

}

} }

Comment
Add comment · 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

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

17 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

Related Questions

Unity networking tutorial? 6 Answers

Multiplayer FPS Bullets: should they be rigid bodies or raycast? 1 Answer

What am I doing wrong? (Scripting question) 1 Answer

Need help with AI in multiplayer 1 Answer

StarTrooper Download 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