photon 2d camra problum help

Hello internet people, my name is Cuddlebunny. I am a first year programmer student at Gateway Technical College. That means I don’t have enough programming know-how like all of you guys… that’s why I’m here. Me and my friends have decided to make one of my dream games. It is a 2D social MMO. Built on the photon engine we currently have players spawning in it able to move, however, one of the key features we need for our first prototype is a seperate camera spawned in for each player to lock onto them, and move with them. I tried my best to figure this out, however for the past week I have not been able to. That’s why I’m here. I want to ask if anyone can help me with either a tutorial, documentation, or, if anyone has a script…? I don’t want to let my team down and all my friends down on this project because of my stupidity.

So as I understand you want to have own view camera for each player in room. Ok, create another gameobject that is a child of your parent player. Name it “Local” and add a Camera to it. Now when you spawn your player, you need to be sure you are using only your own camera and not the camera of other connected clients in room. Here an example how to prevent using other clients cameras:
Btw: That’s the almost same thing like free moving camera just that here the camera is attached to player.

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

Hope that helps :stuck_out_tongue:

im guessing that i put this in my moving script but sadly i get a error saying that LocalObject name duse not exist can you give me more of a step by step on what to do im sorry im stuped with this kinda stuff

LocalObject is most likely Kamil’s cached instance of .gameObject.
In many cases, Unity will do a lookup inside of properties like .gameObject and .transform, etc., so it makes sense to cache properties you’re using more often.
this.SetActive(false) should be a replacement. You could search for SetActive in the docs and find this:

How should it exist? You have to add the gameobject to your player lol. This gameobject has only local objects added as child like camera,local scripts and so on. And after that simply disable/enable it with localObj.SetActive(value) if it’s your view or not.