• 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
Question by PylonCrow · Mar 24, 2017 at 03:44 AM · networkingplayernetworkspawningclient-server

IS it possible to have delayed player spawning after server connection? (UNet)

I feel like this is a stupidly simple question, but ive searched for 2 days now and found nothing just to perform this simple task.

Overview of what I'm trying to do: I want both players to connect, select character and THEN SPAWN THE CHARACTERS. I do not want the player character to be spawned when the player connects. This seems extremely simple but due to everything beind inside a magic black box for server/client callbacks when players connect this just isn't happening.

Here's what I've tried so far:

   public override void OnServerConnect(NetworkConnection conn)
     {
         Debug.Log("Player " + iNumActivePlayers + " connected from " + conn.hostId);
         connections.Add(conn);
         base.OnServerConnect(conn);
     }

store the connections in a list of connections when someone connects. then when i click a button on the HOST I want all clients to spawn their own characters. and have them play out as if they spawned instantly on connection

Is the only way to do this by adding another game object to the scene, give it a new scripts that inherits networkbehaviour and have that call ClientScene.AddPlayer() ? via [Command] and [RpcClient] functions?

I feel like i'm not understanding something about this behavior or i'm not overriding functions properly.

Any help would be appreciated literally every single tutorial for this is barebones " spawn the player instantly when people connects" and every other question ive seen on this still is instant spawning.

Comment

People who like this

0 Show 0
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

1 Reply

  • Sort: 
avatar image

Answer by Halfbiscuit · Mar 24, 2017 at 10:52 AM

On our project we have "Dummy" player objects which store basic data about the connected clients. These are then spawned on connection. Then later on we spawn the actual player character using this data.

Comment

People who like this

0 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 PylonCrow · Mar 24, 2017 at 02:40 PM 0
Share

Makes sense. But say my actual player has like 7 scripts that need initialization and a certain mesh hierarchy. and the dummy is just an empty gameobject with some script holding logic with a network identity attached as well. how would i go about replacing the actual "player" in reference to the network manager's "player" for the character, such that it operates the same, i.e: both players see it but only the respective clients control it?

avatar image Halfbiscuit PylonCrow · Mar 24, 2017 at 02:52 PM 0
Share

We are using a dominant server model so we send inputs across via command functions on the dummy player and move the 'actual player' accordingly on the server. I believe there is a way to give specific client authority on non player network objects (on the network identity object?),which may get you closer to your goal.

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Creating a client player and a host player in a single device and networking them correspondingly 0 Answers

Spawn dynamic players over network 0 Answers

how to use NetworkServer.SendToClient ? 0 Answers

How to avoid spawn delay on client? 0 Answers

Synchronizing Gameobjects over a Network Server < - > Client Sync 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