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 Cheetoturkey · Jun 30, 2014 at 10:05 PM · networkingfpsphoton

Photon Cant see other players

Hello i am using photon and when i play i cant see other players. using UnityEngine; using System.Collections;

 public class NetworkManager : Photon.MonoBehaviour {
 
     string roomName = "My Room";
     bool ShowGUI = true;
     public GameObject Spawn;
 
     void Start()
     {
 
         }
 
     // Use this for initialization
     void Awake () {
         if (PhotonNetwork.connectionStateDetailed == PeerState.PeerCreated)
         {
             // Connect to the photon master-server. We use the settings saved in PhotonServerSettings (a .asset file in this project)
             PhotonNetwork.ConnectUsingSettings("1.0");
         }
     }
     
     void OnGUI() {
         if (ShowGUI) {
                         GUILayout.BeginArea (new Rect ((Screen.width - 400) / 2, (Screen.height - 350) / 2, 400, 300));
         
                         GUILayout.Space (25);
                         if (GUILayout.Button ("Join Room", GUILayout.Width (100))) {
                                 PhotonNetwork.JoinRoom (this.roomName);
                         }
                         GUILayout.Label ("Roomname:", GUILayout.Width (100));
                         this.roomName = GUILayout.TextField (this.roomName);
                         GUILayout.Label (PhotonNetwork.countOfPlayers + " users are online in " + PhotonNetwork.countOfRooms + " rooms.");
         
                         if (GUILayout.Button ("Create Room", GUILayout.Width (100))) {
                                 PhotonNetwork.CreateRoom (this.roomName, new RoomOptions () { maxPlayers = 10 }, null);
                         }
                         GUILayout.Label (PhotonNetwork.connectionStateDetailed.ToString ());
                         GUILayout.EndArea ();
                 }
     }
     // We have two options here: we either joined(by title, list or random) or created a room.
     
     public void OnCreatedRoom()
     {
         Debug.Log("OnCreatedRoom");
         ShowGUI = false;
     }
     
     public void OnDisconnectedFromPhoton()
     {
         Debug.Log("Disconnected from Photon.");
     }
     
     void OnPhotonRandomJoinFailed() {
         PhotonNetwork.CreateRoom(null);
     }
     
     void OnJoinedRoom() {
         ShowGUI = false;
         GameObject Soldier = PhotonNetwork.Instantiate( "Player", Spawn.transform.position, Quaternion.identity, 0 );
         Soldier.gameObject.GetComponent<PlayerController>().enabled = true;
         Soldier.gameObject.GetComponentInChildren<Camera>().enabled = true;
         Soldier.gameObject.GetComponentInChildren<MouseLook>().enabled = true;
         Debug.Log("OnJoinedRoom");
     }
 }
 
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Jeff00001 · Jun 30, 2014 at 11:20 PM

I don't think you need the void awake. Just:

 void Connect() {
     PhotonNetwork.ConnectUsingSettings( "1.0" );
 }
Comment
Add comment · Share
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

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

22 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

Related Questions

Syncing FPS Firing Sound over network via RPC {PHOTON} 1 Answer

Unity PhotonNetwork globally enable a component 1 Answer

Photon Networking Instantiating Problem 0 Answers

[PHOTON PUN] Players cant shoot each other? 1 Answer

Photonview "this" does not exist in current context 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