Search Unity

Survival Shooter Q&A

Discussion in 'Community Learning & Teaching' started by willgoldstone, Jul 3, 2015.

  1. gwnguy

    gwnguy

    Joined:
    Apr 25, 2017
    Posts:
    144
    You have a misplaced line at line 58. Currently, the method void Animating is seen as part of the method void Turning.
    You need to move the closing bracket from line 58 to line 52 (thereby closing the Turning method)
     
  2. ToxicSeaSponge

    ToxicSeaSponge

    Joined:
    Sep 25, 2017
    Posts:
    6
    Thank you so much, I think I could have looked at that for hours and just taking that for granted.
     
  3. NewbieJD

    NewbieJD

    Joined:
    Jul 15, 2017
    Posts:
    2
    Sorry, has any sort any idea with this? I'm still totally stuck!
     
  4. amstaker

    amstaker

    Joined:
    Sep 30, 2017
    Posts:
    2
    I belive checking the Apply Root Motion took care of this for me, it was set by default on the Zombunny.

     
  5. gwnguy

    gwnguy

    Joined:
    Apr 25, 2017
    Posts:
    144
    I can't guarantee any help, but perhaps you could post the code snippet you have modified. Then, perhaps people could duplicate your mods and see if they could offer help.
     
  6. jdrobinson99

    jdrobinson99

    Joined:
    Sep 30, 2017
    Posts:
    2
    Hey, I just opened the project file and took a look around. However I noticed that while the game is running, each enemy spawns with a point light of a certain color; I couldn't find it in the enemies' prefabs nor any reference to it in the script files. I looked on the tutorial site which provided transcripts to all the videos, and I can't find any place where it's mentioned. The materials' emission color also doesn't affect the point light color.

    What is creating the point lights on every enemy?
     
  7. gwnguy

    gwnguy

    Joined:
    Apr 25, 2017
    Posts:
    144
    I'm not sure how it was done in the example (I don't remember).
    It seems that in my game, I attached a Point Light source.
    It is several months since I did it, and I don't remember anything about it, so make of this what you will.


    upload_2017-10-2_16-52-58.png

    upload_2017-10-2_16-51-31.png

    upload_2017-10-2_16-56-2.png
     
    Last edited: Oct 3, 2017
  8. jdrobinson99

    jdrobinson99

    Joined:
    Sep 30, 2017
    Posts:
    2
    Weird. In the prefabs, there's hit/death particles parented to the ZomBunny object; there's also a "Zombunny" model attached with no children. When I drag it onto the scene hierarchy... the "Zombunny" child suddenly gains a child that's a point light. Strange.
     
  9. kentg1

    kentg1

    Joined:
    Dec 22, 2014
    Posts:
    168
    I just download the project - 5.0 verison. I can see the entire scene in the game view but nothing in scene view? The exact opposite of what you show
     

    Attached Files:

    Last edited: Oct 5, 2017
  10. kentg1

    kentg1

    Joined:
    Dec 22, 2014
    Posts:
    168
    I appears this thread is dead and the project no longer even loads correctly in 2017, I would suggest it be removed so that we do not waste our time trying to even download it
     
    Last edited: Oct 9, 2017
  11. gwnguy

    gwnguy

    Joined:
    Apr 25, 2017
    Posts:
    144
    It could be that you are viewing the bottom (under the floor boards) as opposed to the top, or perhaps on top but looking away from the game play area.
    Try clicking on the upload_2017-10-9_10-37-51.png thing and see if things show up.


    Also, please confirm the transforms and other values for all your game objects:
    upload_2017-10-9_10-39-52.png

    upload_2017-10-9_10-40-22.png

    upload_2017-10-9_10-40-54.png
     
  12. R3n33

    R3n33

    Joined:
    Oct 11, 2017
    Posts:
    3
     
  13. R3n33

    R3n33

    Joined:
    Oct 11, 2017
    Posts:
    3
     
  14. R3n33

    R3n33

    Joined:
    Oct 11, 2017
    Posts:
    3
     
  15. asyrafjetrom

    asyrafjetrom

    Joined:
    May 10, 2017
    Posts:
    1
    Hello, I'm new to new Unity, I have completed the survival shooter tutorial but i have problem. How do i turn shooter survival to first person shooter. please help me
     
  16. carbonitium

    carbonitium

    Joined:
    Oct 18, 2017
    Posts:
    3
    That'd be an interesting angle on that project.
    You need to change how camera works, anchor it to player object somewhere I'd suppose and then script controlls completely different.
    +1 for the idea, interested to see how this could be achieved as a fellow newbie
     
    Tradge20 likes this.
  17. PaTp0H

    PaTp0H

    Joined:
    Oct 30, 2017
    Posts:
    1
    Hello guys, I have such a problem! I did everything as in training, but I got such an error
    NullReferenceException: Object reference not set to an instance of an object
    Player_Health.Death () (at Assets / Scripts / Player_Health.cs: 57)
    Player_Health.TakeDamage (Int32 amount) (at Assets / Scripts / Player_Health.cs: 51)
    EnemyAttack_1.Attack () (at Assets / Scripts / EnemyAttack_1.cs: 79)
    EnemyAttack_1.Update () (at Assets / Scripts / EnemyAttack_1.cs: 63)
    Sends to the playerShooting.DisableEffects () method;
    Monsters are respawning, but when they kill me and I do not die, I can run and beat me and get out the error mentioned above, help someone can
    ! error.png
     
    Last edited: Nov 28, 2017
  18. ssssslavvvvv

    ssssslavvvvv

    Joined:
    Nov 10, 2017
    Posts:
    6
    Hi, I everything working fine except monsters spawning in the wrong places and nav mesh agent doesn't cover a mouse-hole.

    Here is an example of spawning point for zombunny, fresh instance of zombunny created in a wrong place and nav mesh agent settings. If I move the spawn point away from a wall, it acts normal. asdfasdfasd.jpg

    Screen Shot 2017-11-28 at 00.08.56.png

    and the mouse-hole below:

    Screen Shot 2017-11-28 at 00.05.24.png
     
  19. Leede

    Leede

    Joined:
    Oct 4, 2017
    Posts:
    4
    I have gotten half-way through part 7, but there is a problem regarding the lightmap parameters. Specifically, there ARE no lightmap parameters that I am able to edit.
     
  20. ssssslavvvvv

    ssssslavvvvv

    Joined:
    Nov 10, 2017
    Posts:
    6
    Do you mean a Light tag on a GunBarrelEnd?
     
  21. uditsamin

    uditsamin

    Joined:
    Dec 2, 2017
    Posts:
    2
    I get the following eroor and dont know how to fix it

    Lighting data asset ‘LightingData’ is incompatible with the current Unity version. Please use Generate Lighting to rebuild the lighting data. Realtime Global Illumination cannot be used until the lighting data is rebuilt.
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  22. Leede

    Leede

    Joined:
    Oct 4, 2017
    Posts:
    4
    No, the gun raycast is a massive yellow rectangle, not a thin line.
     
  23. Leede

    Leede

    Joined:
    Oct 4, 2017
    Posts:
    4
    Never mind, I fixed it. I found the width parameter.
     
  24. nwzebra

    nwzebra

    Joined:
    Dec 4, 2015
    Posts:
    16
    The Environment prefab has two children called LevelExtent which prevent the player and enemies from falling off the front of the scene.
     
  25. HC_Zhang

    HC_Zhang

    Joined:
    Nov 18, 2017
    Posts:
    6
    Really need help...

    I am doing the harming enemy part.when i fire at Zombunny,i am preety sure the bullet hits its Capsule Collider(check the 'is trigger' of the Capsule Collider the bullet goes through the bunny but unchect it the bullet stops in the bunny ).The problem is the Zombunny neither loses health nor appears hit effect(HitParticles) after shooting it.
    I campared the Script in completed version and mine and didn't find the deference,so i add a Debug sentence in the PlayShooting script.Here is the code(The debug sentence is at line 108):
    PlayerShooting:
    Code (CSharp):
    1. namespace CompleteProject
    2. {
    3.     public class PlayerShooting : MonoBehaviour
    4.     {
    5.         public int damagePerShot = 20;                  // The damage inflicted by each bullet.
    6.         public float timeBetweenBullets = 0.15f;        // The time between each shot.
    7.         public float range = 100f;                      // The distance the gun can fire.
    8.  
    9.  
    10.         float timer;                                    // A timer to determine when to fire.
    11.         Ray shootRay = new Ray();                       // A ray from the gun end forwards.
    12.         RaycastHit shootHit;                            // A raycast hit to get information about what was hit.
    13.         int shootableMask;                              // A layer mask so the raycast only hits things on the shootable layer.
    14.         ParticleSystem gunParticles;                    // Reference to the particle system.
    15.         LineRenderer gunLine;                           // Reference to the line renderer.
    16.         AudioSource gunAudio;                           // Reference to the audio source.
    17.         Light gunLight;                                 // Reference to the light component.
    18.         //public Light faceLight;                                // Duh
    19.         float effectsDisplayTime = 0.2f;                // The proportion of the timeBetweenBullets that the effects will display for.
    20.  
    21.  
    22.         void Awake ()
    23.         {
    24.             // Create a layer mask for the Shootable layer.
    25.             shootableMask = LayerMask.GetMask ("Shootable");
    26.  
    27.             // Set up the references.
    28.             gunParticles = GetComponent<ParticleSystem> ();
    29.             gunLine = GetComponent <LineRenderer> ();
    30.             gunAudio = GetComponent<AudioSource> ();
    31.             gunLight = GetComponent<Light> ();
    32.             //faceLight = GetComponentInChildren<Light> ();
    33.         }
    34.  
    35.  
    36.         void Update ()
    37.         {
    38.             // Add the time since Update was last called to the timer.
    39.             timer += Time.deltaTime;
    40.  
    41. #if !MOBILE_INPUT
    42.             // If the Fire1 button is being press and it's time to fire...
    43.             if(Input.GetButton ("Fire1") && timer >= timeBetweenBullets && Time.timeScale != 0)
    44.             {
    45.                 // ... shoot the gun.
    46.                 Shoot ();
    47.             }
    48. #else
    49.             // If there is input on the shoot direction stick and it's time to fire...
    50.             if ((CrossPlatformInputManager.GetAxisRaw("Mouse X") != 0 || CrossPlatformInputManager.GetAxisRaw("Mouse Y") != 0) && timer >= timeBetweenBullets)
    51.             {
    52.                 // ... shoot the gun
    53.                 Shoot();
    54.             }
    55. #endif
    56.             // If the timer has exceeded the proportion of timeBetweenBullets that the effects should be displayed for...
    57.             if(timer >= timeBetweenBullets * effectsDisplayTime)
    58.             {
    59.                 // ... disable the effects.
    60.                 DisableEffects ();
    61.             }
    62.         }
    63.  
    64.  
    65.         public void DisableEffects ()
    66.         {
    67.             // Disable the line renderer and the light.
    68.             gunLine.enabled = false;
    69.             //faceLight.enabled = false;
    70.             gunLight.enabled = false;
    71.         }
    72.  
    73.  
    74.         void Shoot ()
    75.         {
    76.             // Reset the timer.
    77.             timer = 0f;
    78.  
    79.             // Play the gun shot audioclip.
    80.             gunAudio.Play ();
    81.  
    82.             // Enable the lights.
    83.             gunLight.enabled = true;
    84.             //faceLight.enabled = true;
    85.  
    86.             // Stop the particles from playing if they were, then start the particles.
    87.             gunParticles.Stop ();
    88.             gunParticles.Play ();
    89.  
    90.             // Enable the line renderer and set it's first position to be the end of the gun.
    91.             gunLine.enabled = true;
    92.             gunLine.SetPosition (0, transform.position);
    93.  
    94.             // Set the shootRay so that it starts at the end of the gun and points forward from the barrel.
    95.             shootRay.origin = transform.position;
    96.             shootRay.direction = transform.forward;
    97.  
    98.             // Perform the raycast against gameobjects on the shootable layer and if it hits something...
    99.             if(Physics.Raycast (shootRay, out shootHit, range, shootableMask))
    100.             {
    101.          
    102.                 // Try and find an EnemyHealth script on the gameobject hit.
    103.                 EnemyHealth enemyHealth = shootHit.collider.GetComponent <EnemyHealth> ();
    104.  
    105.                 // If the EnemyHealth component exist...
    106.                 if (enemyHealth != null) {
    107.                     // ... the enemy should take damage.
    108.                     Debug.Log ("enemyHealth!=null!");
    109.                     enemyHealth.TakeDamage (damagePerShot, shootHit.point);
    110.                 }
    111.  
    112.  
    113.                 // Set the second position of the line renderer to the point the raycast hit.
    114.                 gunLine.SetPosition (1, shootHit.point);
    115.             }
    116.             // If the raycast didn't hit anything on the shootable layer...
    117.             else
    118.             {
    119.                 // ... set the second position of the line renderer to the fullest extent of the gun's range.
    120.                 gunLine.SetPosition (1, shootRay.origin + shootRay.direction * range);
    121.             }
    122.         }
    123.     }
    124. }
    The output in console is empty which means that the enemyHealth is always null no matter you hit it or not.
    So the question is why the enemyHealth is null even though i hit the zombunny's capsule collider?

    Thanks in advance!
    here are the screen shots of zombunny and player:
    player.png zombunny.png
     
    Last edited: Dec 19, 2017
  26. gwnguy

    gwnguy

    Joined:
    Apr 25, 2017
    Posts:
    144
    I am suspicious that you may be mixing up scripts from your working scripts directory and scripts from the "Completed Game" directory. The PlayerShooting script listed here is wrapped in the CompleteProject namespace (see line 1). Make sure the script you are actively working on is in the scripts directory, and it is the script referenced by your game objects.

    Personally, I think the "Completed Game" directory is a double edged sword, since scripts from it are often confused with scripts from the working hierarchy.
     
    HC_Zhang likes this.
  27. HC_Zhang

    HC_Zhang

    Joined:
    Nov 18, 2017
    Posts:
    6
    You solved my problem!
    I couldn't find the enemyHealth script because i was looking for the one in CompleteProject namespace instead of the one in unityEngine namespace which is currently attached to the Zombunny in the scene.
    Thank you! You really helped me out.:D:D:D
     
  28. AwsomeRod

    AwsomeRod

    Joined:
    Oct 13, 2012
    Posts:
    3
    I need assistance...

    I'm having problems with my enemies being able to enter the Mouse Hole. They can't seem to enter the mouse hole because the mesh render isn't in the mouse hole. What do I need to do to be able to get the mesh render to cover the floor, mainly mouse hole. Screen Shot 2017-12-20 at 11.10.12 AM.png Screen Shot 2017-12-20 at 11.10.41 AM.png I included an image of the navigation tab, bake. Those are the numbers I'm using. Screen Shot 2017-12-20 at 11.11.16 AM.png
     
  29. Reizardoes

    Reizardoes

    Joined:
    Jan 6, 2018
    Posts:
    2
    Hi, I have a problem in the section of the Audio Mixer.
    When I put to my prefabs the Audio Mixer, in the FX Volume I turn off the volume effects but the enemies make the same noises without any change.
    I don't know what to do pls help.
     

    Attached Files:

    Last edited: Jan 11, 2018
  30. Reknotx

    Reknotx

    Joined:
    Dec 16, 2017
    Posts:
    1
    There is an error in the tutorial with regards to the Nav Mesh.

    Within the PDF that is attached for changes made to Unity 5.x, the instructions depict a few setting changes in relation to the video tutorial content. There are a few errors however which will be listed below.

    1) The time stamp is completely wrong.
    2) The settings are inaccurate and when inputted cause significant errors, such as the cracks in the floorboards not rendering with the nav mesh and causing enemies to start to clip into the floor. Enemies bounce up and down on the Y plane instead of being in a constant frozen state as is desired.
    3) The correct settings, which I found after 45 minutes of forum searching and only found after giving up and looking into the complete version of the game, have step height set to 0.6, Voxel Size is set to 0.38, and Min Region Area is set to 0.1. When entering these settings the entire mesh bakes properly and previous grievances are completely destroyed, there is a small triangle near the mouse hole that is not baked by the nav mesh, however upon testing it seemed to possibly be a small graphical glitch as enemies had no problem walking directly over that single spot.

    Hope this helps for anyone who had the same issues I was having.

    Again do not follow the PDF's instructions for what you need to set the bake to for Navigation, instead use the settings found in the complete game version attached with the assets.
     
  31. Reizardoes

    Reizardoes

    Joined:
    Jan 6, 2018
    Posts:
    2

    And what about the Audio Mixer?
     
  32. jbetts80

    jbetts80

    Joined:
    Jan 6, 2018
    Posts:
    1
    I have the same problem! Did you fix it?
     
  33. justasrimavicius

    justasrimavicius

    Joined:
    Jan 17, 2018
    Posts:
    2
    So i have an idea to upgrade this game. I wanted to add a new gun. I was searching for players bones but i didnt find any. Are they hidden or something, or they dont exist? If they dont, than how could i make it so my new gun sticks to my hand?
     
  34. justasrimavicius

    justasrimavicius

    Joined:
    Jan 17, 2018
    Posts:
    2
    I did everything as shown in the video and everything worked( except 1 or 2 times. I just checked the comments and they helped). Just check your script or interface of the unity a hundred vuobilion times.
     
  35. Antharia

    Antharia

    Joined:
    Dec 30, 2017
    Posts:
    1
    Thanks Reknotx for the numbers.

    Timestamp for 04. Creating Enemy #1

    11:00
    The Navigation Window has changed since Unity 4.6, with the most
    noticeable change being that Width Innacuracy is no longer present.
    For now, the main settings you’ll need to change from the video are Step
    Height, which should now be set to 0.7 and under Advanced, check
    Manual Voxel Size and set Voxel Size to 0.38. Then, set Min Region Area to 0.1.

    09. Spawning Enemies

    There's only the Zombunny in the Prefabs folder.
     
    Last edited: Jan 23, 2018
    Tradge20 likes this.
  36. IMPL4CABLE

    IMPL4CABLE

    Joined:
    Jan 23, 2018
    Posts:
    1
    Hey !
    I'm french so I'm really sorry for my terrible English. I have a couple of questions about this tutorial.
    - I'm thinking about upgrading the game creating many levels and maybe a online mode and power-ups. But can I post a build of my game on Internet when I finished it ? Did someone maked new ennemis models ?
    - Then I saw that there is a pause menu on the last part of the tutorial for upgrading the sound but I can't find the tutorial for doing it. Can someone help me please ?
     
  37. gwnguy

    gwnguy

    Joined:
    Apr 25, 2017
    Posts:
    144
    retsofh likes this.
  38. retsofh

    retsofh

    Joined:
    Jan 11, 2018
    Posts:
    7
    'NullReferenceException: Object reference not set to an instance of an object
    CompleteProject.EnemyMovement.Update () (at Assets/_Complete-Game/Scripts/Enemy/EnemyMovement.cs:27)'
    I used the prefab enemies from the completed file and got this error and tried to find the completed enemy movement and enemy attack scripts that its referencing. any tips on how to find these two cast aways and fix this?
     
  39. retsofh

    retsofh

    Joined:
    Jan 11, 2018
    Posts:
    7
    I reached this point in the tutorial and decided to move the prefab enemies from the completed files thinking it would be faster. I encountered namespace errors and spent an hour monkeying around with it and think that the proper way to do this is to build the enemies as mentioned above to avoid the hassle.
    I have deleted my project entirely and will try again
     
  40. gwnguy

    gwnguy

    Joined:
    Apr 25, 2017
    Posts:
    144
    Ret, that is EXACTLY what happened to me when I did this tutorial last May. I moved the prefab enemies from the completed files, got the error, screwed around until I was completely frustrated, deleted and started over.

    Sorry man. It's a "character building" experience right?
     
    retsofh likes this.
  41. retsofh

    retsofh

    Joined:
    Jan 11, 2018
    Posts:
    7
    Indeed.
    These tutorials seem to all have a hidden twist in them that makes them a bit spicy. I like that. The lesson being is to reliably decide to NOT cut corners to ensure that the code is true. Without your post it would be a different story and for this I am grateful. Ive recently returned to coding after a few years and am eager to try other tutorials with Unity that anyone might recommend :D
     
  42. Malkalypse

    Malkalypse

    Joined:
    Jan 13, 2017
    Posts:
    14
    I'm having an issue with the enemy death animation. Instead of playing through the animation, it plays the first 1/6th or so, and then loops, so that the characters is rocking back and forth instead of falling over backward.
     
  43. MineModder

    MineModder

    Joined:
    Feb 3, 2018
    Posts:
    3
    Hello! on video 1 i can not find the file Scenes anywhere please help me. oh and tell me if it even matters or not Thanks in advance
     
  44. yosshy0805

    yosshy0805

    Joined:
    Jan 30, 2018
    Posts:
    3
    You can create new directory...:D
     
  45. MineModder

    MineModder

    Joined:
    Feb 3, 2018
    Posts:
    3
    You can create new directory
    sorry still here but how? XD Oh and dose it matter at all?
     
  46. MineModder

    MineModder

    Joined:
    Feb 3, 2018
    Posts:
    3
    Hello!:) On stage 4 i am having problems incerting the script into enemy movement pleas help me and Thanks in Advance
     
  47. yosshy0805

    yosshy0805

    Joined:
    Jan 30, 2018
    Posts:
    3
    In project window, just click below Create button and new folder, wow!!
     
  48. yosshy0805

    yosshy0805

    Joined:
    Jan 30, 2018
    Posts:
    3
    It most parts of this questions, you did typo :D
     
  49. anoushka1969

    anoushka1969

    Joined:
    Feb 6, 2018
    Posts:
    1
    Did you find any solution?
     
  50. SPSK1313

    SPSK1313

    Joined:
    Feb 13, 2018
    Posts:
    1
    I have following errors:
    1.) NullReferenceException: Object reference not set to an instance of an object
    EnemyMovement.Update () (at Assets/Assets/Scripts/Enemy/EnemyMovement.cs:23)
    2.) NullReferenceException: Object reference not set to an instance of an object
    CompleteProject.EnemyAttack.Update () (at Assets/Assets/_Complete-Game/Scripts/Enemy/EnemyAttack.cs:58)
     

    Attached Files:

    LEOyeah likes this.