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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by OpenSky · Mar 24, 2014 at 07:31 PM · c#androidbugphoton

Photon networking doesn't sync

Hello everybody! I write here today, because I have a problem with my Unity game, and specially with Photon Networking. I am making a multiplayer FPS for Android (maybe IOS) using Unity, and for the network, Photon Networking.

My problem is : when i test the game using Bluestacks on Windows and my Nexus 7, I can see the other player connecting, but GUI.Label(new Rect(0, 140, 250, 100), "Total persons : " + PhotonNetwork.countOfPlayers); show me only 1, whereas on the other device it's wrote 2. And when I move the player, he hasn't move on the other device, and vice-versa. However, I have a photon view attached to the prefab, which is observing the prefab. I think I made something wrong, or it's because of player prefab.

My prefab look like that :

PlayerDefaultPrefab
|>player
|>Controls
||>ButtonA
||>ButtonB
||>JoystickCircle
|||>thumbArea
|||>thumbFinger
|>Camera Pivot
||>Main Camera

This is my NetworkManager.cs script:

 using UnityEngine;
 using System.Collections;
 using System.Collections.Generic;
 
 public class NetworkManager : MonoBehaviour {
     public Transform script1;
     public Transform playerPrefab;
     public Camera standByCamera;
     SpawnSpot[] spawnSpots;
 
     void Start() {
         spawnSpots = GameObject.FindObjectsOfType<SpawnSpot>();
         Connect();
     }
 
     void SpawnPlayer() {
         if(spawnSpots == null) {
             Debug.LogError("WTF?!");
             return;
         }
         SpawnSpot mySpawnSpot = spawnSpots[Random.Range(0, spawnSpots.Length)];
         //GameObject myPlayerGO = (GameObject)PhotonNetwork.Instantiate("PlayerDefaultPrefab", mySpawnSpot.transform.position, mySpawnSpot.transform.rotation, 0);
         GameObject myPlayerGO = (GameObject)PhotonNetwork.Instantiate("PlayerDefaultPrefab", Vector3.zero, Quaternion.identity, 0);
         standByCamera.enabled = false;
 
         myPlayerGO.transform.FindChild("Controls").gameObject.SetActive(true);
         myPlayerGO.transform.FindChild("Camera Pivot").gameObject.SetActive(true);
 
         ((MonoBehaviour)myPlayerGO.transform.FindChild("player").GetComponent("AnimationControllerExt")).enabled = true;
     }
 
     void OnGUI() {
         GUILayout.Label(PhotonNetwork.connectionStateDetailed.ToString() );
     }
 
     void Connect() {
         Debug.Log("Works!");
         PhotonNetwork.ConnectUsingSettings("Debug");
     }
     
     void OnJoinedLobby() {
         Debug.Log("JoinedLobby");
         PhotonNetwork.JoinRandomRoom();
     }
     
     void OnPhotonRandomJoinFailed() {
         Debug.Log("JoinFailed");
         PhotonNetwork.CreateRoom(null);
     }
     
     void OnJoinedRoom() {
         Debug.Log("JoinedRoom");
         SpawnPlayer();
     }
     
     void OnCustomAuthenticationFailed() {
         Debug.Log("Error connecting");
     }
 
     void OnDisconnectedFromPhoton() {
         Debug.Log("Player disconnected :(");
         Application.LoadLevel(0);
     }
 }

If you want some other informations please say it. Also, I am sorry for my english, I am not english ;) I can add some screens. Otherwise, is thare a tutorial for making an Android multiplayer FPS ? Thank you soooo much!

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

20 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

Related Questions

How To Call Health Script From Another Script ? 1 Answer

Multiplayer: client cant see host C# 0 Answers

Android Downloading Packages Online 2 Answers

null texture passed to GUI.DrawTexture 0 Answers

Run Function when user shakes mobile andriod unity c# 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