Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Official John Lemon’s Haunted Jaunt: 3d Beginner Official Thread

Discussion in 'Community Learning & Teaching' started by Woolley_Kat, Apr 15, 2019.

  1. LozzaL

    LozzaL

    Joined:
    Jun 14, 2019
    Posts:
    2
    You need to show us your "GameEnding" and "Observer" scripts. I'm guessing that you forgot a declaration in the Observer script:

    public GameEnding gameEnding;
     
    that-steve-guy likes this.
  2. JakobeSVT

    JakobeSVT

    Joined:
    Apr 15, 2017
    Posts:
    1
    If you are having trouble with the gargoyle's not detecting John when he runs into the colliders, check the last if statement in your observer script. It should look like this:

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class Observer : MonoBehaviour
    {
    public Transform player;
    public GameEnding gameEnding;

    bool m_IsPlayerInRange;

    void OnTriggerEnter(Collider other)
    {
    if (other.transform == player)
    {
    m_IsPlayerInRange = true;
    }
    }

    void OnTriggerExit(Collider other)
    {
    if (other.transform == player)
    {
    m_IsPlayerInRange = false;
    }
    }

    void Update()
    {
    if (m_IsPlayerInRange)
    {
    Vector3 direction = player.position - transform.position + Vector3.up;
    Ray ray = new Ray(transform.position, direction);
    RaycastHit raycastHit;
    if (Physics.Raycast(ray, out raycastHit))
    {
    if (raycastHit.collider.transform == player)
    {
    gameEnding.CaughtPlayer();
    }
    }
    }
    }
    }


    I was missing the "gameEnding.CaughtPlayer();" started working after i added this.

    Thanks for your help everyone!
     
  3. Lokra

    Lokra

    Joined:
    Jun 27, 2019
    Posts:
    1
    I finished Part 2 of the tutorial but my Character won't rotate. He just moves back and forth but won't turn. I used the same script in the tutorial so I don't know what went wrong
     
  4. NML2000

    NML2000

    Joined:
    Mar 12, 2019
    Posts:
    1

    I get exactly the same issue. Tried creating more space, uninstalling and reinstalling, using 2018.4, none of it works. Have you, or anyone else, figured it out yet?
     
  5. Uhfgood

    Uhfgood

    Joined:
    Feb 22, 2013
    Posts:
    2
    I'm having another weird problem. John Lemon looks like he's skateboarding. The Left Leg remains motionless on the floor when the right one walks like normal, and looks like he's pushing a skate board around.
     
  6. trainoasis

    trainoasis

    Joined:
    Jul 3, 2019
    Posts:
    2
    Very late to the party, but was still wondering. How to make cinematic virtual camera rotate based on player's rotation?
     
  7. karamdaabul

    karamdaabul

    Joined:
    Jul 5, 2019
    Posts:
    1
    I'm missing a file "JohnLemon Animator Controller. " can't find it, it's supposed to be in Assets > Animation > Animators
    but it's simply not there

     
  8. that-steve-guy

    that-steve-guy

    Joined:
    Apr 21, 2013
    Posts:
    15
    an
    ... that did the trick (thank you) and doh (on my part)
     
  9. cribbit

    cribbit

    Joined:
    Mar 17, 2016
    Posts:
    6
    The tutorial doesn't make it clear what step to skip to if you install the project from the 'learn' tab.

    The tutorial indicates the asset store is under window -> general, but it's actually just under window.
     
  10. cribbit

    cribbit

    Joined:
    Mar 17, 2016
    Posts:
    6
    Under 'Tutorial Player Character: Part 2' it isn't clear why `m_Movement` doesn't need to be instantiated while `m_Animator`, `m_Rigidbody` and `m_Rotation` do.

    Step 7 of this section has a typo in "Identify Whether There is Player Input" where it says, "If there is any player input then your character should be walking, and if there is not then it be idle."
     
  11. cribbit

    cribbit

    Joined:
    Mar 17, 2016
    Posts:
    6
    Many parts of the tutorial don't make it clear when a method is called externally vs when a method is being written for us to call.
     
  12. rudra1217

    rudra1217

    Joined:
    Jul 8, 2019
    Posts:
    3
    In the enemies part 1 step, when i have made the observer script and i have many times that the script is same but the console give three errors:

    Assets\Scripts\observer.cs(6,14): error CS0101: The namespace '<global namespace>' already contains a definition for 'GameEnding'

    Assets\Scripts\observer.cs(19,18): error CS0111: Type 'GameEnding' already defines a member called 'OnTriggerEnter' with the same parameter types

    Assets\Scripts\observer.cs(32,10): error CS0111: Type 'GameEnding' already defines a member called 'Update' with the same parameter types
     
    PKgamedesign likes this.
  13. neovonretorch

    neovonretorch

    Joined:
    Jul 5, 2019
    Posts:
    9
    Exact same issue. Did you find a resolution? Not sure if I can move on without the nav mesh created. Seems like it would be important to have this step succeed!

    EDIT: Seems like you just need to click "Gizmos" to toggle showing them. (For me it defaults to Not Shown.)
     
    Last edited: Jul 9, 2019
    PKgamedesign likes this.
  14. neovonretorch

    neovonretorch

    Joined:
    Jul 5, 2019
    Posts:
    9
    I'm in Environment > Post-Processing and I have the same issue found at https://answers.unity.com/questions/1630533/post-process-effects-are-not-affecting-the-game.html

    I created a new top-level Game Object renamed to "GlobalPost", which I've placed in the "PostProcessingVolumes" layer. I added a Post Process Volume (Script) and added the settings for Color Grading, Bloom and Ambient Occlusion.

    In Main Camera, which is still in the Default layer, I added the component Post Process Layer (Script) which has the PostProcessingVolumes layer selected. When I enabled Anti-aliasing, I could see the change in the Game screen. However, none of the lighting changes are appearing in the Game screen, in the preview or when I press Play.

    EDIT: Although the tutorial omits this, it is visible in the screen shot.

    YOU MUST CHANGE "Weight" from 0 to 1.
     
    Last edited: Jul 9, 2019
  15. rudra1217

    rudra1217

    Joined:
    Jul 8, 2019
    Posts:
    3
    it
    it is happening with me also
     
  16. Valjuin

    Valjuin

    Joined:
    May 22, 2019
    Posts:
    481
    In Part 12 of tutorial:
     
  17. neovonretorch

    neovonretorch

    Joined:
    Jul 5, 2019
    Posts:
    9

    It sounds like you may have copied too much from GameEnding.cs over to Observer.cs. At the top of GameEnding.cs I would expect to see
    Code (CSharp):
    1. public class GameEnding : MonoBehaviour
    . However, at the top of your observer.cs, I would expect to see
    Code (CSharp):
    1. public class Observer : MonoBehaviour
    Otherwise you might be extending your GameEnding class into a second file, and that's why you'd get the "already defines a member" errors.
     
  18. neovonretorch

    neovonretorch

    Joined:
    Jul 5, 2019
    Posts:
    9
    `m_Movement` is of type Vector3, which is a struct with static methods. That means those methods are available even if you do not have an instance of the type. You set values within the struct, and then use those values in other methods, but there is no direct connection between this variable and anything happening in the game.

    `m_Animator` and `m_RigidBody` are both references to instances of their respective class types. A class object does need an instance, and these are specific references to these objects within your main character.

    `m_Rotation` is another struct, and in my code from the tutorial, I set it to result of the Quaternion.LookRotation() method. So we are just setting values within it, rather than specifically instantiating it. The values in this struct are used by the RigidBody object, and again do not directly influence the game state.
     
    MiguelOscarGarcia likes this.
  19. neovonretorch

    neovonretorch

    Joined:
    Jul 5, 2019
    Posts:
    9
    Most methods have a return type of void and no declaration of member access, which means they default to private and can only be called from within that class. However, in a few examples, you want this specific method to be called externally, and you prefix it with public to expose that method. One of the only examples of that here is
    Code (CSharp):
    1.     public void CaughtPlayer()
    2.     {
    3.         m_IsPlayerCaught = true;
    4.     }
    This lets you maintain a private variable on the GameEnding class, but still let some other object trigger that event.
     
  20. cribbit

    cribbit

    Joined:
    Mar 17, 2016
    Posts:
    6
    In "Enemies part 1" it says,

    I think that means to say "other classes may set that JohnLemon has been caught".
     
  21. cribbit

    cribbit

    Joined:
    Mar 17, 2016
    Posts:
    6
    Issue I self debugged that others may hit:

    If the player is physically unable to enter the Gargoyle "flashlight" box to trigger the game end / the capsule collider won't let the player enter, make sure you set "Is Trigger" on the "PointOfView" collider and not the "Gargoyle" collider.

    One thing the tutorial points out pretty well at the start and throughout but is important to harp on - make sure you're saving changes on the prefab and not the instance being used! If you see a blue highlight on the left side of the component in the instance that means it's not saved to the prefab. This will cause all sorts of annoying bugs as the prefab gets used.
     
    vviking likes this.
  22. cribbit

    cribbit

    Joined:
    Mar 17, 2016
    Posts:
    6
    That's definitely a very good thing to point out, but that's not what I'm talking about here.

    "OnTriggerEnter" is an example of what I'm talking about. This is a method called by Unity because the script is on a collider with "Is Trigger" enabled. However, the tutorial treats this somewhat like magic in most cases. Re-reading the tutorial it actually does it better than I thought at first glance but it still feels like a lot of the programming here is just "copy this, copy that".
     
  23. YetAnotherKen

    YetAnotherKen

    Joined:
    Jun 17, 2019
    Posts:
    30
    This is a great tutorial for a beginner. Thank you for sharing this for free. I have learned from this.
     
    JacekMackiewicz likes this.
  24. tasnimrushi10

    tasnimrushi10

    Joined:
    Jun 23, 2019
    Posts:
    8
    I've completed this tutorial successfully. Now I want to build the game for Android platform. Can anyone help me to write the scripts for the movement on touchscreen associated to this game.Thanks in Advance
     
  25. gman435

    gman435

    Joined:
    Jul 16, 2019
    Posts:
    3

    Unity 2019.1.0f2

    Same problem here, no cinemachine on toolbar. Have already had to delete everything and re-install, then restart multiple times (newer editor version, json file problem, etc.). If I delete everything and start over there had better be a cinemachine listing on toolbar (part 1 of this tutorial does not show it on screenshot), or I have to think about learning an engine that is tested, works, and is maintained.

    What's up Unity people ?
     
  26. gman435

    gman435

    Joined:
    Jul 16, 2019
    Posts:
    3
    Deleted everything, created new project, installed tutorial resources, and SHAZAM !!! there is now a "cinemachine" on top toolbar. That really sucks. I bet Unity employees laugh when they type the "make sure to save" lines because they know you will have to delete anyway and start over. How does a server not ship complete packages ? Is this the game ? A game about making a game ?
     
  27. gman435

    gman435

    Joined:
    Jul 16, 2019
    Posts:
    3
    For future reference because starting over is getting old. Does anyone know if you can just go to asset store and re-import resources on top of existing to get missing packages ? Day 3, and I'm back to the beginning.
     
  28. GondorsCondor

    GondorsCondor

    Joined:
    Jul 22, 2019
    Posts:
    1
    Hi, I need help with just animating John. Whenever I run the program, I get the following error repeating and my John Lemon not moving whatsoever:

    ArgumentException: Input Axis Veritcal is not setup.
    To change the input settings use: Edit -> Settings -> Input
    PlayerMovement.FixedUpdate () (at Assets/Scripts/PlayerMovement.cs:25)

    I went into Unity's input settings to look at horizontal and vertical settings and confirmed that both were set for w.a.s.d. and arrow key controls, but John's still staying put and the above error message keeps showing. I've reread and redone every step the guide gives, but nothing's working. Can someone please help me?
     
  29. Valjuin

    Valjuin

    Joined:
    May 22, 2019
    Posts:
    481
    This looks like it is caused by a spelling mistake in your script:
    ArgumentException: Input Axis Veritcal is not setup.
    Change that to Vertical and you should be good to go.
     
  30. paulspray

    paulspray

    Joined:
    Jul 28, 2019
    Posts:
    3
    Testing JL's walking... after the end of part 2 - should he walk (for the gameplay intended) as if he is in a box.... My assumption is I have made some errors, but just curious if that is the intended control style

    Not sure of the term, but my walking control works like this:

    Up arrow - he makes a step in the same direction he was headed.
    Right - he turns right.
    Right again - no result.
    Down - he turns right.
    Left - he turns right.
    Up - right again.
    He sort of walks like in a box, or original Snake would crawl... if the analogy is right.

    So I am thinking I should be re-checking the instructions as this is not the intended control dynamic?

    Thanks.
     
    Last edited: Jul 30, 2019
  31. Yovannita

    Yovannita

    Joined:
    Jul 31, 2019
    Posts:
    1
    I can't make John Lemon to walk! I followed all the steps in Part 1 and Part 2, but it still doesn't move! The code must be correct because I copied and pasted it, and I did Part 1 like 3 times already! I'm using version 2019.1.10f1. Help! I'd love to finish this tutorial! Thanks
     
  32. paulspray

    paulspray

    Joined:
    Jul 28, 2019
    Posts:
    3
    What does console say when you press play? I found I had a very basic error from accidentally skipping over the part where you save the character as a prefab and apply the animation and animator config.
     
  33. TyNel

    TyNel

    Joined:
    Jul 25, 2019
    Posts:
    1
    Hello,

    I went through 5 parts of this tutorial, saving along the way. Now I am back and feeling ready to start step 6. Except there is not history that I have done anything. It seems despite saving all the time nothing has saved. I am new to Unity so maybe I am not doing something correctly. In the Hub there wasn't even a project for this tutorial despite me doing 5 steps of it at different times. If I was pressing crtl - s all the time, what happened? Where is my saved file or data? I spent hours trying to go through all of this and now it is all gone?

    Can anyone help me out?
     
  34. jzylinski

    jzylinski

    Joined:
    Jul 29, 2019
    Posts:
    4
    I'm having the same problem.
     
  35. jzylinski

    jzylinski

    Joined:
    Jul 29, 2019
    Posts:
    4
    I figured it out- if you did the same thing that I did, I dragged and dropped the `PlayerMovement` script onto the 'JohnLemon' sub-object in the hierarchy (There's a main JohnLemon, and one level down there's a JohnLemon at the same level as the Root object.) You need to drag the script onto the TOP JohnLemon object (the one with the Rigidbody and Capsule Collider components in it). I hope that helps...
     
  36. jzylinski

    jzylinski

    Joined:
    Jul 29, 2019
    Posts:
    4
    Now that I think of it, it makes sense. Remember, we wrote code that interacts with the Animator and Rigidbody components? Well those components are part of the top-level JohnLemon, not the sub-JohnLemon.
     
  37. dylanwooley

    dylanwooley

    Joined:
    Jun 12, 2019
    Posts:
    1
    Hello,
    I can't seem to get my gargoyle or ghost to spot me, they both have the pointofview game object, and iv'e followed the tutorial closely. The animations and everything work on them, they just don't detect me. When I head the to finish however, the gameending object detects me and shows the you win picture.
     
  38. jeromewagener

    jeromewagener

    Joined:
    Aug 3, 2019
    Posts:
    1
    At the end of "Part 2: Dynamic Observers" my ghosts only ever moved to the first way-point and then got stuck.
    As a result I needed to change the way-point change condition inside WaypointPatrol from:
    navMeshAgent.remainingDistance < navMeshAgent.stoppingDistance

    to
    navMeshAgent.remainingDistance <= navMeshAgent.stoppingDistance


    This was suggested by SimsalamimaHuHu in this thread but I first spent quite some time trying to debug the problem...

    Nonetheless, incredible tutorial so far!
     
  39. kylefisher200

    kylefisher200

    Joined:
    Aug 5, 2019
    Posts:
    2
    Hello,

    So I started this tutorial a few days ago and spent most of yesterday working on the coding section for making JohnLemon walk and turn. After a few compiling error messages and several hours spent looking it over for spelling mistakes or other things that I messed up on, all seemed to be well, and I was able to hit "play" and test it without an error message coming up. However, upon attempting to utilize the arrow keys to move, it turns out that all he can do is move forward. There is no turning whatsoever, which is somewhat frustrating. I'm posting my code here hoping someone could give it a look-through and tell me if I missed anything that I messed up. Thank you very much!

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class PlayerMovement : MonoBehaviour
    {
    public float turnSpeed = 20f;

    Animator m_Animator;
    Rigidbody m_Rigidbody;
    Vector3 m_Movement;
    Quaternion m_Rotation = Quaternion.identity;

    // Start is called before the first frame update
    void Start ()
    {
    m_Animator = GetComponent<Animator> ();
    m_Rigidbody = GetComponent<Rigidbody> ();
    }

    // Update is called once per frame
    void FixedUpdate ()
    {
    float horizontal = Input.GetAxis ("Horizontal");
    float vertical = Input.GetAxis ("Vertical");

    m_Movement.Set(horizontal, 0f, vertical);
    m_Movement.Normalize ();

    bool hasHorizontalInput = !Mathf.Approximately (horizontal, 0f);
    bool hasVerticalInput = !Mathf.Approximately (vertical, 0f);
    bool isWalking = hasHorizontalInput || hasVerticalInput;
    m_Animator.SetBool ("IsWalking", isWalking);

    Vector3 desiredForward = Vector3.RotateTowards (transform.forward, m_Movement, turnSpeed * Time.deltaTime, 0f);
    m_Rotation = Quaternion.LookRotation (desiredForward);

    void OnAnimatorMove ()
    {
    m_Rigidbody.MovePosition (m_Rigidbody.position + m_Movement * m_Animator.deltaPosition.magnitude);
    m_Rigidbody.MoveRotation (m_Rotation);
    }
    }
    }
     
  40. Valjuin

    Valjuin

    Joined:
    May 22, 2019
    Posts:
    481
    You have put a curly brace in the wrong place.

    Code (csharp):
    1. Vector3 desiredForward = Vector3.RotateTowards (transform.forward, m_Movement, turnSpeed * Time.deltaTime, 0f);
    2. m_Rotation = Quaternion.LookRotation (desiredForward);
    3. }   //Need curly brace here to close void Fixed Update function
    4.  
    5. void OnAnimatorMove ()
    6. {
    7. m_Rigidbody.MovePosition (m_Rigidbody.position + m_Movement * m_Animator.deltaPosition.magnitude);
    8. m_Rigidbody.MoveRotation (m_Rotation);
    9. }
    10. }   //Don’t need this curly brace
    11. }
     
    kylefisher200 likes this.
  41. kylefisher200

    kylefisher200

    Joined:
    Aug 5, 2019
    Posts:
    2
    Thank you very much for your help!
     
  42. Bugs95

    Bugs95

    Joined:
    Nov 28, 2017
    Posts:
    1
    Had exactly the same problem...
    My solution was to open the Animator, then deleting the "IsWalking" parameter and creating a new one with the exact same name. Then setting again the parameter for the conditions of the two transitions.
    then it just worked.
     
    CompanyBurgher likes this.
  43. walterjm78

    walterjm78

    Joined:
    Aug 7, 2019
    Posts:
    4
    Hi,
    I've got stuck in tutorial 7 (Enemies, Part 1: Static Observers).
    I have checked my code several times and can't see the fault but when I go to Unity it tells me there's a compiler error.
    I'm unable to drag the PointOfView GameObject onto the Inspector.
    Any help much appreciated, thanks, John
     

    Attached Files:

  44. Valjuin

    Valjuin

    Joined:
    May 22, 2019
    Posts:
    481
    GameEnding script:
    Line 29 - You have an opening curly brace instead of a closing curly brace

    Observer Script:
    Line 12 should read: void OnTriggerEnter (Collider other)
    Remove the semi-colon from this line in your script.
     
    Last edited: Aug 9, 2019
  45. walterjm78

    walterjm78

    Joined:
    Aug 7, 2019
    Posts:
    4
    Thanks so much for your eagle eye and help Valjuin!
     
  46. T4NK32

    T4NK32

    Joined:
    Aug 7, 2019
    Posts:
    16
    Finished - everything finally works : )

    Found two errors (or were they on purpose) the floor is raised 0.2 (Y axis) in the bedroom off the long corridor and in the small room behind the exit - this makes them impossible to enter (I wanted to move the exit to the outer door).

    Just lower their position to 0, and Bob's your uncle : )
    I'm guessing that has to do with the Navigation Mesh...
    Even if I didn't have to "re-bake" it after those changes ?


    Another thing I noticed: When walking into furniture, the system neatly adjusts ones direction so John can slink past obstacles and through doorways without getting stuck - very nicely done - but sometimes (espcially the chair beside the bathroom door) some of these adjustments "linger" - When standing still, he's ever so slowly sliding - sideways and sometimes even rotating!

    Is that a known problem (or new in 2019.2) ?
     
    Last edited: Aug 20, 2019
  47. NatalieW15

    NatalieW15

    Joined:
    Jul 30, 2019
    Posts:
    16
    My waypoints were all out of the house, causing major errors with how they act. After adjusting them so that they're in the house, now they can see me basically anywhere. What could be the issue?
     
  48. T4NK32

    T4NK32

    Joined:
    Aug 7, 2019
    Posts:
    16
    @NatalieW15 - That's right, the waypoints needed to be moved a bit too.

    In mine, I placed all the ghosts right in front of John Lemon, so when the game starts they are all running away from him, each toward their first waypoint.

    What do you mean by "now they can see me" ?
     
  49. NatalieW15

    NatalieW15

    Joined:
    Jul 30, 2019
    Posts:
    16
    When the waypoints were out of the house, they were moving semi-ok. Now that the waypoints are in the house, they're all messed up and can basically see me anywhere.
     
  50. T4NK32

    T4NK32

    Joined:
    Aug 7, 2019
    Posts:
    16
    Do you mean that they "kill" you from too far away ?

    That sounds like something about their colliders - too big..?

    Do you "play" with both the Scene- and Game-windows (not maximized) visible ?

    If you do, you can click on the ghosts GameObjects (in the scene/Hierarchy-window) and see their colliders.. You can even pause and single-step the action to better examine what's going on...

    Also this guy Brackeys has a lot of video-tutorials, you can follow - He's very good at explaining how to make use of the many byzantine connections between objects in Unity :confused:
     
    NatalieW15 likes this.