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 TBiggums · Apr 14, 2013 at 04:58 AM · photonenableinitialize

Enabling a component on initialization/Photon Cloud Problem

So in my multiplayer game each time I initialize a player when they join a room I need to enable certain components in that instance, and not in others like its camera, and movement. What has been happening is when I do something like move my mouse around on one client it also moves around on the other. I would like some way to stop this. Here is my code now.

 void OnJoinedRoom()
     {
         GameObject player = PhotonNetwork.Instantiate("ClientPlayer", Vector3.zero, Quaternion.identity, 0);
         CharacterMotor controller = player.GetComponent<CharacterMotor>();
         MouseLook camera = player.GetComponent<MouseLook>();
         camera.enabled = true;
     }
Comment
Add comment · Show 5
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 Loius · Apr 14, 2013 at 04:54 PM 0
Share

well, that snippet of code will only affect the newly-created object.

You'd have to be actively sending your mouse information between clients, or using global information, or broadcasting ins$$anonymous$$d of sending targeted function calls, to make them move in sync. Are the clients on the same computer? What does your "everyone is doing this but only one should" code look like?

avatar image TBiggums · Apr 14, 2013 at 05:28 PM 0
Share

I have tested it on two computers with the same result. Photon servers use this thing called photonview to broadcast player position and other things to the other clients. I have it set up to where it will just broadcast the whole first person controllers transforms (ClientPlayer) to every client. You can read about it the photonview section of this tutorial : http://doc.exitgames.com/photon-cloud/$$anonymous$$arco_Polo_Tutorial/#cat-tutorials

Also here is a picture of how I have it set up: Walt textW

photonviewproblem.png (80.7 kB)
avatar image Loius · Apr 14, 2013 at 05:41 PM 0
Share

I don't have personal experience with Photon; all I can do is point to the "Fight for Control" bit of that tutorial. Try pausing your game while it's running and exa$$anonymous$$ing all the existing player object; see if perhaps their components are enabled when they shouldn't be.

avatar image TBiggums · Apr 14, 2013 at 06:08 PM 0
Share

Ugh...I gone through the tutorial multiple times and I have messed with the components while it is running with the same result no matter what I do. It is weird that once two players are in the room one client controls the other but not itself and vice versa.

avatar image leochou2ha · Mar 13, 2014 at 11:18 AM 0
Share

I also have this question that 2 players will control the other when they in one room. Do you figure out what the problem is?

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

13 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

Related Questions

Enabling component - Please help 1 Answer

How do I enable a camera from another GameObject? 1 Answer

Enable My Script on Spawn 0 Answers

"Initializing connection" 0 Answers

How do I access variables initialized in a start function from another script? 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