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 ankitdave · Feb 18, 2016 at 09:20 AM · multiplayer-networking

photon with android

hey friends I made a simple pong game in android. now I want to make it multiplayer so i am using photon for that. I connect to master server then lobby and create room and status==joined i am using unity 5 and PUN simple is that working with android? now how second player join through Ip address or what? how i test in different devices? any tutorial there for photon with android i am new in unity pls help

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Sykoh · Feb 18, 2016 at 05:12 PM

 using UnityEngine;
 using System.Collections;
 
 public class NetworkControllerScript : MonoBehaviour {
 
     GameObject PlayerLight;
 
     // Use this for initialization
     void Start () {
         PhotonNetwork.autoJoinLobby = true;
         PhotonNetwork.ConnectUsingSettings ("1");
     }

     // Display details to user
     void OnGUI(){
         GUILayout.Label(PhotonNetwork.connectionStateDetailed.ToString());
     }

     // When the lobby has been joined, join random room
     void OnJoinedLobby(){
         Debug.Log ("OnJoinedLobby");
         PhotonNetwork.JoinRandomRoom ();
     }

     // If there is no room to join create one.
     void OnPhotonRandomJoinFailed(){
         Debug.Log ("OnPhotonRandomJoinedFailed");
         PhotonNetwork.CreateRoom ( null );
     }
 
     void OnJoinedRoom(){
         Debug.Log ("OnJoinedRoom");
             PhotonNetwork.Instansiate("Paddle");
     }
 }

That's the sort of thing I would be looking at going for to start. I would then start building in being able to check the number of players in a room before joining and only joining if there is a room with 1 player and if not create you own.

You would then use "PhotonView" scripts to sync the balls transform and ridgidbody and the paddle positions. Oh and if you get that far and its a but joggy and horrible hear is a hint "Lerp is your friend".

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

Answer by ankitdave · Feb 22, 2016 at 06:37 AM

@Sykoh thanks for the reply it helped. but now I am stuck at one point, I have two buttons create and join, now if I clicked any of that it will bring me to my next scene which is a two_player scene, if I clicked on create spawn point of paddle is -35 and if I clicked on join it is 35 but how can I know which button I pressed in previous scene. I have added that netwok manager script in empty game object in two_player scene.

Comment
Add comment · Show 2 · 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
avatar image Sykoh · Feb 24, 2016 at 01:13 PM 0
Share

Sounds like you need to create a room list system. This is a more complicated setup and should be thought out first then any smaller aspect of the system should be asked in individual questions that can be answered clearly. Feel free to tag me in to the question once you know what you are looking for specifically.

avatar image ankitdave Sykoh · Feb 25, 2016 at 09:18 AM 0
Share

ya sure. i have an Inputfield which user enter their name but that name i want to display on my next scene as a label or text then what i have to do?

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

UNET is that join multiple matches possible ? 0 Answers

showroom with background music 0 Answers

What is the purpose of the broadcast data sent/received from NetworkDiscovery? 0 Answers

The PlayerPrefab is empty on the Network Manager error is show up on online scene 0 Answers

Multiplayer First Person Game 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