- Home /
Photon objects not syncing
I am working on a multlayer third person game and I am using motion controller for animations and photon for network manager.I ahve a problem: when I connect and join the room the other players don't move on others player screen. They move only on their devices. Here is what I deactivated:
using UnityEngine;
using com.ootii.Input;
using com.ootii.Actors;
using com.ootii.Actors.AnimationControllers;
public class netView : Photon.MonoBehaviour {
public Camera cam;
public UnityInputSource uis;
public GameObject canvas;
public ActorController ac;
public MotionController mc;
// Use this for initialization
void Start () {
if (photonView.isMine) {
cam.enabled = true;
uis._IsEnabled = true;
canvas.active = true;
ac.enabled = true;
mc.enabled = true;
} else {
cam.enabled = false;
uis._IsEnabled = false;
canvas.active = false;
ac.enabled = false;
mc.enabled = false;
}
}
}
Here is a video: https://youtu.be/mOaAejsVX04 . In it i am playing in editor and on my phone. In my device I move around and the editor player does not move. Also in editor, the player from the device just stays there, doesn't move while on phone is moveing around.
For input I am using CrossPlatformManager class. How can I repair it?
Answer by mafima · Nov 30, 2017 at 01:25 PM
the player needs 2 things: PhotonView, which you already have. and PhotonTransform. then you drag your PhotonTransform into Photonview Observed Components.
Whenever the transform changes it synchs them for every photonview. thats basicly it. for moving them correctly you have to do that:
public class mymovement: Photon.MonoBehaviour {
// MOVEMENT STUFF
// Use this for initialization
void Start () {
if (!photonView.isMine) {
this.enabled=false; //disable the movescript if photonview is not mine.
}
Thank YOU SOO $$anonymous$$UCH man I was going crazy about that really thank you
Your answer
Follow this Question
Related Questions
Photon network won't join random room with a custom property 0 Answers
Is that any way to pass list of array through photon? 0 Answers
hi i need help with code 1 Answer
Photon Server vs Dedicated Master Client with PUN 1 Answer
Setting up a GUI System for room selection , Multiplayer (Photon/Unet) 1 Answer