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 D3m0nE · Aug 18, 2013 at 10:15 AM · networkrpcloadlevel

Unity3d Network - Cant See Connected Players

Hello everyone

i was working on Network Script but i got 1 problem

that the new player cant see the old players

for example :

there is 3 Clients are Connected and Players are Instantiated

the Client1 can See Client 2 and Client 3 Players the Client 2 can see Client 3 Player Client 3 Cant see any players

so only the first Player can see connected People

i'm totally sure that the problem in the way i use to change Level

i use :

     void Awake(){
     DontDestroyOnLoad(this);    
     }
     
 
 
 void OnServerInitialized(){
         Debug.Log("Created! and now go to the map");
         Application.LoadLevel(1);
         
     }
 
 
     void OnPlayerConnected(NetworkPlayer networkPlayer)
     {
     
         networkView.RPC("TellPlayerServerName", networkPlayer, serverName);
             
     }
 
 
     [RPC]
     void TellPlayerServerName (string servername)
     {
         Application.LoadLevel(1);
         serverName = servername;    
     }
 
 
 
 //// and now after the map is loaded  i call Spawn Function
 
 private void SpawnPlayer(){
     Debug.Log("Spawning PlayeR");
     Network.Instantiate(Player,new Vector3(0,0,0),Quaternion.identity,0);
     }
 
 




thats not my full script its just the part of Changing the Scene from MainMenu to Map Scene

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

3 Replies

· Add your reply
  • Sort: 
avatar image
-1

Answer by Ashutosh8126 · Sep 14, 2013 at 06:50 AM

Use RPC mode buffered...

Comment
Add comment · Show 1 · 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 D3m0nE · Sep 14, 2013 at 08:46 AM 0
Share

if You Could give me Example i would be GreatFull

avatar image
0

Answer by Benproductions1 · Aug 18, 2013 at 11:32 PM

Hello,

Most of the code you have posted is completely irrelevant, however I believe I can predict what you are doing wrong XD

My guess is that you have built your own spawning system.

 //my guess is that you have a list of players
 List<Player> playerList = new List<Player>()
 
 //then when someone joins (as you already have)
 void OnPlayerConnected(NetworkPlayer networkPlayer) {
     //you simply iterate through your players and spawn them for the newcomer
     foreach (player p in playerList) {
         networkView.RPC("SpawnPlayer", networkPlayer, \*etc*\);
     }
 }

Hope this helps,
Benproductions1

Comment
Add comment · Show 11 · 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 D3m0nE · Aug 26, 2013 at 08:22 AM 0
Share

Thanks but Same problem

How I Can Send The Players to one $$anonymous$$ap So they can See Each other

someone told me that i should use prefix

avatar image Benproductions1 · Aug 26, 2013 at 08:26 AM 0
Share

$$anonymous$$y code solves that problem if you implement it correctly. If you don't how can you expect it to work?

"Thanks but Same problem", please elaborate

avatar image D3m0nE · Sep 13, 2013 at 04:56 AM 0
Share

i think your code would work if i made Game ROO$$anonymous$$

but its not what i need

in my Game One Person Do "Host Game" then he go to the $$anonymous$$ap

then other Player Need to Put IP:Port then Connect

They will be sent to the Same $$anonymous$$ap

but the problem that > New Connect People Cant see Old Connected People

avatar image Benproductions1 · Sep 13, 2013 at 06:56 AM 0
Share

Note that Network.connections on client will only show the server. That is why I answered the way I did. $$anonymous$$y method works and does exactly what you want. You just have to use it correctly

avatar image D3m0nE · Sep 14, 2013 at 05:49 AM 0
Share

umm still cant get it

can i put a another Simple Example? :

$$anonymous$$e And 2 $$anonymous$$y Friend are Playing

$$anonymous$$e : Created The Server Then I Have Been Sent To The $$anonymous$$ap

Friend1 : Connected To $$anonymous$$e and He Joined With $$anonymous$$e In The $$anonymous$$ap

Friend2 : Connected To $$anonymous$$e and He Joined With $$anonymous$$e In The $$anonymous$$ap

Now :

$$anonymous$$e Can See Freind1 And Freind2 (i $$anonymous$$ean See The Instantiated Player Prefab)

Friend1 Can Only See Freind2

Friend2 Cannot See Anyone


illation : The Oldest Connected Player Can See The Newest Players But The Newest Cant See The Oldest

Sorry For Bad English

Edit

i Tested Your COde and it worked with me but not in the way i need

u know i let the Connected Players Join together in Room

then They Start Together . your code work fine here

but its not work if there is new player joined

Show more comments
avatar image
0

Answer by dc. · Apr 21, 2014 at 08:44 AM

Here is an example, change where needed

 networkView.RPC("YourFunction", RPCMode.AllBuffered, VariablesToPassToFunction);
 
 [RPC]
 void YourFunction(int Something){
     //Do stuff here
 }
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

18 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

Related Questions

Problem with network flashlight 1 Answer

Networked level loading 0 Answers

Network Instantiate PlayerPrefab Problem 2 Answers

Buffer RPC until I have the right scene loaded 0 Answers

Network.RemoveRPCs Problem. 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