Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  5. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  6. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Survival Shooter Q&A

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

  1. Tradge20

    Tradge20

    Joined:
    Feb 9, 2018
    Posts:
    4
    I'd like to see that too
     
  2. Tradge20

    Tradge20

    Joined:
    Feb 9, 2018
    Posts:
    4
    I'm getting
    NullReferenceException: Object reference not set to an instance of an object
    PlayerHealth.Update () (at Assets/Scripts/Player/PlayerHealth.cs:44)

    44. damageImage.color = Color.Lerp (damageImage.color, Color.clear, flashSpeed * Time.deltaTime);

    I have no idea what is wrong please help
     
  3. Superdude2411

    Superdude2411

    Joined:
    Feb 16, 2018
    Posts:
    1
    What do you mean by "in the root" of the assets folder? I tried to make a normal folder inside the assets folder and save the scene in that, but it said that the scene wasn't in the assets folder, even though it was in a folder that was in the assets folder. How do you make a scenes folder that's "in the root" of the assets folder?

    I'm on Windows if that's part of the problem.
     
  4. PjElliott

    PjElliott

    Joined:
    Feb 12, 2018
    Posts:
    2
    I've been looking for the solution to this problem myself. Obviously my code is correct because it's already written! For some reason however the friggin Zombunny won't attack and my health never budges when he is bumping and grinding on me. I have seen others ask this exact question and it seems like people are ignoring the question no matter who asks it or how. What the hell?! I'M SICK OF BEING STUCK!

    Update: Upon further tedious and pain staking inspection, It's been all day for cripes sakes(!)......I may have forgotten to select "IsTrigger" on the sphere collider on the zombunny......WHAT?!...:oops:...At least there is a possible solution for others who may have the same problem...I apologize for yelling...IT WAS JUST SO FRUSTERATING!:mad:...:eek:breath:eek:breath:eek:...i need some chamomile tea.
     
    Last edited: Feb 22, 2018
  5. moskus4

    moskus4

    Joined:
    Feb 22, 2018
    Posts:
    1
    I have the same code as the source, but I get an error after declaring the variable
    float camRayLength = 100f;
    It says that "Method must have a return type".
    How do I fix this?
     
  6. PjElliott

    PjElliott

    Joined:
    Feb 12, 2018
    Posts:
    2
    If I could help I would need to see the entire code. Did you perhaps add anything to it? That's just declaring a variable named camRayLength and setting it's value. there's no method to look at. a method look like:

    void SomeName()
    {

    }
     
  7. rukyimza66

    rukyimza66

    Joined:
    Feb 14, 2018
    Posts:
    1
    Player will have another player, delete the script at the Player below.
    upload_2018-3-5_18-53-48.png
     
  8. Kinshuk23

    Kinshuk23

    Joined:
    Mar 11, 2018
    Posts:
    1
    Sir,
    I recently started learning unity so I started with this project and I am having problems with the spawning of zombear and Hellephant .
    These two enemies are not following the player to attack i have checked all scripts for these two and they are written write .
    Currently i am on unity 5.6.0 so please guide me through this problem.
    All features except this are working properly.
     
  9. Galapads

    Galapads

    Joined:
    Mar 20, 2018
    Posts:
    1
    I would also be interested in an answer for your question... I will continue and see what happens however!
     
  10. atorisa

    atorisa

    Joined:
    Dec 1, 2013
    Posts:
    67
    Hi, Guys!

    I noticed that the tutorial needs some optimizations in code & UI to publishing for mobile platforms.

    I continue experiments with AR and I used this tutorial for implementing AR FPS project.
    So I implemented those optimizations together with AR.

    ☄ AR Survival Shooter

    ☄ Get it on Unity Asset Store: https://goo.gl/Wn8fiD

     
    Brittonian_Embassy likes this.
  11. APPSTATION

    APPSTATION

    Joined:
    Feb 28, 2018
    Posts:
    2
    Hello I'm having an issue just after 9 it seems to me when I add the zombear and hellephant into the enemy manager things start going crazy. I didnt have prefabs for my zombears and hellephants in my prefabs folder but when i searched the asset I found them the zombear has an additional volume handler script but im not sure if this will affect it! ill put up a few screen shots any one had this issue? Or have any idea on where to look to fix this issue? Screenshot (87).png Screenshot (88).png Screenshot (89).png
     

    Attached Files:

    Last edited: Apr 6, 2018
  12. shubhamshetkar25

    shubhamshetkar25

    Joined:
    Feb 4, 2017
    Posts:
    6
    i am experimenting with Unity Survival Shooter project.
    i am getting this error when i kill enemy.

    Error on line 33 here


    NullReferenceException: Object reference not set to an instance of an object
    CompleteProject.EnemyHealth.TakeDamage (Int32 amount, Vector3 hitPoint) (at Assets/_Complete-Game/Scripts/Enemy/EnemyHealth.cs:76)
    CompleteProject.PlayerShooting.Shoot () (at Assets/_Complete-Game/Scripts/Player/PlayerShooting.cs:111)
    CompleteProject.PlayerShooting.Update () (at Assets/_Complete-Game/Scripts/Player/PlayerShooting.cs:49)


    this is my Enemy Health Script :

    Code (CSharp):
    1. public class EnemyHealth : MonoBehaviour
    2.     {
    3.  
    4.         EnemyManager enemyManager;
    5.         int enemyHealth;
    6.  
    7.        
    8.         public void TakeDamage (int amount, Vector3 hitPoint)
    9.         {
    10.             // If the enemy is dead...
    11.             if(isDead)
    12.                 // ... no need to take damage so exit the function.
    13.                 return;
    14.  
    15.             // Play the hurt sound effect.
    16.             enemyAudio.Play ();
    17.  
    18.             // Reduce the current health by the amount of damage sustained.
    19.             currentHealth -= amount;
    20.            
    21.             // Set the position of the particle system to where the hit was sustained.
    22.             hitParticles.transform.position = hitPoint;
    23.  
    24.             // And play the particles.
    25.             hitParticles.Play();
    26.  
    27.             // If the current health is less than or equal to zero...
    28.             if(currentHealth <= 0)
    29.             {
    30.                 // ... the enemy is dead.
    31.                 Death ();
    32.  
    33.                 enemyManager.enemiesKilled++;
    34.                 if (enemyManager.enemiesKilled >= enemyManager.maxEnemyCount)
    35.                     //Change Scene
    36.                     SceneManager.LoadScene("start");[/B]
    37.  
    38. [B]        }
    39.     }
    40. }
     
    Last edited: Apr 6, 2018
  13. Armitgae

    Armitgae

    Joined:
    Mar 28, 2018
    Posts:
    3
    Hello everyone! I'm currently on 07 : Harming enemies. Everything is going great, my gun shoots. I can see the light my shots collide with the enemy then... nothing. My shots will collide with the enemy and the environment, but he wont take damage and the particle effect doesn't show. I don't know what the problem is, all I know is that its a logic error. Any help will be greatly appreciated.
     
  14. Armitgae

    Armitgae

    Joined:
    Mar 28, 2018
    Posts:
    3
    Hello everyone. I'm currently working on this project, going through without any problems. But then I hit a brick wall. On step 7, harming the enemy, i'm stumped. My gun shoots, it collides with everything including the enemy. But the enemy doesn't die, I shot him hundreds of times and nothing happens. I haven't changed anything in the scripts (the scripts being enemyHealth and playerShooting). Please help!
     
  15. pikachu_98123

    pikachu_98123

    Joined:
    Apr 18, 2018
    Posts:
    1
    Hi. i am a newbie, now, this assets for survival shooter game in assests website is no longer available, so i can find it to make this game. Have anyone had this assests or completed this game, please give me :(
     
  16. picklesimers

    picklesimers

    Joined:
    Apr 24, 2018
    Posts:
    1
    I am having trouble with the 1st zoombunny dying, it will take damage and die one time. Then if you try to test the game again it will not die. I have to delete the scripts from the folder, download them again and reassign them again to get it ot work, but then it will run only once again. Any suggestions?
     
    atorisa likes this.
  17. atorisa

    atorisa

    Joined:
    Dec 1, 2013
    Posts:
    67
    ☄️ VR SURVIVAL SHOOTER

    Hi, friend!

    I have released VR version of the asset.
    Available on the Unity Asset Store (Docs).

     
  18. jackgrossi

    jackgrossi

    Joined:
    Apr 28, 2018
    Posts:
    1
    how do i get the assets?
     
  19. weitingtw

    weitingtw

    Joined:
    Apr 26, 2018
    Posts:
    1
    I'm just wondering where do we restrict the player's movement not to go beyond the surface?
     
  20. imcheney

    imcheney

    Joined:
    Oct 11, 2017
    Posts:
    3

    I solved your problem in Unity2017 by change the if statement to
    "Physics.Raycast (camRay, out floorHit, camRayLength)"
    i.e. in the new Unity API, somehow we don't need to input the floorMask to Physics.Raycast function anymore.

    So, issue closed :)
     
    SharkB likes this.
  21. BrewNCode

    BrewNCode

    Joined:
    Feb 17, 2017
    Posts:
    162
    I'm sorry if this is a repeated question, but. for Unity 2017, what are the properties of the bake section of the Navmesh for the Zoembunny. I can't find the height and width innacuracy %.
     
  22. skyemagethe3rd

    skyemagethe3rd

    Joined:
    May 15, 2018
    Posts:
    6
    So I just downloaded Unity 2018.1 and am taking the Shooter Tutorial trying to get my bearings and ran into a snag...
    troubleshoot Shooter Tutorial Ep 2.jpg

    Apparently there are multiple things wrong with my coding even though I thought I followed every instruction to the T as well as there is a problem with UV Overlap... I don't know the first thing to fixing this so I desperately need help as I'm only on the 2nd video out of 10 and obviously I suck at coding. Can someone please take a look at this and my coding and tell me what's wrong?

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class PlayerMovement : MonoBehaviour
    4. {
    5.     public float speed = 6f;
    6.  
    7.     vector3 movement;
    8.     Animator anim;
    9.     Rigidbody playerRigidbody;
    10.     int floorMask;
    11.     float camRayLength = 100f;
    12.  
    13.     void Awake ()
    14.     {
    15.         floorMask = LayerMask.GetMask("Floor");
    16.         anim = GetComponent<Animator>();
    17.         playerRigidbody = GetComponent<playerRigidbody>();
    18.     }
    19.  
    20.     void FixedUpdate()
    21.     {
    22.         float h = Input.GetAxisRaw("Horizontal")
    23.         float v = Input.GetAxisRaw ("Vertical")
    24.  
    25.             Move(h, v);
    26.         Turning();
    27.         Animating(h, v);
    28.  
    29.     }
    30.  
    31.     void Move (float h, float v)
    32.     {
    33.         movement.Set(h, 0f, v);
    34.  
    35.         movement = movement.normalized * speed * Time.deltaTime;
    36.  
    37.         playerRigidbody.MovePosition(transform.position + movement);
    38.     }
    39.  
    40.     void Turning()
    41.         {
    42.  
    43.         RaycastHit floorHit;
    44.  
    45.         if(Physics.Raycast (camRay, out floorHit, camRayLength, floorMask))
    46.         {
    47.             vector3 playerToMouse = floorHit.point - transform.position;
    48.             playerToMouse.y = 0f;
    49.  
    50.             quaternion newRotation = quaternion.LookRotation(playerToMouse);
    51.             playerRigidbody.MoveRotation(newRotation);
    52.         }
    53.     }
    54.  
    55.     void Animating(float h, float v)
    56.     {
    57.         bool walking = h != 0f || v != 0f;
    58.         anim.SetBool("IsWalking", walking);
    59.     }
    60. }
     
  23. unity_FFrCoOjtlloVsA

    unity_FFrCoOjtlloVsA

    Joined:
    May 29, 2018
    Posts:
    2
    i got the UV overlap message too but it didn't cause any problems in running the program. however your two float variables h and v when you initialized them you forgot to put the semi-colon ";" at the end. also you put <playerRigidbody> where it should have just been <Rigidbody> I would also suggest aligning Move(h, v); with the two below it (more for looks than anything else). both places you have "quaternion" need to be capitalized "Quaternion". That's all the mistakes that i see with your code here's mine if you need a reference it worked and ran for me so it should be good. Hope this helped.

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class PlayerMovement : MonoBehaviour
    4. {
    5.     public float speed = 6f;
    6.  
    7.     Vector3 movement;
    8.     Animator anim;
    9.     Rigidbody playerRigidbody;
    10.     int floorMask;
    11.     float camRayLength = 100f;
    12.  
    13.     private void Awake()
    14.     {
    15.         floorMask = LayerMask.GetMask("Floor");
    16.         anim = GetComponent<Animator>();
    17.         playerRigidbody = GetComponent<Rigidbody>();
    18.     }
    19.  
    20.     private void FixedUpdate()
    21.     {
    22.         float h = Input.GetAxisRaw("Horizontal");
    23.         float v = Input.GetAxisRaw("Vertical");
    24.  
    25.         Move(h, v);
    26.         Turning();
    27.         Animating(h, v);
    28.     }
    29.  
    30.     void Move(float h, float v)
    31.     {
    32.         movement.Set(h, 0f, v);
    33.         movement = movement.normalized * speed * Time.deltaTime;
    34.  
    35.         playerRigidbody.MovePosition(transform.position + movement);
    36.     }
    37.  
    38.     void Turning()
    39.     {
    40.  
    41.         RaycastHit floorHit;
    42.  
    43.         if(Physics.Raycast(camRay, out floorHit, camRayLength, floorMask))
    44.         {
    45.             Vector3 playerToMouse = floorHit.point - transform.position;
    46.             playerToMouse.y = 0f;
    47.  
    48.             Quaternion newRotation = Quaternion.LookRotation(playerToMouse);
    49.             playerRigidbody.MoveRotation(newRotation);
    50.         }
    51.     }
    52.  
    53.     void Animating(float h, float v)
    54.     {
    55.         bool walking = h != 0f || v != 0f;
    56.         anim.SetBool("IsWalking", walking);
    57.     }
    58. }
    59.  
     
  24. unity_FFrCoOjtlloVsA

    unity_FFrCoOjtlloVsA

    Joined:
    May 29, 2018
    Posts:
    2
    I just fixed the if statement to fix a different problem I was having as well. The "floorMask" should not be in the if statement idk why exactly but with that in there it wouldnt allow me to turn using the mouse. Again hope this helps good luck.
     
  25. mdolphin

    mdolphin

    Joined:
    Jun 20, 2018
    Posts:
    1
    I'm new to Unity, and after I finished some other basic Tutorials, I now try this Survival Shooter Tutorial. My Unity Version is 2018.1.4f1

    I've just finished the second Video of the Tutorial Series.

    Problem: Whenever I load this project into the Editor Unity instantly starts the "Baking" process, and that takes nearly an hour, while consuming 100% CPU. Whenever I change anything in the Scene View, Baking starts again. Therefore I can't really progress with this Tutorial, and I have no idea what to switch off or change in the project settings, so that either Baking may be much faster, or just runs when I explicitely tell Unity to start the Baking Process.
     
  26. John553

    John553

    Joined:
    Jun 23, 2018
    Posts:
    1
    my walking animation wont work and i dont know why, here is my code

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class PlayerMovement : MonoBehaviour
    4. {
    5.     public float speed = 6f;
    6.  
    7.     Vector3 movement;
    8.     Animator anim;
    9.     Rigidbody playerRigidbody;
    10.     int floorMask;
    11.     float camRaylenght = 100f;
    12.  
    13.     void Awake()
    14.     {
    15.         floorMask = LayerMask.GetMask("Floor");
    16.         anim = GetComponent<Animator>();
    17.         playerRigidbody = GetComponent<Rigidbody>();
    18.     }
    19.  
    20.     void FixedUpdate()
    21.     {
    22.         float h = Input.GetAxisRaw("Horizontal");
    23.         float v = Input.GetAxisRaw("Vertical");
    24.  
    25.         Move (h, v);
    26.         Turning ();
    27.         Animating (h, v);
    28.  
    29.     }
    30.     void Move(float h, float v)
    31.  
    32.     {
    33.         movement.Set(h, 0f, v);
    34.  
    35.         movement = movement.normalized * speed * Time.deltaTime;
    36.  
    37.         playerRigidbody.MovePosition(transform.position + movement);
    38.     }
    39.     void Turning()
    40.     {
    41.  
    42.         RaycastHit floorHit;
    43.  
    44.         if (Physics.Raycast (camRay, out floorHit, camRaylenght, floorMask))
    45.         {
    46.             Vector3 playerToMouse = floorHit.point - transform.position;
    47.             playerToMouse.y = 0f;
    48.  
    49.             Quaternion newRotation = Quaternion.LookRotation(playerToMouse);
    50.             playerRigidbody.MoveRotation (newRotation);
    51.         }
    52.     }
    53.     void Animating(float h, float v)
    54.     {
    55.         bool walking = h != 0f || v != 0f;
    56.         anim.SetBool("IsWalking", walking);
    57.     }
    58.      
    59.    
    60. }
    61.  
     
  27. AwsomeRod

    AwsomeRod

    Joined:
    Oct 13, 2012
    Posts:
    3
    I get a problem with the Mesh. My enemies spawn in the right place but they won't walk. They do the animation but do not walk.
    "Failed to create agent because there is no valid NavMesh
    UnityEngine.Object:Instantiate(GameObject, Vector3, Quanternion)"
    ""SetDestination" can only be called on an active agent that has been placed on a NavMesh.
    UnityEngine.AI.NavMeshAgent:SetDestination(Vector3)"
     
  28. cherrycharan3899

    cherrycharan3899

    Joined:
    Jun 20, 2018
    Posts:
    5
    Hello all!!!
    I had the issue that lighting is getting turned off on restarting my game again. I am running on 2018.1.3f1. This is how I solved the issue.
    Go to 'Windows/Lighting/Settings/Object Maps'. Uncheck the 'Auto Generate' checkbox and in the drop-down menu located by its side, select 'General Lighting'. Now close the 'Settings' dialog box and run the game. That should work fine.
     
  29. Psyberion

    Psyberion

    Joined:
    Jun 19, 2018
    Posts:
    2
    Hi, I also didn't get the Zombear and Hellephant prefabs, but created them from the models. The Zombear works fine, the only issue I have with the Hellephant is that it won't die. I created the HellephantAOC, dragged on the Idle, Move and Death animations from the model, and dropped the HelephantAOC into the Controller on the Animator component. i can shoot the Hellephant over and over again, it makes the hurt sound and the health goes below 0. Since the HellephantAOC has the controller set to EnemyAC I would expect it to act in the same way as the Zombear and Zombunny. I even tried setting the isDead bool in the EnemyHealth script to public so I could see it in the inspector whilst running, I didn't see it trigger and I tried ticking it to see if it triggered the death but to no avail. The Hellephant does stop moving though, so it's disabling the nav in the EnemyMovement script because the enemy health is below 0. But it continues to play the Move animation.
     
  30. Psyberion

    Psyberion

    Joined:
    Jun 19, 2018
    Posts:
    2
    Fixed it. Hadn't noticed there was an error occurring each time they hit the Death function. This was because I hadn't added the HitParticles to the Hellephant, so in the EnemyHealth script TakeDamage function, it wasn't flagged as isDead, it played the hurt audio, reduced the health, then the error occurred on setting the hitParticles.transform.position because it hadn't found the hit particles. After adding the hit particles the error didn't occur and it worked.
     
  31. OG_Games

    OG_Games

    Joined:
    Jul 5, 2018
    Posts:
    1
    I am having troubles getting the animator override controller working. I have completed the tutorial and everything is working well except for the fact that the hellaphant won't play any of it's animations. It will follow the player and attack but it just slides around the scene and when it is killed it simply disappears. I have created a HellaphantAOC to attach to the hellaphant prefab and the EnemyAC is placed into it. I have placed all of the hellaphant's clips found in the "Model" folder into the override column but still none of the animations will play. The hellaphant prefab has the same components as the other enemy prefabs and it behaves the same as the other enemies apart from the animator being completely inert.

    If anyone has any clue as to how to fix this please fill me in because I've stayed up until 3am two nights in a row trying to fix this simple problem.

    If a screenshot will help ask and I'll post it because right now I cant think of anything that would assist you.

    Thanks!!
     
  32. rileyjacksonhockey

    rileyjacksonhockey

    Joined:
    Jul 26, 2018
    Posts:
    1
    Running the _complete_game project file is giving me an "all compiler errors have be fixed before entering play mode". Assets and Unity are fully updated. Once I figure out how to get it to play I wish to make an original music score for the game. All help is appreciated. :)
     
  33. cherrycharan3899

    cherrycharan3899

    Joined:
    Jun 20, 2018
    Posts:
    5
    you can view your errors in the console... just check them out and try correcting...
     
  34. cherrycharan3899

    cherrycharan3899

    Joined:
    Jun 20, 2018
    Posts:
    5
    I am stuck with LINE RENDERER... Working on 2018.2... No idea how to set the with of the line renderer on this newly updated renderer component... Also, my line is coming embedded into the floor... How to solve these??
     

    Attached Files:

  35. Charliea835

    Charliea835

    Joined:
    Jul 27, 2018
    Posts:
    2
    hey man, I was stuck on the line renderer too. if you look where it says Width and the box under it saying 1.0, you can actually click into that and change the width there. As for the line being embedded in the floor I'm not sure, did you add the line renderer to the gun barrel end?

    this is the inspector for my gunbarrell end. hope this helps
     

    Attached Files:

  36. Charliea835

    Charliea835

    Joined:
    Jul 27, 2018
    Posts:
    2
    Hi everyone, I am having an issue with this survival shooter. I have reached the end of it but have two issues, firstly, when the main character dies, even without the game over manager script not selected, the game restarts on death anyway. I don't know how to stop this. also, the game over animation with the script attached doesn't stay for long
     
  37. m0rose

    m0rose

    Joined:
    Friday
    Posts:
    1
    Whenever I press 'play' in Unity (not finished, just watched 03), the camera and player freeze for about a second. Then, the camera jolts to a much farther-away position. It doesn't follow the player. Looking in the inspector, the camera's x and z coords sometimes shift a bit higher or lower, but never much more than one unit. When this happens, the camera doesn't move even a bit. I watched the video twice over already; I have no idea what to do.
     
  38. BGR521

    BGR521

    Joined:
    Friday
    Posts:
    1
    I'm on part 4 of the tutorial, and i cant seem to get the zombunny to track my player. I followed the video, doing everything it told me, not altering the script, and created the nav mesh to the best of my ability (im missing the inaccuracy options, so that could be the reason, although i doubt it). No matter what i try, the enemy just runs in place and refuses to track my player. If anyone knows a fix to this, i would highly appreciate it.
     

    Attached Files:

    Last edited: Aug 14, 2018 at 1:25 AM