Search Unity

Survival Shooter Q&A

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

  1. dharper

    dharper

    Joined:
    May 2, 2016
    Posts:
    1
    Dude, you are a lifesaver.

    I edited all sub options under "Floor" (Base, Planks, Sides) and it works like a charm.


    Thanks for your help!
     

    Attached Files:

  2. Trouch

    Trouch

    Joined:
    Nov 29, 2009
    Posts:
    87
    Ah right, how come only afew people have this problem??
    I had to goto Navigation > Object and click on "Planks", then tick its "Navigation Static" box and rebake, for the enemy to start following me, i dont understand why this is an issue for a minority??

    Thanks anyways mate!
     
  3. TylerL-563407

    TylerL-563407

    Joined:
    Apr 28, 2016
    Posts:
    1
    I have a problem with my build settings on my game.

    In my Preview the score function adds up points, and my red screen shader animation shows up when it's "GAME OVER".

    But when I build the game the Score doesn't add when killing enemies and the screen fader doesn't show the right color; just black.

    On the Preview my game works the way I wanted it, but when I build it some parts don't work properly as it did in the preview and There are no errors to describe the problem.

    How can I fix this?
     
    Last edited: May 6, 2016
  4. jsavell

    jsavell

    Joined:
    May 4, 2016
    Posts:
    1
    Hey I'm new to unity but while starting on this project on the second lesson with the player object I'm getting compiler errors with the movement and health scripts. using unity 5.3.4f1
     
  5. jmiller11311

    jmiller11311

    Joined:
    May 5, 2016
    Posts:
    1
    I am trying to get this game running on my android device and the issue I am having is character movement. When I touch on the screen the character simply shoots the weapon, but he will not move within the game (even when I move my finger across the screen). I am sure it is due to the code originally being written to use the keyboard for movement which does not translate over to the smart phone. How should one go about fixing this?
     
  6. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    I am creating another project like Survival Shooter. I need to give a gun to my own GamePlayer. How Can I do it?
    Untitled.jpg
     
  7. cassif

    cassif

    Joined:
    May 5, 2016
    Posts:
    1
    Hi,

    Got the same problem, using Unity 5.3.4 . any conclusions about this problem?
    Thanks !
     
  8. Hill1030

    Hill1030

    Joined:
    May 10, 2016
    Posts:
    1
    YES! This is the one that did it for me afer about an hour of trying to figure it out. Legend (Y)
     
  9. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    I am creating a game like Survival Shooter. Now, I am baking Nav Mesh. As you know, when we bake Nav Mesh, it finds all static Meshes in our scene. However, my 3d objects don't have Mesh in my scene. parent object does not have but child object has Mesh. Everything is OK? If parent has no Mesh, but child object has mesh.
    Untitddddled.jpg
     
  10. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    Unt11itled.jpg

    Untitle22d.jpg

    In your project, there is a space where object and floor bumped. Why my project is different?
     

    Attached Files:

  11. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    Yep works fine when baking when a child gameobject has the mesh renderer set to static.
    The space around the Legs of the tables, are where the navmesh agent cannot walk, based on the baked navmesh agent sizes (in the Bake tab)

    Have a check of one of the objects, with the navigation window open, and the Object tab selected.
    you can either look at the heirarchy and select one the appropriate child game object that has the mesh attached, and ensure that its set to navigation static in the navigation window, rebake and check results.

    if that works, and you want to set alot to static in one fail swoop in the object tab of the Navigation window, click on the mesh renderers filter option, and this will filter your scene heirarchy to show all the meshes in the scene to allow for easier selection.
    but the Mesh Renderers filter does not select anything, it merely filters the scene heirarchy, you still have to select objects then select navigation static option prior to baking.

    You can view more in Mikes tutorial vids here:
    http://unity3d.com/learn/tutorials/modules/beginner/navigation/navigation-overview?playlist=17105
     
    Last edited: May 12, 2016
    KAYUMIY likes this.
  12. Finity

    Finity

    Joined:
    Jan 25, 2013
    Posts:
    10
    I am doing this tutorials and I have a problem.

    Unity version: 5.3.4f1 Device: Macbook, OSX 10.11


    The problem: Baking process completes almost instantly and the floor is not highlighted (where highlight should mean that navmesh is calculated for there).

    Here is the screenshot of it:

    Then, I checked the completed scene (which was already created by Unity Team), it showed the floor fully highlighted. I just hit the bake again without touching anything and the same problem happened. So, there must be something else as I tried the original scene file without changing anything.

    What am I missing here? Is there a Unity editor setting or something like that which can break the baking process?
     
  13. jaiprakashnetha

    jaiprakashnetha

    Joined:
    May 12, 2016
    Posts:
    1
    am getting an error stating "NullreferenceException: Object Reference Not set to an instance of an object"
    at line 25 in enemy movement script, please give a solution.am providing the code for ur reference:
    using UnityEngine;
    using System.Collections;

    public class EnemyMovement : MonoBehaviour
    {
    Transform player;
    PlayerHealth playerHealth;
    EnemyHealth enemyHealth;
    NavMeshAgent nav;


    void Awake()
    {
    // Set up the references.
    player = GameObject.FindGameObjectWithTag("Player").transform;
    playerHealth = player.GetComponent<PlayerHealth>();
    enemyHealth = GetComponent<EnemyHealth>();
    nav = GetComponent<NavMeshAgent>();
    }


    void Update()
    {
    // If the enemy and the player have health left...
    if (enemyHealth.currentHealth > 0 && playerHealth.currentHealth > 0)
    {
    // ... set the destination of the nav mesh agent to the player.
    nav.SetDestination(player.position);
    }
    // Otherwise...
    else
    {
    // ... disable the nav mesh agent.
    nav.enabled = false;
    }
    }
    }
     
  14. greatness

    greatness

    Joined:
    Feb 20, 2016
    Posts:
    199
    I can't download Survival Shooter. It just says 2% is downloaded. What is going on? Is it just me or is it Unity?

    Edit: I can download it now
     
    Last edited: May 16, 2016
    OboShape likes this.
  15. greatness

    greatness

    Joined:
    Feb 20, 2016
    Posts:
    199
    I am after part 4 of the tutorial. For some reason, the enemy just walks in the same path and suddenly stops at the exact same place. Is it just me or Unity?
     
  16. xbxb15

    xbxb15

    Joined:
    Jul 27, 2015
    Posts:
    1
    During creating enemy number 1, in the navigation tab, the pdf tells me to set step height to .34. But an alert shows up that says it conflicts with the max slope. How can I fix this?
     
  17. dbbyres

    dbbyres

    Joined:
    May 17, 2016
    Posts:
    1
    OK, I'm a complete Unity noob...how the heck do I download the files from the Asset store at above link? Opening the link takes me to the store page for this project, but only obvious thing to do to get the files is the "Open In Unity" button which opens Unity 5.3.4 on my PC and then...nothing?! Thanks...
     
  18. greatness

    greatness

    Joined:
    Feb 20, 2016
    Posts:
    199
    When the enemy dies, for some reason the enemy death animation does not play.

    Console Error:
    'Zombunny' AnimationEvent 'RestartLevel' has no receiver! Are you missing a component?
     
  19. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    Evening,

    When you click the open in Unity once downloaded, it should have a bunch of folders showing in the Project Window.

    Have you followed the tutorial in the first video? and rearranged the layout and created a new scene.
    http://unity3d.com/learn/tutorials/projects/survival-shooter/environment?playlist=17144
     
  20. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    Ill work through this tute again tomorrow, for a refresh and try and help where I can.
     
  21. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    have you checked is the floor set to static?
     
  22. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    If you can please, when posting code, please use Code Tags, just makes it alot easier to read, and everyone can see the appropriate line numbers.

    info can be found here, http://forum.unity3d.com/threads/using-code-tags-properly.143875/

    can you check that there is a PlayerHealth and an EnemyHealth Script attached as these are the components that are required, otherwise if their not found, then this means that playerHealth and will be NULL and generate this error.
     
  23. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    Sounds like the target for the navmesh agent is not being updated.

    Ill get another work through this tutorial tomorrow as its been a while since ive done it and see what i can find to try and help.
     
  24. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    Is this in the slides?

    I think that possibly the step size cannot be larger than the max slope.

    But if you can let me know, or direct me to where this is mentioned I can help further.
     
  25. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    have a look at this post, might help.
    http://forum.unity3d.com/threads/pl...-receiver-are-you-missing-a-component.307523/
    its possible that there isnt a function created for this animation event, or the trigger is incorrect.
     
  26. onzicardz

    onzicardz

    Joined:
    Nov 5, 2015
    Posts:
    3
    Hey I'm having problems with the Navmesh after Baking with the setting Agent Radius at 0.75 Agent Height 1.2 Max Slope 45 Step Height 0.34 Voxel size .025
    Only the top of the table and doll house have the Mavmesh blue on it none on the floor and as soon as I play the game to test the enemy will be on the table and unable to follow the player . Why is this and how do I fix this please ?

    Thanks Very much.
     
  27. onzicardz

    onzicardz

    Joined:
    Nov 5, 2015
    Posts:
    3

    Hey I have just fixed this The floor child of the Environment was not set to static working fine now Thanks.
     
    OboShape likes this.
  28. Dekata

    Dekata

    Joined:
    May 20, 2016
    Posts:
    47
    Dear Obo Shape!
    I'm stuck at TUT4 when try to put little sweet bunny, I put it in this (10, 0, 0)
    but when i run the bunny jump on the chair, and the position auto change like this
    I can't call him down, :( Thanks for your help
     
  29. Dekata

    Dekata

    Joined:
    May 20, 2016
    Posts:
    47
    my god, i did it, lol, the bunny will scare if you not set static floor
     
    OboShape likes this.
  30. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    yep, good way to check once you baked it, is having the navigation tab open and pop a tick in the 'show Navmesh'.
    Should see all the walkable areas in a bluish teal color.

    Nice work btw that you found out the problem ;)
     
    Dekata likes this.
  31. IronDaddy

    IronDaddy

    Joined:
    Jan 26, 2016
    Posts:
    4
    Dear All,

    I am working on the project of Unity tutorial project Survival shooter. I found a bug.

    When the zombunny's health is 0, at this moment, Zombunny will run the motion "Death". But, it has to wait the whole motion clip "Move" runs out.

    So, sometimes, the zombunny have to "Move" for a moment and then "Death".

    How can I stop the "Move" and run Death immediately?

    Thank you all.
    Code (CSharp):
    1. void Death ()
    2. {
    3.      // The enemy is dead.
    4.      isDead = true;
    5.      // Turn the collider into a trigger so shots can pass through it.
    6.      capsuleCollider.isTrigger = true;
    7.      // Tell the animator that the enemy is dead.
    8. *** What codes can I add  here or how ***
    9.      anim.SetTrigger ("Dead");
    10.      // Change the audio clip of the audio source to the death clip and play it (this will stop the hurt clip playing).
    11.      enemyAudio.clip = deathClip;
    12.      enemyAudio.Play ();
    13. }
     
  32. GillianS

    GillianS

    Joined:
    May 9, 2016
    Posts:
    1
    Hi all,

    I had a similar problem to others in Tutorial 4, where the NavMesh display was not showing the same as the video - upon inspection of the environment items I discovered that the floor was not set to static, so I ticked that and rebaked.... And now MOST of the floor displays the NavMesh however there are odd sections were it is missing (but there are no items). This creates a bit of a maze for my wee bunny to navigate around:



    Everything else in the environment has Navigation Static on too. Any ideas what those areas are?

    Thanks in advance!

    ETA: If I change the Voxel Size from 0.025 (as the Unity 5.x instructions say) to the Unity-preference of 0.094, it gets rid of the majority of these gaps.
     
    Last edited: May 21, 2016
    money4honey likes this.
  33. ladyonthemoon

    ladyonthemoon

    Joined:
    Jun 29, 2015
    Posts:
    236
    Hi,

    I'm about to begin this tutorial; I saw in the first video that we use a pre-made "environment", a prefab. This makes me uncomfortable; is there a way for me to make this prefab from scratch with the lights and everything? Thank you.
     
  34. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    ayay,

    this was a Unite training day series from a couple of years ago, and was recorded over a couple of days whilst teaching a room of students live, so quite time constrained.
    the crux of the series i believe, wasn't to bog students down with asset creation, but get into the guts of the game mechanics and get the game running in a limited timeframe.

    but that said, if you click on the Environment in the heirarchy you can see that it is just a series of mesh objects and their respective colliders, just to save you time positioning them around your scene so you can spend more time on the game mechanics.

    the lighting is in the under the Lighting prefab object and the light/reflection probes are in there. there are overview tutorial vids for lighting in the tutorials section if you want to dig deeper.
    http://unity3d.com/learn/tutorials/modules/beginner/unity-5/unity5-lighting-overview?playlist=17102

    It looks really cool with the updates too, ive just downloaded again, and having a read :)
    oh, theres also the upgrade PDF in the assets root folder too for info.



    so what I would suggest IMO, possibly work through the series in the first pass.
    anything that you want to delve deeper into, come back to it.
     
    Last edited: May 22, 2016
    ladyonthemoon likes this.
  35. Dekata

    Dekata

    Joined:
    May 20, 2016
    Posts:
    47
    dear OboShape
    this time is TUT6, I drag and drop PlayerHealth and EnermyAttack but the bunny just give a sweet hug to player, When i set "is trigger " in capsule collider for player, The dreamer was hit but he also can walk throw the other objects and over map. Idk what I miss, Thanks for your help
     
    Last edited: May 22, 2016
  36. ladyonthemoon

    ladyonthemoon

    Joined:
    Jun 29, 2015
    Posts:
    236
    That's what I had figured out but I'd like to make it from scratch; I have all the time I need. ;) So, if you don't mind me asking, what would be the best level creation tutorial around?

    Ah, thank you! :)
     
  37. caicai67

    caicai67

    Joined:
    May 23, 2016
    Posts:
    1
    I know this question is old, but I recently had and solved an issue related to generating the mesh. I could not generate a mesh on the floor, and instead only saw it on a few higher-up surfaces.

    In my case, it was because the hierarchy's "Environment/Floor" directory was not set to static. Based on the tutorial, it seems to me as though the entirety of the "Environment" directory should be static, including "Environment/Floor".

    To fix this, I selected "Environment" in the hierarchy, then unchecked the "Static" box in the upper right corner of the inspector tab. When the pop up asked "Do you want to disable the static flags for all the child objects as well?" I selected "Yes, change children", essentially deselecting static for everything in the "Environment" directory. I then reselected "Static" and got the same dialog box, and again chose to apply the setting to the children.

    At this point, everything in "Environment" was static. Going back to the navigator tab, I tried bake again and this time it worked, creating a mesh that included the floor.
     
    GillianS and Dekata like this.
  38. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115

    OMG your answer is very clear and complete. Thank you. I did as you did. It worked well. One more question: This technique is very efficient right? Because we had a complex Meshes before. a lot of 3d meshes in the scene. After baking NavMesh, all meshes marked "Navigation Static" were FLAT MESH in the scene. FLAT MESH means 2D?
     
  39. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    I havent dont that much with navigation at all, but I believe this to be very efficient when you have alot of static geometry in your scene.

    What its done is precalculated what is considered walkable based on the details you declare in the nav agent bake tab settings (the step size and maximum traversable slope size etc) and generated/bake a mesh based on that.
    the nav agents can then refer to this single mesh to determine where it can access and walk across as opposed to doing alot more movement/physics calculations each step.

    so in this case there are alot of agents (bunnies) in the scene, but, they all just refer to this single baked mesh to see where they can walk. i imagine it would be quite a performance hit if say 30 bunnies were each trying to figure out at each step if a movement they wanted to make was a viable one.

    thats what I understand it to be, but, like i say I havent done much with this at all :(
     
  40. Dekata

    Dekata

    Joined:
    May 20, 2016
    Posts:
    47
    This is image i cant set bunny attack player so i set Is triger is on and the bunny did it, but player also can walk throw the other objects like lego,PlayerHealth and EnermyAttack were added,
     
    Last edited: May 24, 2016
  41. greatness

    greatness

    Joined:
    Feb 20, 2016
    Posts:
    199

    If you checked the IsTrigger box in player, remove it. I think that will do the trick. I'm not sure. Test it out.
     
    Dekata likes this.
  42. greatness

    greatness

    Joined:
    Feb 20, 2016
    Posts:
    199
    I was doing the upgrading Unity 4 audio to unity 5 and when i pressed the pause manager button at 5:30 in the video, it showed up the pause menu but the game did not pause. When I pressed resume, the game paused. However, I could shoot one bullet when I was paused. I also pressed the pause button(esc) again and clicked resume. I then resumed the game. What is going on? I tried the Completed Scene and saw that it work. But in my scene it doesn't work? why is this? is there something wrong with my scene?
     
  43. Dekata

    Dekata

    Joined:
    May 20, 2016
    Posts:
    47
    thanks for your help!
    but if I unchecked Is trigger , the bunny not attack player :(( still stuck at this
     
  44. Zeloi_Dev

    Zeloi_Dev

    Joined:
    Feb 10, 2016
    Posts:
    3
    I'm having an issue that is bugging me like crazy. (No pun intended) Zombunny's work great if I just put them in the hierarchy and play, but when I instantiate them into the game, they don't work correctly. The zombunny spawns but then I am immediately fed with these errors, NullReferenceException: The veriable player of EnemyAttack has not been assigned. ...

    I'm not sure if when we do GameObject.FindGameObjectWIthTag, It can't find it, or if It finds the one that is not in the hierarchy, or not. I hope you guys have some ideas about this, thanks!
     
  45. Zeloi_Dev

    Zeloi_Dev

    Joined:
    Feb 10, 2016
    Posts:
    3
    I actually had this issue aswell, make sure the floor in the environment is all static = true. That seemed to fix it for me!
     
  46. greatness

    greatness

    Joined:
    Feb 20, 2016
    Posts:
    199
    Make sure bunny has navmesh thingy. Also, make sure the navmesh thingy is baked and make sure in the script the navmesh Set Destination thingy is equal to player.position where player is the transform of the main hero. Also, make sure that the sphere collider is IsTrigger so it can attack the player.

    I hope this helps.
     
    Dekata likes this.
  47. greatness

    greatness

    Joined:
    Feb 20, 2016
    Posts:
    199
    A null Referene Expceptino error means that something has not been assigned. The culprit is probably in the inspector, not in the actual code itself(though it might be). Double check stuff in inspector and use debug.log to do some debugging. Hope this helps.
     
    OboShape likes this.
  48. greatness

    greatness

    Joined:
    Feb 20, 2016
    Posts:
    199
    I did a little bit of debugging and saw that for some weird reason, in the update function, the code there is repeated twice.

    Code:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEngine.UI;
    4. using UnityEngine.Audio;
    5. #if UNITY_EDITOR
    6. using UnityEditor;
    7. #endif
    8.  
    9. public class PauseManager : MonoBehaviour {
    10.  
    11.     public AudioMixerSnapshot paused;
    12.     public AudioMixerSnapshot unpaused;
    13.  
    14.     Canvas canvas;
    15.  
    16.     void Start()
    17.     {
    18.         canvas = GetComponent<Canvas>();
    19.     }
    20.  
    21.     void Update()
    22.     {
    23.         if (Input.GetKeyDown(KeyCode.Escape))
    24.         {
    25.             canvas.enabled = !canvas.enabled;
    26.             Pause();
    27.         }
    28.     }
    29.  
    30.     public void Pause()
    31.     {
    32.         Time.timeScale = Time.timeScale == 0 ? 1 : 0;
    33.         Lowpass ();
    34.    
    35.     }
    36.  
    37.     void Lowpass()
    38.     {
    39.         if (Time.timeScale == 0) paused.TransitionTo(0.1f);
    40.         else unpaused.TransitionTo(0.1f);
    41.     }
    42.  
    43.     public void Quit()
    44.     {
    45.         #if UNITY_EDITOR
    46.         EditorApplication.isPlaying = false;
    47.         #else
    48.         Application.Quit();
    49.         #endif
    50.     }
    51. }
    52.  

    Edit: I even debugged the completed scene.The code in the update is called once. I did some more testing by putting two pause managers in menu canvas. It pauses the game but doesnt show the pause menu. i know why it doesnt show the pause menu but not why it pauses the game. However, I started to think that there were two instances of pause manager and maybe that is what is going on. So i made pause manager a singleton. Nothing changed :( I really have no idea what to do. plz help.





    Edit:I solved my problem. I did have two instances of pause manager.
     
    Last edited: May 25, 2016
    OboShape likes this.
  49. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    Usually, I download many things from asset Store. And I use few of them due to what I need. Other things such as 3d objects, material, particles, textures stands on my Project panel even I don't use them.
    It has negative effect on CPU or Memory when I build a game?

    savol1.jpg
     
  50. Serruspancherrus

    Serruspancherrus

    Joined:
    May 25, 2016
    Posts:
    1
    Can anyone help me with the navigation baking I just can not get it right.