Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Survival Shooter Q&A

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

  1. Wilave

    Wilave

    Joined:
    Sep 10, 2015
    Posts:
    3
    My player isn't responding to any input from the keyboard or mouse. Has anyone else run into this problem?

    Or has anyone hit the error

    'Player' AnimationEvent 'RestartLevel' has no reciever! Are you missing a component?
     
  2. implanted

    implanted

    Joined:
    Sep 25, 2015
    Posts:
    1
    Guys, plz, help me with my problem
    I don't understand, why my gun shootin in incorrect way?
     

    Attached Files:

    • se1.png
      se1.png
      File size:
      297.5 KB
      Views:
      1,071
    • se2.png
      se2.png
      File size:
      534.4 KB
      Views:
      1,044
  3. Wilave

    Wilave

    Joined:
    Sep 10, 2015
    Posts:
    3
    I tried starting a new game from scratch, and after finishing the second tutorial video, my character isnt responding to the mouse and keyboard. No matter what I press it just sits there with its idle animation. All of the "Has Exit time" boxes are unchecked like other sources say to do, and my code is identical. I have run into the error:

    "Asset 'PlayerAC' : Transition in state 'AnyState' doesnt have an Exit Time or any condition, transition will be ignored"

    Any idea what's up?
     
  4. Mr.Mille

    Mr.Mille

    Joined:
    Sep 17, 2015
    Posts:
    21
    Try this one: go to Players child object "GunBarrelEnd" in the Hierarchy. In the Inspector go to LineRenderer component and set "Use World Space" to active.
     
  5. Mr.Mille

    Mr.Mille

    Joined:
    Sep 17, 2015
    Posts:
    21
    Check the speed variable in the Inspector of the Player object. It should be set to 6.
     
  6. UnuThul

    UnuThul

    Joined:
    Sep 29, 2015
    Posts:
    2
    Everything was going fine till the very last step ...
    After placing the GameOverManager script on the HUDCanvas, I just can't set the "Player" as the PlayerHealth.
    Tried to drag and drop, used the circle thing and chose "Player" but nothing happens.
    Any ideas on what it could be ? Very frustrating to be stuck at the last step :(

    Thanks !
     

    Attached Files:

  7. UnuThul

    UnuThul

    Joined:
    Sep 29, 2015
    Posts:
    2
    Redid some steps before and now it seems to work, probably messed somewhere.

    Thanks anyway ;)
     
  8. westhill220

    westhill220

    Joined:
    Sep 29, 2015
    Posts:
    2
    I am having issues with the RayCast in Turning block of code. I wrote the Debug.Log and narrowed down the problem but am not able to find a solution anywhere. I don't want to proceed with project till I get this solved. Please help...
     

    Attached Files:

  9. Mr.Mille

    Mr.Mille

    Joined:
    Sep 17, 2015
    Posts:
    21
    Did you set the Layer of the Floor object to Floor?
     
  10. westhill220

    westhill220

    Joined:
    Sep 29, 2015
    Posts:
    2
    Yes I did. Still not getting anything from the mouse... I'm going to try to remake the Floor quad and see if that works.

    EDIT- Re-made the Floor Quad from scratch and layered it to Floor and it works.
     
    Last edited: Oct 1, 2015
  11. haolly

    haolly

    Joined:
    Sep 8, 2015
    Posts:
    15
    I have the same doubts with you, :(
     
  12. danbannana

    danbannana

    Joined:
    Aug 24, 2015
    Posts:
    4
    i just completed the roll a ball tutorial and i wanted to do this one. so i downloaded the asset pack from the store but it didn't come with the environment prefab! what do i do?
     
    Last edited: Oct 6, 2015
  13. peteorstrike

    peteorstrike

    Unity Technologies

    Joined:
    Oct 4, 2013
    Posts:
    116
    Hi @danbannana - sounds like the package might not have downloaded correctly? Delete the current download of the package from you hard drive, which you can find in the following location based on your OS:

    Win 7+ SYSTEM DRIVE:\Users\YOURNAMEHERE\AppData\Roaming\Unity\Asset Store-5.x\Unity Technologies
    Mac: ~/Library/Unity/Asset Store-5.x/

    Then try re-downloading the package from the asset store, making sure to use the 5.0 version, as shown here:
    https://www.assetstore.unity3d.com/en/#!/content/40756
     
  14. NamesMark

    NamesMark

    Joined:
    Oct 7, 2015
    Posts:
    1
    I've got a performance problem. Every time I kill a critter or a critter touches the player the lag for 1-3 seconds occurs. Any suggestions on what might cause the problem?

    The bug appeared on the 10th step of the tutorial, but I was unable to troubleshoot it.
     
  15. Scorael

    Scorael

    Joined:
    Apr 12, 2015
    Posts:
    12
    Hi Rephat,
    I had the same issue with the other guy earlier (player not turning with the mouse) and I used the debug codes accordingly.

    The result is the console saying "ray didnt hit". So any idea what I did wrong? I copied the code from the Unity website.

    I also have issues with the move animation not working when I tested the game.

    I am new to C# and Unity in general so go easy on me, please :)
     
  16. Scorael

    Scorael

    Joined:
    Apr 12, 2015
    Posts:
    12
    Ok, I should've gone through the forums a bit more for the animation issue.

    The turning issue was fixed by rebuilding the 'floor' quad and ensuring its z transform scale is set to 1. Not completely sure why this fixed it.
     
  17. AllTheGoodNamesWereTaken

    AllTheGoodNamesWereTaken

    Joined:
    Sep 24, 2015
    Posts:
    14
    5 of 10 of the Survival Shooter tutorial, adding a UI image makes a sort of rounded square image instead of a square image so it flashes a red speech bubble instead of a full red screen. It appears normal at first but when I try to resize it I get this. I also get this error in the console: GI output for inputsystem: d4dc31c841a111e4cee8ba4fa6bca33e (02745bfc2fde0971cc356c0ec95fc28b) is missing.

    *Edit: I read some where that this was a glitch that would hopefully be fixed in a later version. Please correct me if I am wrong.

    On a side note;
    Many people seemed to have this problem:
    This works but has this been fixed yet?
    After reloading the level and waiting for quite some time the shadows still appear very dark so I assume this means it only updates in the editor when not in play mode. Anyways the shadows (GI) works just fine after building.
     
    Last edited: Oct 26, 2015
    bengrayawhile likes this.
  18. SoCentral2

    SoCentral2

    Joined:
    Oct 6, 2015
    Posts:
    10
    I had the same problem as Uni00 here, now I'm trying to figure out why. Using Visual Studio 2015, with the original code searching on tags: -

    Code (CSharp):
    1. player = GameObject.FindGameObjectWithTag ("Player").transform;
    the zombunny heads for the origin point.


    However the updated code searching on the object name has the zombunny chasing the player as expected: -

    Code (CSharp):
    1. player = GameObject.Find("Player").transform;

    Untitled1.png


    Untitled2.png

    Using FindGameObjectWithTag shows player as "Player(Clone) ..." and its co-ords are always zero whereas using find the object is "Player ..." and the co-ords are accurately reflected.

    I get a similar issue (and resolution) at the end of part 4 in EnemyAttack.cs. The original code is: -

    Code (CSharp):
    1. player = GameObject.FindGameObjectWithTag ("Player");
    When replaced with the following, everything works correctly.

    Code (CSharp):
    1. player = GameObject.Find("Player");
     
    Last edited: Oct 10, 2015
    echo6106 likes this.
  19. magicRawb

    magicRawb

    Joined:
    Oct 12, 2015
    Posts:
    3
    I've just finished the end of 'Harming Enemies' and have a pretty strange problem. I looked through this whole thread and didn't find anything similar, so here it is.

    When I fire the gun, the bullets fly, the gun makes sound, but the bullets don't come out of the GunBarrelEnd, and I followed the video tutorials as stated. Below are some screen shots. The bullets move around when I move the mouse, sometimes not visible at all.

    Screenshot (31).png

    Edit: Turns out, I missed one post that asked the same question. Solved the problem by going to the GunBarrelEnd child object and checking the box for 'Use World Space' in the line renderer component.
     
    Last edited: Oct 14, 2015
    Piphan and peteorstrike like this.
  20. uncones

    uncones

    Joined:
    Sep 19, 2015
    Posts:
    14
    How can I make this character jump with or without an imported animation stage.?

    Thank you
     
  21. Scorael

    Scorael

    Joined:
    Apr 12, 2015
    Posts:
    12
    Just finished the camera setup tutorial. For some reason my character can't walk beyond a certain spot like there is an invisible wall blocking him.

    Also my character does not track the mouse when I position it behind him.

    Anyone can help me with this?
     
  22. bkilat

    bkilat

    Joined:
    Oct 17, 2015
    Posts:
    1
    I am having the same issue as AllTheGoodNamesWereTaken both my DamageImage and ScreenFader Images end up being curved and do not fill the entire HUD space. I cant seem to figure out why it is not filling the entire HUDCanvas.
    roundedSF.jpg
     
    bengrayawhile likes this.
  23. SP-Designs

    SP-Designs

    Joined:
    Oct 13, 2015
    Posts:
    184
    Hi there! I love this tutorial and it has tought me a lot but on chapter 10/10 at 9:21 where we add an animation window etc. on the HUDCanvas, something went wrong for me.At first i created the GameOverClip like they did in the video but now i cannot select it and when i click on the HUDCanvas and then click to create a new clip and i create it it does not do anything.Can you please help me? I am so close to finishing this game!
     
  24. bengrayawhile

    bengrayawhile

    Joined:
    Oct 1, 2015
    Posts:
    1
    Hello,

    I am having the same UI troubles as bkilat and AllTheGoodNamesWereTaken. Depending where i position various UI elements the elements that come after them are affected. Any idea whats going on? i know it is somehow linked to the Source Image in the Image script as the problem goes away if i change them to none.

    Thanks error ex 3.png error ex 2.png error ex 1.png
     
  25. Jayneh

    Jayneh

    Joined:
    Oct 25, 2015
    Posts:
    2
    I am having issues with the screen flash when the player takes damage. It doesn't fill the whole screen. It fills the middle of the screen with a clear border around it. Not sure how to expand it out to the edges of the screen. I have the Rect Transform set to (shift) stretch with all the points set to 0. My anchors are min 0 and max 1 with a .5 pivot. How do I fix this?
     
  26. nemean_cestus

    nemean_cestus

    Joined:
    Jul 25, 2013
    Posts:
    1
    Can somebody upload the 4.6 version of the project? I am still using version 4.6.
     
  27. Nisho100

    Nisho100

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

    Attached Files:

  28. fireye14

    fireye14

    Joined:
    Oct 27, 2015
    Posts:
    2
    I was also having this issue. It seems as though stretching the Damage Image to a point where it was covering the Health UI would cause the shape of the Damage Image to change. My solution was to change the source image of the Damage Image to something included in the current assets that will fill the entire space. Personally I changed mine to 'UISprite', but it should work if you use other ones too since we're changing the RGBA value of it anyway.
     
  29. fireye14

    fireye14

    Joined:
    Oct 27, 2015
    Posts:
    2
    The code is the same as mine. Make sure the PlayerHealth script is attached to your Player game object, and that your Player game object is, in fact, named "Player."
     
  30. Mazar_93

    Mazar_93

    Joined:
    Oct 29, 2015
    Posts:
    4
    Hey, I finished part 6. After this the enemy should attack the player, but the compiler shows

    Error NullReferenceException: Object reference not set to an instance of an object Solution 'Surrival Shooter' ‎(3 projects) Assets/Scripts/Enemy/EnemyAttack.cs 54

    at this line of code

    if(playerHealth.currentHealth <= 0)
     
  31. CGMKD106

    CGMKD106

    Joined:
    Mar 17, 2015
    Posts:
    1
    Hi Guys :)

    Hope you're weel !
    I'm working with your tutorial assets & work on modifying the scene to change environment. In fact I would like trying to play in a bigger map/floor... I try different things but can't find any solution to fix this issue : zombear are blocked in a certain area of the floor, even if I change the scale of it or change the floor with an other plan. Could you help me with this please ? I really don't know what I need to change to do it :/
    Sorry for my bad english, if you need any information that can help, just ask :)

    Have a nice day.
     
  32. rvb676

    rvb676

    Joined:
    Nov 5, 2015
    Posts:
    1
    Hi guys, im new here (using unity) and start to follow the tutorial to "complete" survival shooter game, after it done, i want to make it "running" in my android device, so i try to insert a joystick in it, the left joystick is to move and the right is to pointing and shooting as mouse do, i want the right joystick to move as clicked mouse do, so it will shooting where i want to, but i got a problem, the left joystick work fine,it moving my player however, the right one just "acting" like left click only, it just make my player shoot, not turning like what i want, can somebody help me ? (i've already set the joystick axis as Mouse X and Mouse Y) (sorry for my bad english, im indonesian)
     

    Attached Files:

  33. maltaannon

    maltaannon

    Joined:
    Nov 10, 2015
    Posts:
    1
    ZombearMaterial and ZombunnyMaterial

    Hi. I've just completed the tutorial and everything looks and works as expected, with one exception. I've noticed that Zombear Character is casting a soft pink light, and other enemies do not. I think this is due to the Emission texture in the ZombearMaterial, nowever all of the enemies have that set properly, but only Zombear is casting the light. On top of that the Docs clearly state, that only static objects can cast such a light. What do you make of this? Is it a bug? Should it not cast the light? And if it should, why the docs state otherwise and why the other enemies do not cast this light?
    upload_2015-11-10_7-55-5.png
     
  34. 20the2

    20the2

    Joined:
    Nov 11, 2015
    Posts:
    2
    Every time I save my scene and try to open the scene in another window, it says that my assets folder (the folder that holds scenes, among other things) is empty. I've tried closing the tab and retrying, making new files in old projects, and making new projects. Nothing is working, and until this is fixed, this tutorial is unplayable.

    I'm using Unity 5.2.2, on a PC running Windows.

    Edit: Was a problem with my computer; resolved by switching computers.
     
    Last edited: Nov 15, 2015
  35. PCSplinter

    PCSplinter

    Joined:
    Nov 10, 2015
    Posts:
    2
    Hey guys,
    I like this training and everything is going really fine, but one thing. I put all the EnemyManager Scripts in the EnemyManager Gameobject. Every script is linked to the PlayerHealth Script. As for the Zombunny and the Zombear this does work, but not for the Hellephant. The compiler is giving me NullReferenceException about not having the Player GameObject.

    EDIT: After compiling and testing the project, i noticed some strange differences between the Play View in Unity and the actual application. First i have the problem with the Hellephant only inside the Play View, but not in the compiled game. Second while playing the compiled game everything works fine, but the ending screen is black now, instead of cyan or light blue.
     

    Attached Files:

    Last edited: Nov 19, 2015
  36. 20the2

    20the2

    Joined:
    Nov 11, 2015
    Posts:
    2
    I'm getting three errors (all CS0120 "An object reference is required for the non-static field, method, or property", 1 on line 13, 2 on line 20) from my CameraFollow script. Even when I use the completed version that comes with the assets, I still get the same errors. Also, the public float and target don't show up in the script component with my script, but do with the premade script (even though they're virtually identical).

    My script:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class CameraFollow : MonoBehaviour
    5. {
    6.     public Transform Target;
    7.     public float Smoothing = 5f;
    8.  
    9.     Vector3 Offset;
    10.  
    11.     void Start ()
    12.     {
    13.         Offset  = Transform.position - Target.position;
    14.  
    15.     }
    16.  
    17.     void FixedUpdate ()
    18.     {
    19.         Vector3 TargetCameraPosition = Target.position + Offset;
    20.         Transform.position = Vector3.Lerp (Transform.position, TargetCameraPosition, Smoothing * Time.deltaTime);
    21.  
    22.     }
    23.  
    24. }
    25.  
     
  37. stanley_angelino

    stanley_angelino

    Joined:
    Nov 14, 2015
    Posts:
    11
    I wonder where I can get the Survival Shooter assets....
     
  38. Gibari

    Gibari

    Joined:
    Aug 31, 2015
    Posts:
    1
    I want the bodies to stay on the map and still be able to pass through them. I tryed changing the enemy health script but everything I try dosen't work. I did get the enemy to not sink by just changing "isSinking = true;" to false but when I remove the "Destroy (gameObject, 2f);" nothing changes it still just blinks out of existence. can anyone help me with this. please and thank you.
     
  39. sangam1

    sangam1

    Joined:
    Nov 19, 2015
    Posts:
    1
  40. PCSplinter

    PCSplinter

    Joined:
    Nov 10, 2015
    Posts:
    2
    it is mentioned on the tutorial page: -> https://www.assetstore.unity3d.com/en/#!/content/40756

    also don't forget this advice:
     
  41. TheFunGuy

    TheFunGuy

    Joined:
    Nov 19, 2015
    Posts:
    2
    Edit - Friday 20th November 2015 - I finally fixed the issue. For anyone else that may be having this problem, go back a video until you find what the issue could be. For me it was the height in the Capsule Collider. I had .5 when it should have been 1.5.

    A guide to fix my issue
    1) Needed to go to Zombunny
    2) Expand Capsule Collider
    3) Change Height from 5 to 1.5
    4) Test the game and it worked

    Original post
    I'm new to Unity and I'm having a problem with part 5 Health HUD or part 6 Player Health. So far I have the game working fine in the previous stages but now I'm trying to get the enemy to hurt the player. Sadly it just bumps into me but doesn't hurt the health bar. I have went over and over the videos many times and just can't get it to work. This is from using a Macbook. I have also done the same tutorial using a Windows PC and it works fine for that. Is there anyone that can help me?

    This is the same issue I am having. https://www.reddit.com/r/Unity3D/comments/2vh2qe/doing_the_survival_shooter_tutorial_everything/

    In the comment section it mentions "Did you set up the trigger on the enemy? Use Debug.Log to help figure out what's firing and what isn't.". Can someone tell me what that means to set up the trigger on the enemy? Is that connecting the EnemyAttack Script to the bunny? I have done that and it doesn't work.
     
    Last edited: Nov 20, 2015
    lelezhao113 likes this.
  42. Nullbuilt

    Nullbuilt

    Joined:
    Nov 20, 2015
    Posts:
    1
    I'm attempting to begin this project, however when I click "Open in Unity" to download the assets it doesn't seem to do anything. I have a project open and the asset store tab opens and seems to just get stuck on loading. I've even clicked survival shooter within the tab in unity but this doesn't seem to open anything either. The short of it is that it appears to be stuck on the loading screen in the Asset Store but I can't figure out why, my internet connection should be fine. Is there a way to just download the project without doing it through unity?
     
  43. TheFunGuy

    TheFunGuy

    Joined:
    Nov 19, 2015
    Posts:
    2
    I had that issue a few times myself and no idea why. Once I managed to download it, anything after it was fine. Try pausing it and resume. If that doesn't work, start again until it does download (pretty much just clicking on the box over and over until it works Give it some time to see if it starts too). Surprisedly that worked for me so hope it helps you too.
     
  44. ZeeroCool

    ZeeroCool

    Joined:
    Nov 17, 2015
    Posts:
    1
    Hello Guys!

    I just finished the tutorial and the game running as it should be except one thing.
    I got same message every time after I die in the game.

    GI error.jpg



    Anyone have any idea why?


    Another question is:

    If I wish to change the shooting point from the mouse to controller axis how I can do it?

    void Turning()
    {
    // Create a ray from the mouse cursor on screen in the direction of the camera.
    Ray camRay = Camera.main.ScreenPointToRay(Input.mousePosition);

    // Create a RaycastHit variable to store information about what was hit by the ray.
    RaycastHit floorHit;

    // Perform the raycast and if it hits something on the floor layer...
    if (Physics.Raycast(camRay, out floorHit, camRayLength, floorMask))
    {
    // Create a vector from the player to the point on the floor the raycast from the mouse hit.
    Vector3 playerToMouse = floorHit.point - transform.position;

    // Ensure the vector is entirely along the floor plane.
    playerToMouse.y = 0f;

    // Create a quaternion (rotation) based on looking down the vector from the player to the mouse.
    Quaternion newRotation = Quaternion.LookRotation(playerToMouse);

    // Set the player's rotation to this new rotation.
    playerRigidbody.MoveRotation(newRotation);
    }

    This code contains the turning and the mouse Position but how I can change to turn with the 4th Axis on XBox One controller?

    Thanks,


    T.
     
    Last edited: Nov 20, 2015
  45. stanley_angelino

    stanley_angelino

    Joined:
    Nov 14, 2015
    Posts:
    11
    I'm having a problem. I've just finished saving the script "PlayerMovement" and seems that an error is showing "Unexpected symbol "Vector3" in class, struct, or interface member declaration" in the beginning after the code "public float speed = 6f" in "Vector3 movement;"

    Here's the script:

    Code (CSharp):
    using UnityEngine;

    public class PlayerMovement : MonoBehaviour
    {
    public float speed = 6f

    Vector3 movement;
    Animator anim;
    Rigidbody playerRigidbody;
    int floorMask;
    float camRayLength = 100f;

    void Awake ()
    {
    floorMask = LayerMask.GetMask ("Floor");
    anim = GetComponent <Animator> ();
    playerRigidbody = GetComponent <Rigidbody> ();
    }

    void FixedUpdate ()
    {
    float h = Input.GetAxisRaw ("Horizontal");
    float v = Input.GetAxisRaw ("Vertical");
    }

    void Move (float h, float v)
    {
    movement.Set (h, 0f, v);

    movement = movement.normalized * speed * Time.deltaTime;

    playerRigidbody.MovePosition (transform.position + movement);
    }

    void Turning ()
    {
    Ray camRay = Camera.main.ScreenPointToRay (Input.mousePosition);

    RaycastHit floorHit;

    if (Physics.Raycast (camRay, out floorHit, camRayLength, floorMask))
    {
    Vector3 playerToMouse = floorHit.point - transform.position;
    playerToMouse.y = 0f;

    Quaternion newRotation = Quaternion.LookRotation (playerToMouse);
    playerRigidbody.MoveRotation (newRotation);
    }
    }

    void Animating (float h, float v)
    {
    bool walking = h != 0f || v != 0f;
    anim.SetBool ("IsWalking", walking);
    }
    }
     
  46. BeeMozaik

    BeeMozaik

    Joined:
    Nov 22, 2015
    Posts:
    2
    i wanna build the level 2, what i need to do first?
    and i wanna add quest into this game, it's ok?

    sorry my english bad, actually i'm indonesian.
    Regads
     
  47. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    If I toggle "Pixel Perfect" on the Canvas component of the MenuCanvas game object the entire pause menu breaks. No images are displayed. It works fine (and looks better imo) if I preview it in the editor, but when I run the game it's broken. This happens in two separate projects, the one from the asset store and in my own custom project where I've imported the menu.

    It only happens if the Canvas component is disabled initially as it is in this project. So leaving the Canvas enabled and disabling it in the Start() method works as a workaround.

    Anyone have a clue why this happens? Seems like a very odd bug.
     
  48. BeeMozaik

    BeeMozaik

    Joined:
    Nov 22, 2015
    Posts:
    2
    one more thing, if i build this game have some green color. 01.png
     
  49. HenryCPeacemode

    HenryCPeacemode

    Joined:
    Jul 20, 2015
    Posts:
    3
    Hey guys! I just started my Survival Shooter today and I just finished coding and watching the second video. I had all the same code, and no errors, but my player isn't moving, but the idle animation is playing. This is my code:
    usingUnityEngine;

    publicclassPlayerMovement : MonoBehaviour
    {
    publicfloatspeed = 6f;

    Vector3movement;
    Animatoranim;
    RigidbodyplayerRigidbody;
    intfloorMask;
    floatcamRayLength = 100f;

    voidAwake ()
    {
    floorMask = LayerMask.GetMask ("Floor");
    anim = GetComponent<Animator> ();
    playerRigidbody = GetComponent<Rigidbody> ();
    }
    voidFixedUpdate()
    {
    floath = Input.GetAxisRaw ("Horizontal");
    floatv = Input.GetAxisRaw ("Vertical");
    }

    voidMove (floath, floatv)
    {
    movement.Set (h, 0f, v);

    movement = movement.normalized * speed * Time.deltaTime;

    playerRigidbody.MovePosition (transform.position + movement);


    Move (h, v);
    Turning ();
    Animating (h, v);

    }


    voidTurning()
    {
    RaycamRay = Camera.main.ScreenPointToRay (Input.mousePosition);
    RaycastHitfloorHit;

    if (Physics.Raycast (camRay, outfloorHit, camRayLength))
    {
    Vector3playerToMouse = floorHit.point - transform.position;
    playerToMouse.y = 0f;

    QuaternionnewRotation = Quaternion.LookRotation (playerToMouse);
    playerRigidbody.MoveRotation (newRotation);
    }
    }

    voidAnimating (floath, floatv)
    {
    boolwalking = h != 0f || v != 0f;
    anim.SetBool ("IsWalking", walking);
    }

    }
    this is my unity scene:
    upload_2015-11-23_19-59-37.png upload_2015-11-23_19-59-37.png

    PS:My sound isn't working
     
  50. D3struct10n2806

    D3struct10n2806

    Joined:
    Nov 20, 2015
    Posts:
    3

    There should be a space between your void and "Turning", "Animating", etc.
    E.g:

    void Animating (floath, floatv)
    {
    boolwalking = h != 0f || v != 0f;
    anim.SetBool ("IsWalking", walking);
    }