Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by cuddlebunny · May 31, 2016 at 11:59 PM · cameranetworkingplayernetworkphoton

Photon camera problum

Hello Unity Answer, I am a first year college student going to school to be a game developer. That means I am not as good of a programmer as you guys yet. But me and my friends have decided to make a game of mine, a 2D social MMO. Currently, we are having problems with cameras. I don't know how to do it. What I need is a camera to spawn for each player and be activated for each client. Currently, we are spawning the player and the camera but when another player spawns in, they will start using the first user's camera, which means they are all using the first camera spawned in. I don't want that, I want each user to have their own camera, and to have their own camera view. So I went to the Unity Forums to see if anyone could help me with my problem, and one such person did. Would have posted here, but, I see Unity Answer as an area where you only go if you have a broken script or something like that. Since I didn't have a script I didn't feel like I could come here. Now I have broken scripts and I am confused out of my mind. Here is my movement script where I was told to put this piece of code this guy gave me:

 using UnityEngine;
 using System.Collections;
 
 using ExitGames.Client.Photon;
 
 public class PlayerMovement : Photon.MonoBehaviour
 {
     public float speed = 1f;
 
     void Start()
     {
         PhotonNetwork.sendRate = 20;
         PhotonNetwork.sendRateOnSerialize = 10;
 
 
     }
 
     void OnPhotonSerializeView(
         PhotonStream stream,
         PhotonMessageInfo info)
     {
         if(stream.isWriting == true)
         {
             stream.SendNext(speed);
         }
         else
         {
             speed = (float)stream.ReceiveNext();
         }
     }
 
    public GameObject yourObject;
 
     void Awake()
     {
         if (!photonView.IsMine)
         {
           yourObject.SetActive(false);
          
      }
     }
 
 
 
     void Update()
     {
         MovePlayer();
     }
 
     void MovePlayer()
     {
        if (!photonView.isMine)
         {
             return;
 
         }
 
 
 
         {
             if (Input.GetKey(KeyCode.D))
                 transform.position += new Vector3(speed * Time.deltaTime, 0.0f, 0.0f);
 
             if (Input.GetKey(KeyCode.A))
                 transform.position -= new Vector3(speed * Time.deltaTime, 0.0f, 0.0f);
 
             if (Input.GetKey(KeyCode.W))
                 transform.position += new Vector3(0.0f, speed * Time.deltaTime, 0.0f);
 
             if (Input.GetKey(KeyCode.S))
                 transform.position -= new Vector3(0.0f, speed * Time.deltaTime, 0.0f);
         }
     }
  
 }


hare is the piece of code this guy gave me

 void Awake()
         {
             if (!photonView.IsMine)
             {
               yourObject.SetActive(false);
              
          }
    }

Now the only thing my movement script does is disable itself once a player spawns in. I'm 190% sure I'm being an idiot here, so I'm coming to you guys to see what I'm doing wrong, and to get a camera for each player. PS, we are using Photon Framework.

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

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

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

Related Questions

Unity Photon WASD working but Virtual Joystick won't work after another player has joined the network...? How can i sync joystick. 2 Answers

how to spawn a player prefab on a server 0 Answers

Unity Photon doesn't Spawn Player 0 Answers

Lerping to Smooth Network Movement 0 Answers

PHOTON FindFriends (222) not allowed on current server (GameServer) 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