6/7/2023 0 Comments Get networkview id![]() Strange behaviour may occurĬould't invoke RPC function 'SpawnPlayerPrefab' because the networkView 'SceneID: 1 Level Prefix: 0' doesn't exist View ID SceneID: 1 Level Prefix: 0 not found during lookup. spits out debug.log receive RPC debug message but my SpawnPlayerPrefab RPC is never called NetworkView.RPC("SpawnPlayerPrefab", RPCMode.OthersBuffered, viewID, transform.position) //create the ship on all the clients manually because not using Network.Instantiate call instantiate on my prefab and add it to a list of players serverside (not Network.Instantiate) NetworkViewID viewID = Network.AllocateViewID() Void OnPlayerConnected(NetworkPlayer player) Network.Connect(connectToIP, connectPort) ![]() (skipping all non network code to make this simple) (At least I think that is what the error means)īasically this is what I am doing, but I must be missing a step client side. Has anyone put together a step by step guide of network code only to explain how to do start using the non Network.Instantiate method? I tried remaking the steps from the tutorials without it but my client fails when it receives the RPC I am calling to instantiate my prefab client side because the prefab has no networkview ID yet. When I use it I get working networked objects, but nothing deletes on the server when clients disconnect, so I'm assuming thats the problem with it, but I don't know. Most of the forum posts say not to use it as well, though never really explaining why. All the tutorials use this, and then the guide says don't use this. This small update should be available today/tomorrow I have purchased and gone through the tutorial, as well as reading everything I can on the forums but I still have a few things I don't understand.įirst, I don't see a good simple yet complete example of how to NOT use Network.Instantiate. only one instance of itself around at all times. The MultiplayerFunctions script makes sure there's max. Thats why I -also- added the Multiplayer Functions to the game scenes now.This will not cause any problems. If you run the game scene directly from the editor the MultiplayerFunctions.cs needs to be present in the game scene. If you first load the main menu, it's "persistent" object (has MP functions + makepersistent attached) will be made persistent, therefore when you load the game scene this gameobject will still be around. ![]() This script simply marks its gameobject as DontDestroyOnLoad to make it persistent: We need it to easily ensure the MultiplayerFunctions.cs is available in all scenes. The missing script was the MakePersistent.js. "Small bugfix in three example scenes, the "persistent" object missed the MakePersistent script" Just submitted a minor update to fix that missing script issue: Please let me know when it's finished Legend, TheRedTape: (Persistent missing script) Let me know if you still have any open questions after Quietus and my replies.Ĭlick to expand.Cool, good luck with that project, I'm curious to your end result. I do plan to use Photon some time and write a similar tutorial for it, but that won't be any time soon just yet. I only have a list of networking alternatives naming them. Smartfox/Photon or any other networking library all work a bit different and are not covered in this tutorial. You could take that a bit further and fully integrate your own server lobby data in the game via php/mysql. But to easily enable a server list on my website I also have server register to my custom php/mysql webend ( see here). In cubelands I register servers to the master list and use this to connect. But you can not customize the Unity end regarding registering and fetching the host list so you can't extend that on the server either. You can modify the masterserver (source code is available) and host it on your own server. However you probably want more customization? Do note that you can use the master servers comment field to store a lot of custom data/properties (Server is Dedicated, has custom textures, is deathmatch etc.). Click to expand.An RTS like lobby is in the examples.
0 Comments
Leave a Reply. |