简体   繁体   中英

Unity networking without a player prefab (C#)

I would like to add multiplayer to my game. I use UMA ( https://www.assetstore.unity3d.com/en/#!/content/13930 ) to generate a character in a character creation scene. I then use:

DontDestroyOnLoad(characterController);

To take the player to my main game scene. The UMA generated player cannot be made a prefab, cannot be duplicated or instantiated (not sure why but it doesn't work). So I then via script move the player to the spawn position where they can play the game.

I have made multiplayer games before, but in all of them I use

Network.Instantiate(playerPrefab);

to add the player to the game. The problem here is that I have no idea (nor could I find out online) how to implement multiplayer with a character ALREADY in the scene.

Any help, ideas, advice or suggestions would help me out a lot !

You can instantiate only the GameObject that has the scripts to control the player and search for the models generated by UMA which are already in the scene.

By the way, if you're using Unity 5.1 or newer Network.Instantiate is not used anymore. http://docs.unity3d.com/Manual/net-NetworkInstantiate.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM