Survival Shooter Q&A

This thread is now closed and archived as this project has been updated for 5.1

New thread here: Survival Shooter Q&A - Learn Content & Certification - Unity Discussions

This is the official thread for discussion, issues and Q&A for the Survival Shooter project

Please use this thread if you have any questions, issues or feedback on this project.

Survival Shooter is a learning project on our Learn Site:
http://unity3d.com/learn/tutorials/projects/survival-shooter

Learn how to make an isometric survival shooter game with this project from Unite training day 2014.

Known Issues:

    • Please turn “annotations” on, as we try to annotate these videos if any issues are found. Many people turn annotations off, and miss these comments.
  • Unity 5: NavMesh needs to be baked with a different step height.

  • A step height of 0.35 should be used.

  • For the various animation controllers, when setting up the transitions, you need to uncheck the box for “Has Exit Time” in each transition. If you do not, you run into problems like the remainder of the Idle animation playing before the Move animation starts. [@Socrates]

1 Like

Additional issue that a number of people have run into: For the various animation controllers, when setting up the transitions, you need to uncheck the box for “Has Exit Time” in each transition. If you do not, you run into problems like the remainder of the Idle animation playing before the Move animation starts.

2039958--132312--upload_2015-3-26_10-49-21.png

8 Likes

I’m on Step 2 of the Sharp Shooter tutorial and noticed the Environment prefab is not being loaded correctly. This is a fresh download of the Survival Shooter, and I placed it into a new project (I previously did this same project in unity 4, but now getting errors so I decided to start over…it’s a long story).

Also, MonoDevelop’s autocomplete is not working properly as well. Vector1, Vector2, or Vector3 is not loading properly. Nor are any of the transform methods.

I had to change the shader on the floor from an Legacy shader to a current one. This really helped make it look better. I was also getting some visual artifacts in the build with the Legacy shader.

If you’re getting errors on the environment, what are they?

The black artifacts are most likely bad lightmap data. In Unity 5, Enlighten will try and automatically bake anything marked static, like our environment here. Currently these meshes don’t all have valid Lightmap UVs for Enlighten to bake to as the project wasn’t initially intended for baking, so you get these weird black areas of overlaps and repeats.

If you go to the project’s models folder, select each environment and prop mesh and tick Generate Lightmap UV’s in the asset’s Inpsector Model tab, wait for Unity to create some valid UV’s, then let Enlighten rebake, then you shouldn’t see these weird errors anymore (hopefully!)

1 Like

could you explain to me the problem and how to solve it in pm? thanks a head!

:)Another problem?
First image from video tutorial on Unity 4.6 secound on my Unity 5 project
i don’t have inaccuracy % so what to do insted changing it?

2 Likes

No.

These threads need to be kept public so other people can search and learn from the discussion.

I feel @peteorstrike did a good job of describing the issue in his post. What part is confusing?

1 Like

Hi i’m getting 3 errors (i’m at the second video tutorial),it’s about “Player Movement” scrip,any ideias what is wrong?

1- Assets/Scripts/Player/PlayerMovement.cs(44,17): error CS1525: Unexpected symbol `{’

2- Assets/Scripts/Player/PlayerMovement.cs(52,22): error CS0116: A namespace can only contain types and namespace declarations

3- Assets/Scripts/Player/PlayerMovement.cs(57,1): error CS8025: Parsing error

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");

        Move (h, v);
        Turning ();
        Animating (h, v);
    }
    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, camRayLenght, floorMask)
        {
            Vector3 playerToMouse = flootHit.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);
        }
}
1 Like

When reading errors, the details can be broken down into:

  • The path to the item causing the error:

  • Assets/Scripts/Player/PlayerMovement.cs

  • The line number in the script (if we are pointing to a script), in this case, line 44:

  • (44,17)

  • The error number:

  • error CS1525

  • The error description:

  • Unexpected symbol `{’

So, if you go to your script and look at line 44, you’ll see a “{” that the compiler feels is out of place.

The trick here is trying to find out why this apparently valid closed brace is out of place.

If the compiler hits a brace that it’s not expecting, and you feel it’s correct, then back up a few steps! The compiler has tripped up and fallen down on that brace. What it’s expecting is the second close parentheses that is missing from line 43!

if(Physics.Raycast(camRay, out floorHit, camRayLenght, floorMask)

… should be:

if(Physics.Raycast(camRay, out floorHit, camRayLenght, floorMask))

Note the two opening parentheses: After the “if” and after the “Raycast”. These both need to be closed.

There is a phenomenon that I like to call a “cascade of errors”. Once one error has been detected and one piece is out of place, the compiler will get confused and it can find other issues that may or may not be legitimate after the first error.

At quick glance this error looks like the compiler was confused by the previous error:

The final error is simply saying “I’ve reached the end and things are not correct. I didn’t read everything correctly, and the script is now done. Help!”:

1 Like

Thanks…it’s solved:)

Survival Shooter Tutorial - 4 of 10 - Adding Enemy one - Unity Official Tutorials (new)
Hi, at 12:24 minute i’ve a GUI different from the one used in tutorial, how do i apply same values in my unity 5 version, check the images attached
tut_img is a printscreen from the video tutorial.
my_img is a printscreen from my unity 5 window

for example i dont have the field “With Inaccuracy”…


2048774--133176--my_img.png

1 Like

I found the solution for this:

"I am also new and currently working on this but I started it out on unity 5. Based on the change log in unity 5. “NavMesh bake settings: Removed width/height inaccuracy and allow to set voxel size instead.”

With that I tried enabling Manual Voxel Size and set Voxel size to 0.25 which is the default then it baked properly and runs with no error. Zombunny is following the player."

Hello!
It seems that I’ve done everything as explained in the second video,
except in the state machine “entry”, and “exit” thing.(cause they didn’t have it in 4.6) but I think I got it to work,
because when I hit play I can see the progress bars in the state machine go on and on,
the transitions work as well!
but in the game view - the animations aren’t playing. its just a little sleepy survivor… stuck there…
(just to point out - the character moves and rotates perfectly… again - its just the animations).

i’m overcame by technology once more.
Any suggestions?

Things that I would think to check:

  • Make sure the correct Motion is attached to each state.
  • See if I accidentally muted any states.
  • Is the AnimatorController attached to my character?
  • Am I watching the AnimatorController attached to my character?
  • Does the character have the correct avatar listed in the Animator? (PlayerAvatar).
1 Like

Hi, some times when i’m in play mode to test it, the background in the game tab is black, why is this happening?

1 Like

i’m sorry for asking too many questions but… something weird happend after i finished chapter 6 and everything worked fine the backgroung and the scene setting… disappeared… sort of…

yes to everything, BUT!
I decided to redo this tutorial, this time I remembered something that I did, I saved the first code before the instructor said to do so, and when the thing asked me if I wanna convert the line endings or keep them, I chose to keep them (not smart of me.)

THIS TIME I pressed “Convert”, Now everything works. (after I unchecked “Has exit time” in the transitions in the state machine.)

I hope this information can be of use to anyone.

1 Like

If you are using MonoDevelop, there is a setting to make them convert automatically. It not only avoids this issue, it avoids all those annoying pop-ups asking if you want to convert. :slight_smile:

Tools → Options
Scroll down to Text Editor → General
Set “Line ending conversion” to “Always convert line endings”.

If you are using Visual Studio, I’d expect it to have a similar setting, though I don’t use the software and so do not know where it is.

1 Like

Cool! thank you dude :slight_smile: