Search Unity

Survival Shooter Multiplayer

Discussion in 'Made With Unity' started by madvas, Jul 1, 2015.

  1. madvas

    madvas

    Joined:
    Jun 14, 2015
    Posts:
    6
  2. Whiteleaf

    Whiteleaf

    Joined:
    Jul 1, 2014
    Posts:
    728
    This is pretty cool! I did this sometimes, I'd branch out off of the Unity tutorials and add more things after I complete it.
     
  3. BozzWong

    BozzWong

    Joined:
    Sep 22, 2012
    Posts:
    4
    Pretty cool work. But when I try to bulid it in unity5.2, it prompt complier error:
    Assets/Scripts/Extensions/StringExtensions.cs(7,72): error CS1061: Type `UnityEngine.Color' does not contain a definition for `ToHexStringRGB' and no extension method `ToHexStringRGB' of type `UnityEngine.Color' could be found (are you missing a using directive or an assembly reference?)

    which version do you use?

    BTW, I'm trying convert the survival shooter to multiplayer version by UNet introduced in Unity5.x, the new network system. But I encountered a problem when spawning the GunBarrelEnd effect(shoot effect) to the client. The code is something like this:
    [Command]
    void CmdShoot ()
    {
    Transform gbe = transform.Find ("GunBarrelEnd");
    timer = 0;
    bullet = (GameObject)Instantiate (bulletPrefab,gbe.position,Quaternion.Euler(0,0,0));

    bullet.GetComponent<Bullet> ().Shoot (gbe);
    Destroy (bullet, 1.0f);
    NetworkServer.Spawn (bullet);
    }
    the GunBarrelEnd a prefab extracted from the player prefab and added a networkidentity component, also is registered in the networkmananger spawnable prefab.

    But when I call the CmdShoot, the shooting effect( facelight and bullet line) only show in the host, never take effect in the client.

    Do you have any suggestion? Thx.