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 JonasrDJ · Jul 14, 2012 at 09:28 PM · gameloadlevel

Loadlevel can't see each other.

Me and a friend are working on a game and we made it so when a player succesfully connects to the host it loads a scene. The problem is when we load the scene on 2 different computers we can't see each other like we are suppost to. Everything else works fine. Anybody got a clue why this is happening and is there any function we can add? We use the function Application.LoadLevel and we tried adding Object.DontDestroyOnLoad but we still can't see each other. - Thanks on forehand.

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
0

Answer by programmrzinc · Jul 14, 2012 at 09:45 PM

is there code in your level that shows the models?

let me give you a scenario. If you and your friend see each other, add a dime to your pocket. You wont have 20 cents in your pocket just because you started something at the same time.

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 JonasrDJ · Jul 14, 2012 at 11:19 PM 0
Share

I don't think so. How could such code look?

avatar image
0

Answer by JonasrDJ · Jul 14, 2012 at 11:46 PM

I don't think so. This is how our ConnectGui looks like.

 //DontDestroyOnLoad(this);

var remoteIP = "83.91.127.166"; var remotePort = 25000; var listenPort = 25001; var remoteGUID = ""; var useNat = false; var playerPrefab : Transform; private var connectionInfo = "";

function OnGUI () { GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Space(10); if (Network.peerType == NetworkPeerType.Disconnected) { useNat = GUILayout.Toggle(useNat, "Use NAT punchthrough"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(10);

GUILayout.BeginVertical(); if (GUILayout.Button ("Connect")) { if (useNat) { if (!remoteGUID) Debug.LogWarning("Invalid GUID given, must be a valid one as reported by Network.player.guid or returned in a HostData struture from the master server"); else Network.Connect(remoteGUID); } else { Network.Connect(remoteIP, remotePort); } } if (GUILayout.Button ("Start Server")) { Network.InitializeServer(32, listenPort, useNat); // Notify our objects that the level and the network is ready for (var go in FindObjectsOfType(GameObject)) go.SendMessage("OnNetworkLoadedLevel", SendMessageOptions.DontRequireReceiver);

} GUILayout.EndVertical(); if (useNat) { remoteGUID = GUILayout.TextField(remoteGUID, GUILayout.MinWidth(145)); } else { remoteIP = GUILayout.TextField(remoteIP, GUILayout.MinWidth(100)); remotePort = parseInt(GUILayout.TextField(remotePort.ToString())); } } else { if (useNat) GUILayout.Label("GUID: " + Network.player.guid + " - "); GUILayout.Label("Local IP/port: " + Network.player.ipAddress + "/" + Network.player.port); GUILayout.Label(" - External IP/port: " + Network.player.externalIP + "/" + Network.player.externalPort); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button ("Disconnect")) Network.Disconnect(200); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); }

function OnServerInitialized() { if (useNat) Debug.Log("==> GUID is " + Network.player.guid + ". Use this on clients to connect with NAT punchthrough."); Debug.Log("==> Local IP/port is " + Network.player.ipAddress + "/" + Network.player.port + ". Use this on clients to connect directly."); }

function OnConnectedToServer() { // Notify our objects that the level and the network is ready for (var go in FindObjectsOfType(GameObject)) go.SendMessage("OnNetworkLoadedLevel", SendMessageOptions.DontRequireReceiver ); Application.LoadLevel ("Scene_02"); ;

}

function OnNetworkLoadedLevel () { Network.Instantiate(playerPrefab, transform.position, transform.rotation, 0); }

function OnDisconnectedFromServer () { if (this.enabled != false) Application.LoadLevel(Application.loadedLevel); else FindObjectOfType(NetworkLevelLoad).OnDisconnectedFromServer(); }

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

If Statement Conditional Not Working 1 Answer

A node in a childnode? 1 Answer

How do I create a pause button? 2 Answers

I do a game for the school 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