Quantcast
Channel: Multiplayer
Viewing all articles
Browse latest Browse all 16796

Networking HLAPI - Only do something when there is at least 2 players connected

$
0
0
Hi there.

Right now I have the following:

- Scene
- Player Prefab that gets spawned on connection.
- Ball that is a child of player prefab.

I have the following script

Code (CSharp):
  1.  void Start()
  2.   {
  3.   if (isLocalPlayer)
  4.   {
  5.   CmdShoot();
  6.   }
  7.   }
  8.  
  9. [Command]
  10.   void CmdShoot()
  11.   {
  12.   GameObject instance = Instantiate(bullet, transform.position, transform.rotation) as GameObject;
  13.   instance.transform.parent = transform;
  14.   NetworkServer.Spawn(instance);
  15.   RpcSetParent(instance);
  16.   }...
Networking HLAPI - Only do something when there is at least 2 players connected

Viewing all articles
Browse latest Browse all 16796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>