Search Unity

Survival Shooter Q&A

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

  1. P_R_O

    P_R_O

    Joined:
    May 10, 2016
    Posts:
    2
    It looked like lots of people had a issue at animation problems in phase 2.
    I just fixed it.
    All you have to do is go to the two transition between "Idle" and "Move". Select them and disable the "Have exit time"
    Then Everything is fine.
     
    GingerMcNinja likes this.
  2. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    One for the guys when they get back, but in general as far as i've read, the majority of unused items in the heirarchy wont be included in the build.
    Heres a page to have a look at for more info in the mean time.
    http://docs.unity3d.com/Manual/ReducingFilesize.html
     
    KAYUMIY likes this.
  3. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    What exactly are you having problems with? and can you explain what is not the same or what errors you are getting.

    Need a bit more information to help out.
     
  4. gaocan1992

    gaocan1992

    Joined:
    May 27, 2016
    Posts:
    1
    Have you found a solution yet? This is strange to me too.
     
  5. tmdag

    tmdag

    Joined:
    May 22, 2016
    Posts:
    1
    Hey guys, I'm on Unity 5.3.4

    GameObject.FindWithTag("Player").transform
    returns:
    Player(Clone) (UnityEngine.Transform)
    UnityEngine.MonoBehaviour:print(Object)

    and position is empty (0,0,0)
    but
    GameObject.Find("Player").transform
    returns:
    Player (UnityEngine.Transform)
    UnityEngine.MonoBehaviour:print(Object)
    gives me proper, players position.

    I do have "player" tag on "player" object. Why is that happening ?
     
  6. Jacch

    Jacch

    Joined:
    May 27, 2016
    Posts:
    1
    I'm having an issue where, when I have enemies spawn, they get stuck behind walls and can't leave the spawn point. I've also tried simply placing an enemy next to the player; when I click play, though, the enemy defaults onto the nearest elevated surface (such as the top of the stool or dresser) and can't move off to get to the player. I'm don't have any clue where I messed up.

    Solved.
     
    Last edited: May 27, 2016
    Berkeley-Zhou likes this.
  7. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    When your using the
    Code (CSharp):
    1. GameObject.FindWithTag("Player").transform;
    make sure that your player, has the exact same tag assigned (case sensitive) as you are searching for, ie "Player".

    I take it there is only one player in the Scene? just that FindWithTag will only return the first object with that tag it finds.
     
  8. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    836
    Have another look at the navigation section, when looking at the navmesh, sounds like the floor isnt part of the static mesh?
    http://unity3d.com/learn/tutorials/projects/survival-shooter/enemy-one?playlist=17144

    should be able to see the floor as the light blue color same as they have in the video.
     
    Jacch likes this.
  9. vesion

    vesion

    Joined:
    May 27, 2016
    Posts:
    1
    @Umbra1 You helped me a lot! Thank you!
    More specifically, in 'Object' tab of 'Navigation' window, select 'All' filter, then check the items in 'Environment' GameObject one by one, the 'Floor' item's 'Base', 'Planks' and 'Sides' are 'Navigation Static' unchecked, so check them on will solve the problem.
     
  10. greatness

    greatness

    Joined:
    Feb 20, 2016
    Posts:
    199
    upload_2016-5-27_19-21-58.png



    Uh, guys? I just realized my UI Slider does not look like the one in the videos. Also, the slider is very glitchy! Whenever I choose some other options for the fill rect and the handle rect, sometimes it responds to the changes. However, whenever I change the options again, sometimes it doesnt respond to the changes. My slider is very glitchy!
     

    Attached Files:

  11. knighteousness

    knighteousness

    Joined:
    Mar 3, 2016
    Posts:
    2
    Forgive me if I missed the answer to this, but does anyone have info on where to get the "MenuCanvas" mentioned in the final upgrade lesson video? I looked throughout the 8 pages of this thread as well as everywhere else I could think of on the internet, but to no avail. I've seen others ask about it but I haven't seen any answer. I looked through all the Assets, and I'm using the most recent download of the Asset package. I also tried all the "links below" that the video mentioned, but they didn't have the answers either.

    Also I encountered a lot of similar problems to others and wanted to suggest a perusal of the upgrade guide included in the root folder of the downloaded assets. Finally, thank you jaimemh and rePhat for your comments! They helped a lot with my lighting problem.
     
  12. dominic1991

    dominic1991

    Joined:
    May 14, 2016
    Posts:
    1
    When I following the Survival Shooter Tutorial Phase 4, the enemy is missing for being placed higher than floor. I found that the "Navigation Static" flag of "Floor" in the "Environment" has not been checked. It works after fixed.
     
  13. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    If you write your problem clearly, we will try to solve
     
  14. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    In the 7th series of Survival Shooter.

    Survival Shooter Tutorial - 7 of 10 : Harming Enemies
    There is a public method which is called StartSinking in EnemyHealth script.
    See below:

    Code (CSharp):
    1. public void StartSinking ()
    2.     {
    3.         GetComponent <NavMeshAgent> ().enabled = false;
    4.         GetComponent <Rigidbody> ().isKinematic = true;
    5.         isSinking = true;
    6.         //ScoreManager.score += scoreValue;
    7.         Destroy (gameObject, 2f);
    8.     }
    You know, we delete EnemyObject after Sinking. Why do we need to write these two codes(see below) in spite of the fact that we delete EnemyObject.

    Code (CSharp):
    1. GetComponent <NavMeshAgent> ().enabled = false;
    2.         GetComponent <Rigidbody> ().isKinematic = true;
     
  15. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    Why are these gameObjects different color which are black and blue.
    Untitled.jpg
     
  16. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    I want to call a public method in Animation Event. However, my obejct does not have animation like ZomBunny.
    This picture explain my problem. See below:
    aaa.jpg
     
  17. jakehowe2004

    jakehowe2004

    Joined:
    May 27, 2016
    Posts:
    1
    Anyone having ISSUES with the Environment? (Floor)
    Such as ZomBunny / ZomBear walking / moving but not following your main character but Animation on them is showing,
    just not Following like Stuck in a spot. (even in High Areas)???

    SOLUTION:

    1) go to WINDOW up top, then click NAVIGATION.
    2) NOW in the NAVIGATION window make sure OBJECT is selected.
    3) click MESH RENDERERS just below OBJECT.
    4) Now in the HIERARCHY panel, look for PLANKS and click it.
    5) Now back in the NAVIGATION panel you need to click the check box for
    NAVIGATION STATIC!

    Now the Enemies will follow and walk on the surfaces needed
    for the game to actually work.

    Hope this helps... I'm new to game development and design so learning myself.
    Thanks: Jake Howe (AKA) DarkRisen
     
    money4honey likes this.
  18. money4honey

    money4honey

    Joined:
    May 26, 2016
    Posts:
    11
    hello everyone! i tried to fix some problems with the environment, and i found a solution.
    in unity 5.3.5f1 i have a bug with floor, like this:


    it can be fixed, if you set environment -> floor to static, in the inspector:

    99eaac31b4.jpg

    but, when i done this, i received this bug:



    i use this settings for Bake:

    e1a94bd975.jpg

    if you have the same problem, all you need to do is follow unity instructions: divide agent radius into four. (in my case 0.75 / 4 = 0.1875)
    when i set voxel size to 0.1875, this solved my problem:

    9da514db10.jpg
     
    Last edited: Jun 3, 2016
    rewar281 likes this.
  19. rein12

    rein12

    Joined:
    Jun 3, 2016
    Posts:
    1
    Hi,

    I'm having with Phase 2 of the lesson. I have followed the scripts for player movement and all are well.
    When i try to move the character it glides off instead of umping, after a few second it starts to move.
    After going through the forum, i saw that i just have to unchecked the "has exit time" in animation tab. Instead now it the complete opposite. My character starts jumping and it doesnt stop when my character is idle, only after a certain period of time that the idle animation will play
     
  20. money4honey

    money4honey

    Joined:
    May 26, 2016
    Posts:
    11
    I have the same bug. I uncheck 'has exit time' in move -> idle and any state -> death. it works for me.
    maybe you need save a scene before test, or even reboot editor to apply these changes.
     
    Last edited: Jun 3, 2016
  21. sgrunwald

    sgrunwald

    Joined:
    Jun 3, 2016
    Posts:
    1
    I'm having a problem animating my player. The walk and death animations do nothing to the player itself despite having unclicked the "has exit time" box and making sure the PlayerAC is attached to the Player appropriately. Now here's the weird part: the gun is animated just fine. It bounces as the character moves and falls when it dies, but the player model itself never changes. Does anyone have any potential solutions? I would REALLY appreciate it
     
  22. rewar281

    rewar281

    Joined:
    Apr 7, 2015
    Posts:
    24
    This got me close to a solution, but notice there are still weird things going on. Namely a little south to the fire truck there's a dip in the planks that doesn't get "navmeshed", then south of the doll arm, a plank crack/spacing, south of the desk another crack/spacing and finally near the mouse hole again a plank. I'm sure this could be considered nitpicking but playing with slope or any other settings doesn't get me a full floor. Does anyone know why this happens?
     
  23. knighteousness

    knighteousness

    Joined:
    Mar 3, 2016
    Posts:
    2
    Okay this might be cheating but here's what I did (and I'm quite new at all of this so if someone has a better or cleaner method than by all means let me know!):
    1. After getting through the first upgrade lesson, save the scene and open a new scene
    2. Open the scene found in the _CompletedAssets folder called "Level 01 5.x.unity"
    3. In that scene, the MenuCanvas game object exists, drag the parent object into your prefabs folder
    4. Close out of that scene, no need to save, and reopen your tutorial scene
    5. Drag your prefab MenuCanvas into the hierarchy, and disconnect the prefab instance
    6. In _CompletedAssets/Scripts/Managers, move the "Pause Manager" script into your Scripts Folder
    7. Move the _CompletedAssets/Scripts/Audio folder into your Scripts Folder
    8. In the Inspector for MenuCanvas, for the Pause Manager component, circle-select your AudioMixerSnapshots
    9. In the Mix Levels component, also circle-select the MasterMixer audio mixer you made in the tutorial
    10. (Unnecessary step) I also saved/closed, moved my _CompletedAssets folder in Windows, and confirmed that the scene still worked with the new MenuCanvas game object. The fact that it worked meant there were no lingering assets that I hadn't created myself needed to run the pause menu
    I seriously would love a tutorial on how to actually make this pause menu though, instead of just moving a game object into my project. So if anyone finds that then I'd be happy to know about it.
     
    Last edited: Jun 4, 2016
  24. money4honey

    money4honey

    Joined:
    May 26, 2016
    Posts:
    11
    I tested enemies movement near the fire truck and the doll arm, and it working fine (enemies walk through this areas), even despite there a dip in the planks.
     
  25. ladyonthemoon

    ladyonthemoon

    Joined:
    Jun 29, 2015
    Posts:
    236
    Hi,

    I did the reverse and now I know how to make an environment; I can carry on with this tutorial then! ;)
     
    money4honey likes this.
  26. ladyonthemoon

    ladyonthemoon

    Joined:
    Jun 29, 2015
    Posts:
    236
    Hi,

    So far, so good but I have a question. How could I modify the PlayerMovement script and add mouse look to it?

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class PlayerMouvementScript : MonoBehaviour
    5. {
    6.     public float speed;
    7.  
    8.     Vector3 movement;
    9.     Animator anim;
    10.     Rigidbody playerRigidbody;
    11.     int floorMask;
    12.     float camRayLength = 100;
    13.  
    14.     void Awake ()
    15.     {
    16.         floorMask = LayerMask.GetMask ("Floor");
    17.         anim = GetComponent<Animator> ();
    18.         playerRigidbody = GetComponent<Rigidbody> ();
    19.     }
    20.  
    21.     void FixedUpdate ()
    22.     {
    23.         float h = Input.GetAxisRaw("Horizontal");
    24.         float v = Input.GetAxisRaw("Vertical");
    25.         Move (h, v);
    26.         Turning ();
    27.         Animating (h, v);
    28.     }
    29.  
    30.     void Move (float h, float v)
    31.     {
    32.         movement.Set (h, 0.0f, v);
    33.  
    34.         movement = movement.normalized * speed * Time.deltaTime;
    35.  
    36.         playerRigidbody.MovePosition (transform.position + movement);
    37.     }
    38.  
    39.     void Turning ()
    40.     {
    41.         Ray camRay = Camera.main.ScreenPointToRay (Input.mousePosition);
    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 = 0.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 != 0.0f || v != 0.0f;
    58.         anim.SetBool ("IsWalking", walking);
    59.     }
    60. }
    61.  
     
  27. Rockyeahh

    Rockyeahh

    Joined:
    May 19, 2016
    Posts:
    17
    Hey there I've got a problem with step 10. I am running Unity 5.3.4.
    I followed everything and it all works except the GameOver Text is there throughout the game rather than just at the end.

    I attached the gameover script and a print screen of unity.
     

    Attached Files:

  28. money4honey

    money4honey

    Joined:
    May 26, 2016
    Posts:
    11
    maybe you need set GameOverText color alpha to zero

    f24b4fc403.jpg
     
  29. Rockyeahh

    Rockyeahh

    Joined:
    May 19, 2016
    Posts:
    17

    Ahh I saw what I did, I set the effect alpha color to zero instead of the text alpha color to zero. Thank you. :)
     
  30. monkeybrainz

    monkeybrainz

    Joined:
    Dec 16, 2015
    Posts:
    35
    Hello!

    In the video there is a large flash in front of the gun barrel, presumably from the gunLight. In my version the laser line works fine every time I shoot, but the large flash only appears once. After shooting one time, it doesn't work again. Can someone suggest what I missed in the setup or what settings I should check?

    Thank you
     
  31. noclew

    noclew

    Joined:
    Jun 10, 2016
    Posts:
    7
    Hi,

    I am trying the make a navmesh for the environment in Unity 5.4, but I can never make the proper navmesh. I tried the parameters in the update PDF for Unity 5 and several of other values in the forum, but the consequences were always same as in the enclosed. As you can see, no nevmesh on the floor, but only small spots on the top of obstacles.

    Can anyone suggest any solution? I have been stuck at this problem for 5 hours so far...

    Thanks in advance.

     
  32. ladyonthemoon

    ladyonthemoon

    Joined:
    Jun 29, 2015
    Posts:
    236
    money4honey likes this.
  33. money4honey

    money4honey

    Joined:
    May 26, 2016
    Posts:
    11
    try this
     
  34. money4honey

    money4honey

    Joined:
    May 26, 2016
    Posts:
    11
    maybe you have problem with your PlayerShooting script
    Code (csharp):
    1.  
    2. using UnityEngine;
    3.  
    4. public class PlayerShooting : MonoBehaviour
    5. {
    6.     public int damagePerShot = 20;
    7.     public float timeBetweenBullets = 0.15f;
    8.     public float range = 100f;
    9.  
    10.  
    11.     float timer;
    12.     Ray shootRay;
    13.     RaycastHit shootHit;
    14.     int shootableMask;
    15.     ParticleSystem gunParticles;
    16.     LineRenderer gunLine;
    17.     AudioSource gunAudio;
    18.     Light gunLight;
    19.     float effectsDisplayTime = 0.2f;
    20.  
    21.  
    22.     void Awake ()
    23.     {
    24.         shootableMask = LayerMask.GetMask ("Shootable");
    25.         gunParticles = GetComponent<ParticleSystem> ();
    26.         gunLine = GetComponent <LineRenderer> ();
    27.         gunAudio = GetComponent<AudioSource> ();
    28.         gunLight = GetComponent<Light> ();
    29.     }
    30.  
    31.  
    32.     void Update ()
    33.     {
    34.         timer += Time.deltaTime;
    35.  
    36.         if(Input.GetButton ("Fire1") && timer >= timeBetweenBullets && Time.timeScale != 0)
    37.         {
    38.             Shoot ();
    39.         }
    40.  
    41.         if(timer >= timeBetweenBullets * effectsDisplayTime)
    42.         {
    43.             DisableEffects ();
    44.         }
    45.     }
    46.  
    47.  
    48.     public void DisableEffects ()
    49.     {
    50.         gunLine.enabled = false;
    51.         gunLight.enabled = false;
    52.     }
    53.  
    54.  
    55.     void Shoot ()
    56.     {
    57.         timer = 0f;
    58.  
    59.         gunAudio.Play ();
    60.  
    61.         gunLight.enabled = true;
    62.  
    63.         gunParticles.Stop ();
    64.         gunParticles.Play ();
    65.  
    66.         gunLine.enabled = true;
    67.         gunLine.SetPosition (0, transform.position);
    68.  
    69.         shootRay.origin = transform.position;
    70.         shootRay.direction = transform.forward;
    71.  
    72.         if(Physics.Raycast (shootRay, out shootHit, range, shootableMask))
    73.         {
    74.             EnemyHealth enemyHealth = shootHit.collider.GetComponent <EnemyHealth> ();
    75.             if(enemyHealth != null)
    76.             {
    77.                 enemyHealth.TakeDamage (damagePerShot, shootHit.point);
    78.             }
    79.             gunLine.SetPosition (1, shootHit.point);
    80.         }
    81.         else
    82.         {
    83.             gunLine.SetPosition (1, shootRay.origin + shootRay.direction * range);
    84.         }
    85.     }
    86. }
    87.  
    88.  
    also check your light settings:

    ea5cede98c.jpg
     
  35. maycool1233

    maycool1233

    Joined:
    Jun 10, 2016
    Posts:
    2
  36. maycool1233

    maycool1233

    Joined:
    Jun 10, 2016
    Posts:
    2
  37. monkeybrainz

    monkeybrainz

    Joined:
    Dec 16, 2015
    Posts:
    35
    Thanks for the suggestions, money4honey. I had been using my computer all day when i was getting that issue. When I started up my laptop fresh this morning I got a few gunLight flashes before it stopped working. So i put some code on the Update() function to check what's going on.

    Code (CSharp):
    1. void Update ()
    2.     {
    3.         timer += Time.deltaTime;
    4.  
    5.         if(Input.GetButton ("Fire1") && timer >= timeBetweenBullets && Time.timeScale != 0)
    6.         {
    7.             Shoot ();
    8.         }
    9.  
    10.         if(timer >= timeBetweenBullets * effectsDisplayTime)
    11.         {
    12.             DisableEffects ();
    13.         }
    14.  
    15.         if (gunLight.enabled == false)
    16.         {
    17.             print("gunLight disabled");
    18.         }
    19.         else
    20.         {
    21.             print("gunLight ENABLED");
    22.         }
    23.  
    24.     }
    I can see the gunLight being ENABLED/disabled. My laptop has an Intel HD 520 graphics card and doesn't slow down while playing so this is definitely weird, but not the end of the world. Inconsistencies are annoying
     
  38. ladyonthemoon

    ladyonthemoon

    Joined:
    Jun 29, 2015
    Posts:
    236
    I'm at a complete loss; I cannot get the EnemyAttack script to work. I'm getting two error messages:
    • NullReferenceException: Object reference not set to an instance of an object
      EnemyAttackScript.Update () (at Assets/_Scripts/EnemyAttackScript.cs:49)
    • NullReferenceException: Object reference not set to an instance of an object
      EnemyAttackScript.Attack () (at Assets/_Scripts/EnemyAttackScript.cs:59)
      EnemyAttackScript.Update () (at Assets/_Scripts/EnemyAttackScript.cs:46)
    Okay, the problem is not with the script; it compiles perfectly, but with the Zombunny. It seems to be missing something but I have no idea what.
     
    Last edited: Jun 11, 2016
  39. money4honey

    money4honey

    Joined:
    May 26, 2016
    Posts:
    11
    You can check the Complete folder. There is a finished Zombunny prefab and EnemyAttackScript. This may help you figure out what wrong with your project.
     
    ladyonthemoon likes this.
  40. ladyonthemoon

    ladyonthemoon

    Joined:
    Jun 29, 2015
    Posts:
    236
    Thanks. I did take a look and I didn't see any difference, so, I trashed the entire project. I'm remaking it from scratch now.

    I should have edited or deleted my post, sorry. :)
     
  41. richardrl

    richardrl

    Joined:
    Jun 4, 2016
    Posts:
    17
    My Zombunny works fine, but both Zombear and Hellephant are 1) not taking damage and 2) not attacking my Player. I used Debug.log to ascertain that my playerHealth is null, even though my player object is non-null. I really don't understand how this is possible because all 3 enemies are set to the same Player, yet playerHealth is non-null for Zombunny but null for the other two enemies (since I can receive and apply damage to Zombunny fine, but cannot do either for the other two enemies).

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. namespace CompleteProject
    5. {
    6.     public class EnemyAttack : MonoBehaviour
    7.     {
    8.         public float timeBetweenAttacks = 0.5f;     // The time in seconds between each attack.
    9.         public int attackDamage = 10;               // The amount of health taken away per attack.
    10.  
    11.  
    12.         Animator anim;                              // Reference to the animator component.
    13.         GameObject player;                          // Reference to the player GameObject.
    14.         PlayerHealth playerHealth;                  // Reference to the player's health.
    15.         EnemyHealth enemyHealth;                    // Reference to this enemy's health.
    16.         bool playerInRange;                         // Whether player is within the trigger collider and can be attacked.
    17.         float timer;                                // Timer for counting up to the next attack.
    18.  
    19.  
    20.         void Awake ()
    21.         {
    22.             // Setting up the references.
    23.             player = GameObject.FindGameObjectWithTag ("Player");
    24.             if (player == null) {
    25.                 Debug.Log ("player null");
    26.             }
    27.  
    28.             playerHealth = player.GetComponent <PlayerHealth> ();
    29.  
    30.             if (playerHealth == null) {
    31.                 Debug.Log ("playerHealth null");
    32.             }
    33.             enemyHealth = GetComponent<EnemyHealth>();
    34.             anim = GetComponent <Animator> ();
    35.         }
    36.  
    37.  
    38.         void OnTriggerEnter (Collider other)
    39.         {
    40.             // If the entering collider is the player...
    41.             if(other.gameObject == player)
    42.             {
    43.                 // ... the player is in range.
    44.                 playerInRange = true;
    45.             }
    46.         }
    47.  
    48.  
    49.         void OnTriggerExit (Collider other)
    50.         {
    51.             // If the exiting collider is the player...
    52.             if(other.gameObject == player)
    53.             {
    54.                 // ... the player is no longer in range.
    55.                 playerInRange = false;
    56.             }
    57.         }
    58.  
    59.  
    60.         void Update ()
    61.         {
    62.             // Add the time since Update was last called to the timer.
    63.             timer += Time.deltaTime;
    64.  
    65.             // If the timer exceeds the time between attacks, the player is in range and this enemy is alive...
    66.             if(timer >= timeBetweenAttacks && playerInRange && enemyHealth.currentHealth > 0)
    67.             {
    68.                 // ... attack.
    69.                 Attack ();
    70.             }
    71.  
    72.             // If the player has zero or less health...
    73.             if(playerHealth.currentHealth <= 0)
    74.             {
    75.                 // ... tell the animator the player is dead.
    76.                 anim.SetTrigger ("PlayerDead");
    77.             }
    78.         }
    79.  
    80.  
    81.         void Attack ()
    82.         {
    83.             // Reset the timer.
    84.             timer = 0f;
    85.  
    86.             // If the player has health to lose...
    87.             if(playerHealth.currentHealth > 0)
    88.             {
    89.                 // ... damage the player.
    90.                 playerHealth.TakeDamage (attackDamage);
    91.             }
    92.         }
    93.     }
    94. }
     

    Attached Files:

  42. richardrl

    richardrl

    Joined:
    Jun 4, 2016
    Posts:
    17
    Solved my own problem. For the Enemy Manager components for my Zombear and Hellephant I was using, in the "Enemy" field, Zombear and Hellephant gameobjects from the _CompletedAssets Prefabs folder instead of the Assets Prefabs folder. I am curious how the Enemy Manager works however... can it only "see" the Player instance if the Player prefab is in the same directory as the Hellephant prefab? Why can't you see a Player instance if the Player prefab is in a different folder?
     
  43. richardrl

    richardrl

    Joined:
    Jun 4, 2016
    Posts:
    17
    How were the Player and Enemy animations created for this tutorial? For example, Idle, Move, Death. Were these done in Unity or a 3rd party program (if so, which?)?
     
  44. greatness

    greatness

    Joined:
    Feb 20, 2016
    Posts:
    199
    I think it was a third party. Unity has no making animation thingy, you have to get an "external application" for artwork. Unity probably used something called Maya.
     
  45. greatness

    greatness

    Joined:
    Feb 20, 2016
    Posts:
    199
    :confused: 2 Questions folks:

    1. why does the player shoot when the game is paused

    2. why doesn't the game quit when I click quit?

    Pause Manager
    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)
    40.         {
    41.             paused.TransitionTo(0.1f);
    42.          
    43.         }
    44.         else {
    45.             unpaused.TransitionTo(0.1f);
    46.            
    47.         }
    48.     }
    49.    
    50.     public void Quit()
    51.     {
    52.         #if UNITY_EDITOR
    53.         EditorApplication.isPlaying = false;
    54.         #else
    55.         Application.Quit();
    56.         #endif
    57.     }
    58. }
    59.  
     
  46. greatness

    greatness

    Joined:
    Feb 20, 2016
    Posts:
    199
    weird... when I build the game the enemies follow and attack the player and everything is fine( except for the fact that the game doesn't restart and I can't quit the game). In the scene, however, the enemies don't attack the player :(.
     
  47. greatness

    greatness

    Joined:
    Feb 20, 2016
    Posts:
    199
    x
    I think so. Not sure...
     
  48. ladyonthemoon

    ladyonthemoon

    Joined:
    Jun 29, 2015
    Posts:
    236
    So, I've redone the project up to where I was when I trashed it and... it's now working great! Yeah! :D
     
  49. money4honey

    money4honey

    Joined:
    May 26, 2016
    Posts:
    11
    happy for you :). you are sure that nothing is missed, when you did it last time? maybe you use new beta editor? I heard there might be some bugs
     
  50. ladyonthemoon

    ladyonthemoon

    Joined:
    Jun 29, 2015
    Posts:
    236
    Something was probably missing but I've never found out what it was and, no, I'm not using the beta; I'm not that adventurous. :p I'm using 5.3.5f1 Personal edition.

    It's working, okay, but, I'm getting that message in the console, after playing the game: