3D Survival Game Tutorial | Unity | Part 3: Selecting Items with Raycast & Creating Simple AI

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.ย. 2024
  • #survivalgame #tutorial #unity
    In this tutorial series, we will create a 3D survival game with Unity & C# as the scripting language.
    We will start with basic FPS movement, inventory building, and crafting systems.
    Learn how to pick up items and more.
    Little by little, we are going to add different features that are common to survival open-world games.
    This series is a bit more advanced and fast-paced, but I will try to explain everything I do.
    Any questions are welcome.
    Selection Manager Script:
    gist.github.co...
    InteractableObject Script:
    gist.github.co...
    Ai Movement Script:
    gist.github.co...
    White Rabbit free asset:
    assetstore.uni...
    Sphere/Circle Sprite
    drive.google.c...
    Survival Series Playlist:
    • Unity 3D | Open-World ...
    💾💾💾💾💾💾💾💾💾💾💾💾💾💾💾💾💾💾💾💾💾
    Between my full-time job and my family life,
    I try to find free time to create content for this channel.
    You can support me and help this channel keep growing:
    paypal.me/Mike...
    💾💾💾💾💾💾💾💾💾💾💾💾💾💾💾💾💾💾💾💾💾
    💻 This Is My Development Setup (Affiliate): 💻
    ============
    Main Monitor:
    amzn.to/3M64qCJ
    Secondary Monitor:
    amzn.to/41Iu06A
    Graphics Card:
    amzn.to/3MpnXzd
    CPU:
    amzn.to/3I8nvCW
    RAM:
    amzn.to/42zqM6u
    Keyboard:
    amzn.to/3W5RFN4
    Mouse:
    amzn.to/3nTPcZs
    Headphones:
    amzn.to/3pz0By5
    Microphone:
    amzn.to/3OecJz3

ความคิดเห็น • 360

  • @timothygaming9405
    @timothygaming9405 ปีที่แล้ว +85

    For anybody getting the object not set to an instance ...
    And that is using TextMeshPro in the newer Unity Versions
    Here is what you should do
    Add this to the top of the selectionmanager:
    using TMPro;
    Then u also have to change these 2 lines:
    Text interaction_text; --------------> TextMeshProUGUI interaction_text;
    interaction_text = interaction_Info_UI.GetComponent(); ---------------> interaction_text = interaction_Info_UI.GetComponent();
    I hope this helps :)

    • @gibenkozak4448
      @gibenkozak4448 ปีที่แล้ว +1

      Thanks bro, you make my day easier :D

    • @timothygaming9405
      @timothygaming9405 ปีที่แล้ว +1

      @@gibenkozak4448 No Worries, I didn't want anyone else to go through the same struggle haha

    • @richardwhite7728
      @richardwhite7728 ปีที่แล้ว

      You rock, thank you!

    • @lukasbraithwaite393
      @lukasbraithwaite393 ปีที่แล้ว +2

      bloody legend thanks a lot man I was pulling hair out because of this.

    • @mirhanozden522
      @mirhanozden522 8 หลายเดือนก่อน +1

      Legend for telling everybody 👍👍

  • @alexd1362
    @alexd1362 ปีที่แล้ว +23

    First off, amazing tutorials and explanations! The best I have came across, great at explaining the little details.
    I laughed so hard when you were creating the rabbits and you went over one and said "oh I stepped on one" as if the rabbit felt it.
    Keep doing what you are doing, we really appreciate it!!!

  • @bobbysmurf9915
    @bobbysmurf9915 ปีที่แล้ว +27

    If your like me and don't want the selectionmanager to select stuff across the map, you can simple change this
    if (Physics.Raycast(ray, out hit))
    to
    if (Physics.Raycast(ray, out hit, 10))

    • @berkeaytan5506
      @berkeaytan5506 2 หลายเดือนก่อน +2

      Great advice, thanks. But when you do so, the text update only occurs within that range and for instance if you hover over that object and move away while looking towards it, it (text object) will be stuck on that state and only will be updated when nearby an interactable object or the first one you locked onto.

    • @connorpayne2671
      @connorpayne2671 2 หลายเดือนก่อน

      @@berkeaytan5506 This is the solution to that
      Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
      RaycastHit hit;
      if (Physics.Raycast(ray, out hit, interactRange))
      {
      if(hit.collider.GetComponent() != null)
      {
      var selectionTransform = hit.transform;
      if (selectionTransform.GetComponent())
      {
      interactionText.text = selectionTransform.GetComponent().GetItemName();
      interaction_Info_UI.SetActive(true);
      }
      }
      else
      {
      interaction_Info_UI.SetActive(false);
      }
      }
      if(hit.collider == null)
      interaction_Info_UI.SetActive(false);

    • @connorpayne2671
      @connorpayne2671 2 หลายเดือนก่อน

      I also added a public float, which is what the "interactRange" is

    • @bobbysmurf9915
      @bobbysmurf9915 2 หลายเดือนก่อน

      @@connorpayne2671 Nice job, keep following this tutorial! I took a long break but once you start learning more, unity becomes very fun and a very powerful engine to use.

  • @daywedie
    @daywedie ปีที่แล้ว +26

    Alright, first of all, I'm loving this tutorial series. I'm planning to follow them through until I have something cool playable.
    Second, reading some comments about problems other had, and making a little research, I found a way to use TextMeshPro instead of the legacy text.
    your code should be something like this:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.UI;
    using TMPro;

    public class SelectionManager : MonoBehaviour
    {
    public GameObject InteractionInfo;
    TextMeshProUGUI interaction_text;

    private void Start()
    {
    interaction_text = InteractionInfo.GetComponent();
    }
    void Update()
    {
    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    RaycastHit hit;
    if (Physics.Raycast(ray, out hit))
    {
    var selectionTransform = hit.transform;
    InteractableObject interactable = selectionTransform.GetComponent();
    if (interactable)
    {
    InteractionInfo.SetActive(true);
    interaction_text.text = interactable.GetItemName();
    }
    else
    {
    InteractionInfo.SetActive(false);
    }
    }
    }
    }
    The gist of it is using TextMeshProUGUI as a variable type, instead of just TextMeshPro. Don't forget to use "using TMPro" at the top of the code too. Hope this helps someone.

    • @zuzumaster6809
      @zuzumaster6809 ปีที่แล้ว +1

      helped me a ton although I got a ton of errors and have no clue what to do

    • @zuzumaster6809
      @zuzumaster6809 ปีที่แล้ว +1

      nevermind fixed

    • @RatSpit
      @RatSpit 11 หลายเดือนก่อน

      Thank you so much!!!! @daywedie

    • @ConsoleWrite-lx1yh
      @ConsoleWrite-lx1yh 11 หลายเดือนก่อน +1

      Thank you brother!

    • @Dazeza
      @Dazeza 8 หลายเดือนก่อน

      My code problem 'InteractableObject' could not be found, pls help me 😢

  • @thedrumminggeek5436
    @thedrumminggeek5436 ปีที่แล้ว +11

    for anyone who has problems with the item name not showing when you look at an object, Make sure that the object has a collision box. I've been pulling my hair out for hours with this problem, yet the solution was kind of obvious haha. Could just be a problem for me because I'm using different assets. anyways, love your videos and how you explain everything. Thanks man

    • @Evelyn-dh4zp
      @Evelyn-dh4zp ปีที่แล้ว +5

      The asset I'm using has colliders already but I am still having that problem... Any suggestions on how to fix it?

    • @muddy11112
      @muddy11112 5 หลายเดือนก่อน

      Thanks bro, I was also pulling my hair out

    • @luc9430
      @luc9430 หลายเดือนก่อน

      The solution to all my problems xD. Thanks

  • @TinkeringNoob
    @TinkeringNoob 5 หลายเดือนก่อน +6

    If you cant find the animator tab, its under window in the ribbon alog the top window/animation/animator
    if you are getting The type or namespace name 'InteractableObject' could not be found. its because you need to create a seperate c# script named 'InteractableObject' and then place the code in description for it in it.

    • @Mattyy25
      @Mattyy25 12 วันที่ผ่านมา

      g

  • @thuongtrinhvan2001
    @thuongtrinhvan2001 2 หลายเดือนก่อน +1

    For anybody have a problem with the rabbit face down when idle state, you should freeze the x and y rotation in rigidbody

    • @ETAFree
      @ETAFree หลายเดือนก่อน +1

      ồ thank kiu bro.

  • @MrThijsdc
    @MrThijsdc ปีที่แล้ว +7

    Hey Mike, Thanks for the tutorial. Just a small suggestion: it's always very helpful to provide the assets you use in your tutorial to the viewer. For example, even something simple as importing that white sphere you use for the reticle took me like two hours since I needed to download image software and figure out how to create the right type of image.

    • @PaulMartin-zc9oj
      @PaulMartin-zc9oj ปีที่แล้ว

      You can adjust the type of image, change to sprite etc inside of Unity. Just make sure you have the 2D sprite addon added in the package manager. Once installed just click on the image in the project window and in the inspector you can change it to whatever you need. Sprite, cursor whatever. Window > package manager > select unity registry and install from there. There are tons of tools in there for image and atlas editing. Cheers

    • @SAVAGEGHXST420
      @SAVAGEGHXST420 ปีที่แล้ว +1

      for future reference there is a thing called knob in the 2023 version for me not sure were it came from but it does not go to anything ive imported and its already pre made for crosshair

    • @connorpayne2671
      @connorpayne2671 2 หลายเดือนก่อน

      @@SAVAGEGHXST420 It's for the sliders. I'm pretty sure they've been around for a while. I'm using the 2022 version and I have it too, so that's what I was using

  • @TheRealKaiProton
    @TheRealKaiProton ปีที่แล้ว +2

    Im really enjoying going over these videos,
    Ive never really working in 3d, and these explanations are really good.
    Ive had various problems when adding stuff to the game world, and had a lot of fun tracking down the issues, and figuring out where I went wrong.

  • @DJLKM1
    @DJLKM1 ปีที่แล้ว +11

    An addition to your raycast would be a float for ray distance, otherwise you will hit everything in the game world. So = if(Physics.Raycast(ray, out hit, 2f)).

    • @InfidelAtWork
      @InfidelAtWork 10 หลายเดือนก่อน

      It is a good solution but... When i increased a distance from this object the text won't disappear. Any idea?

    • @SovietAra
      @SovietAra 9 หลายเดือนก่อน +3

      @@InfidelAtWork bool isHit = Physics.Raycast(ray, out hit, 2f);
      if (isHit)
      {
      var selectionTransform = hit.transform;

      if (selectionTransform.GetComponent())
      {
      interaction_text.text = selectionTransform.GetComponent().GetItemName();
      interaction_Info_UI.SetActive(true);
      }
      }
      else
      {
      interaction_Info_UI.SetActive(false);
      }

  • @anasouladbenlahcen
    @anasouladbenlahcen ปีที่แล้ว +2

    best tutorials i ever seen about unity
    thank you so much

  • @Warp_Speed_Studios
    @Warp_Speed_Studios ปีที่แล้ว +4

    21:07 you might already know this but if you hold right mouse button you can use wasd to move

  • @Leaks_the_vegetable
    @Leaks_the_vegetable 2 หลายเดือนก่อน +2

    If you are having trouble with the selection script you first also have to have the interactable object scripts

    • @linctheweightlifter04
      @linctheweightlifter04 2 หลายเดือนก่อน

      what do you put the interactable object script on?

    • @Leaks_the_vegetable
      @Leaks_the_vegetable 2 หลายเดือนก่อน

      Any object like a rabbit or rock that you want to interact with

  • @Dialogues_about_Ukraine
    @Dialogues_about_Ukraine 9 หลายเดือนก่อน

    Mike thank you for your tutorials!
    It's motivate me to explore all details and even try to do some modifications.

  • @Super_Nova919
    @Super_Nova919 ปีที่แล้ว +3

    I subscribed because of how good this tutorial is :)

  • @tenzindayoe5783
    @tenzindayoe5783 ปีที่แล้ว +2

    One of the best tutorials out there !

  • @RamenNooNoos
    @RamenNooNoos 3 หลายเดือนก่อน +3

    Hey guys, I'm sorry for those who are looking for answers to their errors, so if you're getting the error about the interactable object in the selection manager script all you need to the is make sure you have the interactable script imported with the stuff mike has. hope this helped some of u

    • @Micul_Pescar6
      @Micul_Pescar6 หลายเดือนก่อน

      Thank you broo 👍🏿👍🏿

    • @nabelfathahillah
      @nabelfathahillah 5 วันที่ผ่านมา

      thank you so so so much

  • @toycat263
    @toycat263 ปีที่แล้ว +2

    READ IF YOU CANNOT GET YOUR TEXT TO SHOW WHEN YOU HOVER OVER AN INTERACTABLE OBJECT: (this worked for me)
    -Ensure that the interactable object has a collider on it. If its an asset that you made yourself or different to the one Mike is using, input a mesh collider
    - when you click play, make sure you actually click into the game (ur PC Cursor should disappear when you click into the game). Your camera will be able to move while ur not actually clicked into the game, but the UI won't work untill your cursor disappears by clicking into the game.
    This should fix the problem.

    • @FlamberetElg
      @FlamberetElg ปีที่แล้ว

      I have a problem with the script, mine says:
      Assets\Scripts\SelectionManager.cs(25,49): error CS0246: The type or namespace name 'InteractableObject' could not be found (are you missing a using directive or an assembly reference?)
      how do i fix this?

    • @toycat263
      @toycat263 ปีที่แล้ว

      @@FlamberetElg at the top of the script, you should have "using UnityEngine;"
      Underneath it, type using "UnityEngine.UI;"
      This might fix the problem. give it a shot

    • @TheRealKaiProton
      @TheRealKaiProton ปีที่แล้ว

      @@FlamberetElg Is this what I did, and looked at the code, so you needed to keep on the video for a bit until you create the interactable script?
      also mine didnt work, until I figured out I was using TextMesh Pro, that calls the text component in a different way, as soon as I moved it back to Legacy, it was fine.

  • @kenware9578
    @kenware9578 8 หลายเดือนก่อน +5

    Error whiile in playmode: "object reference not set" on SelectionManager script copy and paste this,
    Note: In the unity editor you will need to drag the players camera into the "Camera" reference
    using System.Collections;
    using System.Collections.Generic;
    using TMPro;
    using UnityEngine;
    using UnityEngine.UI;
    public class SelectionManager : MonoBehaviour
    {
    public Camera playerCamera;
    public GameObject InteractionInfo;
    TextMeshProUGUI interaction_text;
    private void Start()
    {
    interaction_text = InteractionInfo.GetComponent();
    }
    void Update()
    {
    Ray ray = playerCamera.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
    RaycastHit hit;
    if (Physics.Raycast(ray, out hit))
    {
    var selectionTransform = hit.transform;
    InteractableObject interactable = selectionTransform.GetComponent();
    if (interactable)
    {
    InteractionInfo.SetActive(true);
    interaction_text.text = interactable.GetItemName();
    }
    else
    {
    InteractionInfo.SetActive(false);
    }
    }
    }
    }
    Hope this helps

    • @ConsoleWrite-lx1yh
      @ConsoleWrite-lx1yh 8 หลายเดือนก่อน

      Brooo! Thank you so much I've been struggling finding the solutions and I see your comment and it solved the problem! Thank youuu have a nice day!

    • @linctheweightlifter04
      @linctheweightlifter04 2 หลายเดือนก่อน

      Hey man, this seems to be helping for me but idk how to drag the players camera into the "Camera" reference lol, do you think you could describe it a little bit more for me?

    • @funkmunki
      @funkmunki 2 หลายเดือนก่อน

      Thank you so much!

    • @proxgamer1082
      @proxgamer1082 หลายเดือนก่อน

      Thank you so muchhhhhhhh I was about to quit my game development bcuz of this

    • @nabelfathahillah
      @nabelfathahillah 5 วันที่ผ่านมา

      @@linctheweightlifter04 just drag the main camera object under your player parent to the selection manager inspector

  • @dkordy
    @dkordy ปีที่แล้ว +1

    Hi, I like the way you explain, glad I found you. I will definitely follow this series. It would also be good if, during the explanation, you would add how the script would be done if, for example, instead of the first person, you used the third person, what would the difference be.. As for the rest, it's a really good tutorial... Best regards, and keep up the good work ...subscribed

    • @Evelyn-dh4zp
      @Evelyn-dh4zp ปีที่แล้ว

      It would be pretty much the same. You just would want to have a humanoid for a player and move the position of the camera so you can see the player. From what I know that is all you would really have to do

  • @PorkinsRevenge
    @PorkinsRevenge ปีที่แล้ว +2

    So here's an interesting question.
    Here's the setup: The trees that I'm using to do this tutorial are from a pack I've already purchased. I did everything correctly to set up the text per Mike's instructions. But it just wasnt doing anything. So after double checking it, I added some debug messages to the SelectionManager Script.. I had it tell me after the hit what transform it was finding, and after the if statement where it was looking for InteractableObject, whether or not if found it.
    It was making a hit, but the transform it returned was the LOD0, not the parent. So, it was not finding the Interactable Object. It took me a second to recognize that it wasnt testing the parent of the Tree... because the hit was being made on it's LOD0... and so when I put InteractableObject on it's LOD it worked fine... It didnt matter whether or not the tree was rendering LOD4, as long as the code was attached to LOD0 it worked fine... Does this sound like it's working as designed to you all? Do you think I should report it to Unity as a bug? Anyway for anyone using a different tree... Hopefully this comment will help, and hopefully it will save you the proverbial banging of the head against the wall i did.

    • @PorkinsRevenge
      @PorkinsRevenge ปีที่แล้ว +1

      After looking deeper into this it's because the asset creator added the capsule collider to LOD 0, not to the parent. So, after putting the collider on the parent it all worked just fine... be aware if you're having this problem, that leaving the interaction on the LOD will only let you interact with the LOD... So, thats not really a solution. I.e. if you were to have the cut tree down script on that LOD you'd only be cutting down the LOD. It would look normal when you are up close and actually interacting with the tree, BUuuuuut when you move away from the tree LOD 1 would materialize as if it were magic... and then when you move closer to the tree, and it tries to load LOD 0... the tree would then disappear again... so if you are having the problem that I first described... move the Collider to the main parent of the tree.

  • @SmartLearningAI
    @SmartLearningAI 4 หลายเดือนก่อน

    Also: Change the Box Collider to enable Trigger. Next Add Navmesh agent component to each the rabbit prefab and set Base Offset to like -0.10. Disable the original AI_Movement Script or replace it with AI_Movement_Navmesh script. Add a NavMeshSurface (if you don't have one already) component to your Terrain and Bake. (I use Unity 2022.3.25f1)

  • @WPxenowolf
    @WPxenowolf 6 หลายเดือนก่อน +2

    If you are getting :
    NullReferenceException: Object reference not set to an instance of an object
    SelectionManager.Update () (at Assets/Scripts/SelectionManager.cs:21)
    make sure your camera is tag MainCamera

  • @gandalfthew439
    @gandalfthew439 ปีที่แล้ว +1

    If text doesn't appear when you hover over the object with cursor, try adding collider to your prefab. That's how it worked in my project.

    • @Warp_Speed_Studios
      @Warp_Speed_Studios ปีที่แล้ว

      im kinda dumb, but whats a prefab

    • @Warp_Speed_Studios
      @Warp_Speed_Studios ปีที่แล้ว

      nvm

    • @gandalfthew439
      @gandalfthew439 ปีที่แล้ว

      @@Warp_Speed_Studios Actually, I don't know exactly 😄Probably some sort of object in the game.

  • @alexbaring8461
    @alexbaring8461 ปีที่แล้ว +6

    I have this really weird issue, everything is working fine but when the rabbits are idle on a sloped surface they just face plant into the ground and try to hop into the ground, when the idle timer is up and they start start to run again it goes back to normal until they idle on a slope again. does anyone have the same problem or does anyone know how to fix it

    • @zorny_
      @zorny_ ปีที่แล้ว +9

      Hey, had the same problem, it is actually fixed in the next episode, in case you didn't see it, jus go into your rabbit's prefab and in the rigidbody>constraints, freeze the x and z rotation. It should fix everything

  • @skoonahyvampire6084
    @skoonahyvampire6084 ปีที่แล้ว +4

    For the most part it is working, the only problem is that the interactable text doesn't disappear when I look away from the object everytime.
    Not sure if this is a collision issue, I am using the mesh collider for my objects. It is almost as if it randomly decides when the text should disappear. I am using legacy text not text mesh pro.

    • @skoonahyvampire6084
      @skoonahyvampire6084 ปีที่แล้ว

      He talks about it in the 4th part if anyone found this.

    • @user-hc3ky5re8j
      @user-hc3ky5re8j ปีที่แล้ว

      i have the same problem@@skoonahyvampire6084

  • @roviot44
    @roviot44 4 หลายเดือนก่อน

    Awesome tutorials! TYSM! 💪

  • @chenkevin4620
    @chenkevin4620 ปีที่แล้ว

    i love you,this is best tutorials i've seen

  • @seanpainter9070
    @seanpainter9070 ปีที่แล้ว +5

    how come when im trying to sort out the selection manager the interaction info ui doesnt show up
    please help

    • @BlueBerryCool707
      @BlueBerryCool707 5 วันที่ผ่านมา

      U first must have the interactable script it doesnt matter for where u are at if its on anything.

  • @itxazizzz
    @itxazizzz 5 หลายเดือนก่อน +2

    I have issue on this selectionmanager script it gives me null reference object error please help mei to fix this

    • @DAHDOOH
      @DAHDOOH หลายเดือนก่อน

      yes please

  • @matheusbosc
    @matheusbosc ปีที่แล้ว +1

    for the sphere, i just used the UI text and plus sign

  • @dudek1499
    @dudek1499 ปีที่แล้ว +3

    Hi Mike I have 1 problem after I write "using UnityEngine.UI" on the top of script I have this error Assets\Scripts\SelectionManager.cs(1,21): error CS1002: ; expected Can you help me?

    • @Obliterator786
      @Obliterator786 11 หลายเดือนก่อน

      You are mising " ; "

  • @eden5929
    @eden5929 10 หลายเดือนก่อน

    If you’re having trouble with the text not showing and its not to do with colliders or ur mouse, I realised that I had 2 cameras operating, one main camera and one camera for the player. Because the script is directed at the main camera it wasnt detecting any rays! I changed the code to be camera.current instead of camera.main (but i think a better solution would be to have only ur main camera active I am just too tired to be bothered to change everything rn). Hope this helps!!!

  • @MultiDegh
    @MultiDegh ปีที่แล้ว +4

    When i reach the point of adding the component Selection Manager i dint get the Interaction_info_UI, the same when i add the component Interactable object i dont get the Item Name option that appears in your video. it seems that many are having this issue. is there a way to fix this, i tried everything so far, out of ideas...

    • @alphazero4102
      @alphazero4102 24 วันที่ผ่านมา

      Hi, have you found a solution to this problem?

  • @v_xx_official
    @v_xx_official 10 หลายเดือนก่อน +2

    I got this error what do i do: Assets\Scripts\SelectionManager.cs(9,43): error CS1002: ; expected

    • @v_xx_official
      @v_xx_official 10 หลายเดือนก่อน +1

      Its for the selection manager

  • @EAZYCOOKZ
    @EAZYCOOKZ 10 วันที่ผ่านมา

    the scriptmanager file doesnt come up with the 2 boxs when i drop the file on the enmty object yet i name eveything as i should so what could i be doing wrong? i am using the latest unity

  • @virtualgodwin9088
    @virtualgodwin9088 ปีที่แล้ว +6

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.UI;
    public class SelectionManager : MonoBehaviour
    ...
    But nothing, in inspector the "Selection Manager" script does not add the "Interaction_Info_UI" option

    • @oArzoh
      @oArzoh ปีที่แล้ว +4

      Got the exact same problem

    • @virtualgodwin9088
      @virtualgodwin9088 ปีที่แล้ว +2

      @@oArzoh at minute 14 he explains it (he could have said it earlier...):

    • @siureksmoka989
      @siureksmoka989 11 หลายเดือนก่อน +1

      a hero without a cape

  • @z7gu3
    @z7gu3 ปีที่แล้ว +3

    error i cant seem to fix
    Assets\SelectionManager.cs(11,5): error CS0246: The type or namespace name 'Text' could not be found (are you missing a using directive or an assembly reference?)

    • @Obliterator786
      @Obliterator786 11 หลายเดือนก่อน

      Here is updated script
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using TMPro;
      public class SelectionManager : MonoBehaviour
      {
      private TextMeshProUGUI textMeshPro;
      public GameObject interaction_Info_UI;
      TextMeshProUGUI interaction_text;
      private void Start()
      {
      textMeshPro = GetComponent();
      interaction_text = interaction_Info_UI.GetComponent();
      }
      void Update()
      {
      Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
      RaycastHit hit;
      if (Physics.Raycast(ray, out hit))
      {
      var selectionTransform = hit.transform;
      if (selectionTransform.GetComponent())
      {
      interaction_text.text = selectionTransform.GetComponent().GetItemName();
      interaction_Info_UI.SetActive(true);
      }
      else
      {
      interaction_Info_UI.SetActive(false);
      }
      }
      }
      }

    • @iTwonky
      @iTwonky 6 หลายเดือนก่อน

      write "using Unity.Engine.UI" on the top of your code

  • @mostlycarbon9576
    @mostlycarbon9576 6 หลายเดือนก่อน +1

    When my bunnies stop hopping and they should sit still (idle) they kinds slide forward slowly.. then they turn and hop around, then stop and slide slowly.... lol. Any ideas? The rotation on x and z is locked so that bit is solved. They sit still and slide like they're on a skating ring.

  • @advaitmoreyt96
    @advaitmoreyt96 14 วันที่ผ่านมา

    I have elevated terrain, and every single time they go inside the terrain.... how can I fix this?

  • @bradmerrill6220
    @bradmerrill6220 ปีที่แล้ว +2

    The ground level for my terrain is y position 0, My rabbits y position is 0 as well. For some reason when I start the game, the rabbit's y position will jump up to .25 and stay there while the game runs indefinitely. This problem causes the rabbit to look like it is slightly floating while jumping around. If I use the constraint on the rigidbody to freeze the y position...It messes with the speed of the rabbit and the animation itself. Anyone else experiencing this problem? can't think of any other fixes for it.

    • @asylumblack9122
      @asylumblack9122 ปีที่แล้ว

      sounds like the collider is lower then the rabit, making the rabit seems like floating because the colider touches the ground (the colider is the actual rabit) and the mesh (the rabit) is above so check that thing for furture 'floating' missunderstanings (the collider needs to be at the very feet of the mesh/rabit, maybe even .01 upper then the mesh but never lower)

    • @bradmerrill6220
      @bradmerrill6220 ปีที่แล้ว

      @@asylumblack9122 I finally figured it out, and that is exactly what the problem was. I was making different sized rabbits and the box collider wasn't scaling with the resizing of the rabbits and I didn't catch it. I didn't have the rabbit selected in the Hierarchy tab to see what the box collider looked like on it in the scene tab when running the game. If I hadn't of figured it out on my own...I was planning on coming back here this week to see if anyone replied. I appreciate the help! Thank you sir.

  • @oArzoh
    @oArzoh ปีที่แล้ว +4

    at 08:27 when i drag the script to the empty object, i don't get the second row called "Interaction_info_UI". Any solutions to this? I also get this error message when pasting the SelectionManager script code into visual studio: Assets\Scripts\SelectionManager.cs(9,5): error CS0246: The type or namespace name 'Text' could not be found (are you missing a using directive or an assembly reference?)
    I tried doing this with both the TextMeshPro and the normal Text but still the same error

    • @castleexe2968
      @castleexe2968 ปีที่แล้ว

      Add using UnityEngine.UI; on the top

    • @oArzoh
      @oArzoh ปีที่แล้ว

      @@castleexe2968 Ty for answer man but that didn't work either :/ still no window for interaction_info_ui

    • @nexno27
      @nexno27 ปีที่แล้ว

      @@oArzoh i also dont have the window

    • @Esizl
      @Esizl ปีที่แล้ว +2

      14:00 to about 17:55 he explains it

    • @Obliterator786
      @Obliterator786 11 หลายเดือนก่อน

      Here is updated script
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using TMPro;
      public class SelectionManager : MonoBehaviour
      {
      private TextMeshProUGUI textMeshPro;
      public GameObject interaction_Info_UI;
      TextMeshProUGUI interaction_text;
      private void Start()
      {
      textMeshPro = GetComponent();
      interaction_text = interaction_Info_UI.GetComponent();
      }
      void Update()
      {
      Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
      RaycastHit hit;
      if (Physics.Raycast(ray, out hit))
      {
      var selectionTransform = hit.transform;
      if (selectionTransform.GetComponent())
      {
      interaction_text.text = selectionTransform.GetComponent().GetItemName();
      interaction_Info_UI.SetActive(true);
      }
      else
      {
      interaction_Info_UI.SetActive(false);
      }
      }
      }
      }

  • @SAVAGEGHXST420
    @SAVAGEGHXST420 ปีที่แล้ว +1

    {can someone help please} ive ran through this vid before on other projects and the [Selectionmanager] and [interactableobjects] files (WORKED) but now they dont show names and ive ran through it over and over and cant fix it

  • @Sleeezzyy
    @Sleeezzyy 2 หลายเดือนก่อน

    If anyone else is getting “object not set to instance” what worked for me was going to my Camera and changing the tag to Main camera

  • @psychologe112
    @psychologe112 ปีที่แล้ว +2

    Did all like in the tut and got this
    Assets\Scripts\SelectionManager.cs(10,5): error CS0246: The type or namespace name 'Text' could not be found (are you missing a using directive or an assembly reference?)

    • @psychologe112
      @psychologe112 ปีที่แล้ว +1

      for all who strugle with this i figured it out, he does not mention that you have to add " using UnityEngine.UI;" in the manager script on top.
      i can also recomend do not to follow the tutorial step by step because it will lead to errors look the full video then try it. because he mention script that are needet before to late, this will lead to errors if you try to recreate step by step.

    • @fyszen9767
      @fyszen9767 ปีที่แล้ว

      @@psychologe112 ty

    • @pureluck8882
      @pureluck8882 ปีที่แล้ว +2

      Make sure you have the 5th script created like in the video :
      "using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class InteractableObject : MonoBehaviour
      {
      public string ItemName;
      public string GetItemName()
      {
      return ItemName;
      }
      }"

    • @Lerya9
      @Lerya9 ปีที่แล้ว

      @@psychologe112 thanks

    • @user527bzhd
      @user527bzhd ปีที่แล้ว +1

      @@pureluck8882 THANX BRO

  • @inzainiaplays
    @inzainiaplays 9 หลายเดือนก่อน +1

    im new, and in the newer unity following this tutorial and all is working except the animator section. I cannot for the life of me figure out how to add the isrunning and isdead variables anywhere as mine opens up as read only. any ideas? the bunny stays in the idle animation and moves around per the code, randomly choosing a direction and time, it just doesnt swap from the idle to the running animation. ***edit but leaving for others*** under window/animation/animator parameters is the window to add the isrunning and isdead, it is not in the animation window, its in the animator window, which is activated in the same place. window/animation/animator.

    • @TinkeringNoob
      @TinkeringNoob 5 หลายเดือนก่อน

      I love you thank you!😂

  • @myhammyxiaojiji
    @myhammyxiaojiji 12 วันที่ผ่านมา

    Help, the item name appears when my cursor is on the object and not when the middle white dot is on the object, any ways to fix this?

    • @Mikes-Code
      @Mikes-Code  12 วันที่ผ่านมา

      @@myhammyxiaojiji The cursor should be locked to the middle of the screen + invisible.

  • @linkiyttv
    @linkiyttv ปีที่แล้ว

    fantastic video u helped me a lot

  • @reinhardgercken5362
    @reinhardgercken5362 2 ปีที่แล้ว +2

    Please can you link your scripts; I like this form of tutorial, you made it verry well

  • @leoneliws6595
    @leoneliws6595 4 หลายเดือนก่อน

    Hello! Very good video, it helped me a lot, but I have a problem, and that is that when the rabbit stops walking and has to wait while still, instead of staying still, it continues walking but down ( -Y ) and then continues walking in one direction.

  • @hardy9810
    @hardy9810 6 หลายเดือนก่อน

    Really great video!
    I just encountered a problem. The mouse sensitivity gets reeeeaaally fast every time, I look at my grass. I found out that this is because of the FPS. To solve this problem, you have to set the FPS to a amount, so it cant change. You can do it like this: (Paste this into start method)
    public int targetFrameRate = 60;
    // Set the target frame rate
    Application.targetFrameRate = targetFrameRate;
    // Set the fixed delta time to ensure consistent physics calculations
    Time.fixedDeltaTime = 1f / targetFrameRate;

  • @Benbot2514
    @Benbot2514 ปีที่แล้ว +3

    Hey @MikeSchvedov i keep getting an error that says the file name and class name doesn't match. How do i fix this? (Btw this tutorial is absolutely amazing thank you so much)

    • @Mikes-Code
      @Mikes-Code  ปีที่แล้ว +1

      Its some bug in unity.
      Just delete the script, and create a new one.
      It happens when we create a script but press enter instead of giving it a name right away.
      Most importantly make sure that when you give the script a name, it stays the same inside the script (Class name).

    • @Benbot2514
      @Benbot2514 ปีที่แล้ว +1

      @@Mikes-Code Thank you!

  • @eternaldream8361
    @eternaldream8361 10 หลายเดือนก่อน +1

    NullReferenceException: Object reference not set to an instance of an object
    SelectionManager.Update () (at Assets/Scripts/SelectionManager.cs:19) i have this Problem please tell me How can fix that ?

    • @macadamion-
      @macadamion- 7 หลายเดือนก่อน

      broooo i had the same problem but i managed to figure it out, what i had to do was take off text mesh pro. it has to be regular text, it probably is way to late but hey, i tried.

  • @lucaselkinson3591
    @lucaselkinson3591 5 หลายเดือนก่อน +2

    "InteractableObject" not found Solutions within the SelectionManager code?

    • @TinkeringNoob
      @TinkeringNoob 5 หลายเดือนก่อน

      You need to create a separate script, call it InteractableObject and place the code in the description in it.

  • @Evelyn-dh4zp
    @Evelyn-dh4zp ปีที่แล้ว +3

    When trying to get the object name by looking at an object I get this error: "NullReferenceException: Object reference not set to an instance of an object
    SelectionManager.Update () (at Assets/Scripts/SelectionManager.cs:28)" Does anyone know how to fix this? I've been trying but I just can't figure it out.

    • @Mikes-Code
      @Mikes-Code  ปีที่แล้ว

      Hey,
      It says that the problem is on line number 28 of the SelectionManager.
      What are the objects you have on this line?
      One of them is missing a reference.
      Can you copy and paste the code of this line over here?
      Maybe I can help, although its usualy hard without being in front unity itself.

    • @Evelyn-dh4zp
      @Evelyn-dh4zp ปีที่แล้ว

      @@Mikes-Code interaction_text.text = selectionTransform.GetComponent().GetItemName();

    • @Mikes-Code
      @Mikes-Code  ปีที่แล้ว

      @@Evelyn-dh4zp It looks like when you point on an item, this line is trying to access the "Interactable" script on the item.
      But if you are pointing at something that is without this script - It will cause a NullReferenceException like you have.
      I don't remember at what point we changed the code but there should be an IF statement surrounding this line, and in that IF statement we check first, if the selectionTransform.GetComponent() is not null, only then run the code.
      It should be something like :
      var selectionTransform = hit.transform;
      InteractableObject interactable = selectionTransform.GetComponent();
      if (interactable) // basically if its not null
      {
      interaction_text.text = interactable.GetItemName();
      }
      this code should be here at some point in the tutorial.
      I just don't know where in the tutorial did you reach.

    • @Evelyn-dh4zp
      @Evelyn-dh4zp ปีที่แล้ว +1

      @@Mikes-Code But this shows up only when I point at the trees which have the interactable objects script and have the item name Tree
      I paused the video at 18:04 after you pointed at the trees and it worked for you but not for me despite me doing everything that you did in the video up to that point.

    • @Sus-jg2jt
      @Sus-jg2jt ปีที่แล้ว +2

      yes i am having the same problem when i look at the tree it just logs the game out

  • @vuropetz4763
    @vuropetz4763 ปีที่แล้ว +2

    9:15 i get this error when i import the script Assets\Scripts\SelectionManager.cs(3,33): error CS0246: The type or namespace name 'MonoBehaviour' could not be found (are you missing a using directive or an assembly reference?)

    • @Obliterator786
      @Obliterator786 11 หลายเดือนก่อน

      here is the updated script
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using TMPro;
      public class SelectionManager : MonoBehaviour
      {
      private TextMeshProUGUI textMeshPro;
      public GameObject interaction_Info_UI;
      TextMeshProUGUI interaction_text;
      private void Start()
      {
      textMeshPro = GetComponent();
      interaction_text = interaction_Info_UI.GetComponent();
      }
      void Update()
      {
      Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
      RaycastHit hit;
      if (Physics.Raycast(ray, out hit))
      {
      var selectionTransform = hit.transform;
      if (selectionTransform.GetComponent())
      {
      interaction_text.text = selectionTransform.GetComponent().GetItemName();
      interaction_Info_UI.SetActive(true);
      }
      else
      {
      interaction_Info_UI.SetActive(false);
      }
      }
      }
      }

    • @Salt_king1611
      @Salt_king1611 3 หลายเดือนก่อน

      Did you find out how (im having the same problem)

  • @Properpeanut
    @Properpeanut ปีที่แล้ว +3

    To raycast to the center of the screen use:
    Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5F, 0.5F, 0));
    Instead of;
    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    The mouse will not always be at the center of the screen.

    • @eeni14
      @eeni14 ปีที่แล้ว +1

      In the previous tutorials he locked the cursor to the center, would this still be a problem?

    • @bobbysmurf9915
      @bobbysmurf9915 ปีที่แล้ว

      @@eeni14 No

    • @ivanpriz4547
      @ivanpriz4547 11 หลายเดือนก่อน

      @@eeni14 Yeah, it still was, guess somewhy even with locking cursor mouse position can be offset from the center, I struggled with it.

    • @InfidelAtWork
      @InfidelAtWork 10 หลายเดือนก่อน

      i agree with @SP261280. This solved my problems with displaying text on screen.

  • @Recep-qb8eu
    @Recep-qb8eu 5 หลายเดือนก่อน

    Thanx for amazing tutorial.But i have some problems.When i hit play my character look down at start.And rabbit starts walk and when it stops,it rotates 90 degress and goes idle with its head inside terrain.Then rabbit starts walking again and turns normal.When i hit play and look the game in scene window, my chracters cylender starts game 90 degrees rotated faced to ground, and the when the rabbit ends walking,it is also rotated 90 degrees.When i look inspector, both objects rotation values never change.

  • @iannewton3820
    @iannewton3820 ปีที่แล้ว +1

    @Mike's Code where is the Interactable Object script?

  • @danyarsniper8793
    @danyarsniper8793 8 หลายเดือนก่อน

    thanks ,
    i have problem about rabbit , in inspector i don't have box cellinder and rigidbody , then in Hierarchy show 2 side box blue one side black

  • @momotytyyt
    @momotytyyt 9 หลายเดือนก่อน

    Is it not way easier and scaleable to use layers to distinguish between interactable and non-interactable gameobject? you even used this approuch previously for detecting if the player is on the the ground.
    The physics methods even take in layermask object as params so i would asume this is the way to go no?

  • @v_xx_official
    @v_xx_official 10 หลายเดือนก่อน +1

    On my script i dont have the part where you add text

  • @CyberStudios
    @CyberStudios 11 หลายเดือนก่อน

    My bunny keeps sinking about 15 less that the normal height and then it goes in the same height in which ever direction, floating bunny. I tried the rigidbody but that did not help much, any suggestions?

  • @xdiggidystaticx1596
    @xdiggidystaticx1596 ปีที่แล้ว

    Amazing tutorials first of all! I have one small problem so far. My Rabbit moves and all that good stuff but wont HOP! driving me crazy! Anyone else?

    • @xdiggidystaticx1596
      @xdiggidystaticx1596 ปีที่แล้ว

      I fixed it the Hopping!

    • @RatSpit
      @RatSpit 11 หลายเดือนก่อน

      @@xdiggidystaticx1596 How, I am having the same problem?

  • @LirusNeon
    @LirusNeon 4 หลายเดือนก่อน

    My rabbits flips after run animation and starts floating if colides with another colider :P

  • @FIHBANKORT
    @FIHBANKORT 2 หลายเดือนก่อน

    when i place crosshair, ITS PIXELIZED AND LOOKS TERRIBLE, even the unity presets looks horibly pixelized, i tried big resolution images, small, different formats, all the canvas settings, image settings in unity, nothing changes the pixalized terrible look of my crosshair white center dot... I am already trying to fix it for 2 hours and i cant figure out whats the problem..........

    • @FIHBANKORT
      @FIHBANKORT 2 หลายเดือนก่อน

      but if i use text: + ("plus"), it looks normal

    • @FIHBANKORT
      @FIHBANKORT 2 หลายเดือนก่อน

      nope EVEN THE TEXT IS PIXELIZED......

  • @mathgigue
    @mathgigue 9 หลายเดือนก่อน

    am I the only one that the selection manager script doesn't work? It keeps giving me errors when I paste the script.

  • @007_man
    @007_man 5 หลายเดือนก่อน

    We can also limit the distance for ray

  • @user-gc5vo5sf7v
    @user-gc5vo5sf7v 7 หลายเดือนก่อน

    Please help! The select manager is not working I’m using the old text.
    Thank you

  • @alisherka3697
    @alisherka3697 ปีที่แล้ว

    Can you help me pls?
    My rabbit animation is not working. I tried to put them as in the video but still its not working

  • @nickhermanns4368
    @nickhermanns4368 4 หลายเดือนก่อน

    Anyone else get the error: The type or namespace name could not be found (are you missing a using directive or an assembly reference?) with the ? In the SelectionManager script?

    • @nickhermanns4368
      @nickhermanns4368 4 หลายเดือนก่อน

      nvm, it didnt recognise the class because i didnt have the script for it yet. Fyi, get the InteractableObject script at the same time you get the SelectionManager script, then you won't get the error.

    • @AmbatukamOmaygot-bh6vd
      @AmbatukamOmaygot-bh6vd 2 หลายเดือนก่อน

      @@nickhermanns4368 Thank you man i had the same issue

  • @Dazeza
    @Dazeza 8 หลายเดือนก่อน

    Hi Mike, can you help me, if for the third person point of view the coding script part is the same as in the video or something has been changed and I direct it to the object, the writing doesn't appear like the one in the video because I use the third person point of view, is there a solution? Thank you

  • @saswatabhattacharjee7121
    @saswatabhattacharjee7121 11 หลายเดือนก่อน

    my rabbit prefabs are clipping inside the terrain any solutions? @Mike's Code

  • @fazrulnizamgmod6830
    @fazrulnizamgmod6830 8 หลายเดือนก่อน

    Can somebody help me with the missing text when i point my cursor at a tree?

  • @idk-watermelon
    @idk-watermelon 5 หลายเดือนก่อน

    I’m getting the error (interactableObject could not be found (are you missing a using directive or an assembly reference?)) any help?

    • @varindertung4591
      @varindertung4591 2 หลายเดือนก่อน

      make sure your InteractableObject script name is same as you used in the Selection Manager Script

  • @lucaselkinson3591
    @lucaselkinson3591 5 หลายเดือนก่อน

    Any fix for some sort of lag spike or frame rate drop when hovering over game objects?

  • @micmalawi
    @micmalawi ปีที่แล้ว

    Can't get the public GameObject to show in the inspector.

  • @Tix_Blox
    @Tix_Blox ปีที่แล้ว +1

    Assets\Scripts\SelectionManager.cs(28,73): error CS0246: The type or namespace name 'InteractableObject' could not be found (are you missing a using directive or an assembly reference?)
    how do i fix this??

    • @barrysrandomness
      @barrysrandomness ปีที่แล้ว

      Tix, you need to add a script for the InteractableObject. This isn't included in the description, but it is referenced in the video at 14:13.

    • @Tix_Blox
      @Tix_Blox ปีที่แล้ว +1

      @@barrysrandomness thank you for trying to help, but figured it out

    • @user-jy1lc3zz6o
      @user-jy1lc3zz6o ปีที่แล้ว

      @@Tix_Blox how?

  • @lelufti
    @lelufti ปีที่แล้ว +3

    This Interaction Info UI its doesnt there in this Script :(

    • @Sansirusp
      @Sansirusp ปีที่แล้ว +2

      Same

    • @Warp_Speed_Studios
      @Warp_Speed_Studios ปีที่แล้ว +1

      same

    • @lelufti
      @lelufti ปีที่แล้ว +1

      @@Warp_Speed_Studios how i can fix that?

    • @Warp_Speed_Studios
      @Warp_Speed_Studios ปีที่แล้ว

      @@lelufti i think you create the InteractableObject C# script

    • @lelufti
      @lelufti ปีที่แล้ว +1

      @@Warp_Speed_Studios No! i make it 100% who Mike in his Video

  • @orico2007
    @orico2007 ปีที่แล้ว

    Can I make an rotation animation because it just teleports to the other way

  • @memesaber2093
    @memesaber2093 ปีที่แล้ว

    Hi Ik this is an old video but I can’t seem to get rid of the error (10,5) The type or namespace ‘Text’ could not be found

  • @JnFunny
    @JnFunny 4 หลายเดือนก่อน +1

    If the camera fails to find the target!
    Set the camera as tag main camera !
    void Update()
    {
    Ray ray;
    if (Camera.main != null)
    {
    ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    }
    else
    {
    Debug.LogError("Main camera is not found!"); // error log
    return; // code stop
    }
    RaycastHit hit;
    if (Physics.Raycast(ray, out hit))
    {
    var selectionTransform = hit.transform;
    if (selectionTransform.GetComponent())
    {
    interaction_text.text = selectionTransform.GetComponent().GetItemName();
    Interaction_info_UI.SetActive(true);
    }
    else
    {
    Interaction_info_UI.SetActive(false);
    }
    }
    }
    }

  • @MultiDegh
    @MultiDegh ปีที่แล้ว +3

    hello Mike, great tutorial, I find myself stuck in the third tutorial,minute 9:04, i try to drag the script c# SelectionManager into the empty object of SelectionManager and the new Component is lacking one section that appears in your video, its called Reference to the object, this one doesnt appear in mine. I checked so many times the spelling and reset the scripts, erase them and made them again, restart the project and nothing, i tried all i can, will it still work without it?

    • @GaryParkin
      @GaryParkin 11 หลายเดือนก่อน +1

      If you mean the Interaction _Info_UI where he drags the text over it's because the script doesn't compile. If the script doesn't compile, the little box that's attached to the variable public GameObject interaction_Info_UI doesn't show up. I had to comment out some of the code that refereed to the InteractableObject. Drag and drop the ui text then un-comment the text again. Hope this helps. I haven't got past 9:23 yet. (sleepy time) - Also use TextMeshPro not a plain text.

  • @Mr.Auberpunt
    @Mr.Auberpunt ปีที่แล้ว

    hi i want some help i have this problim in selection manger
    { NullReferenceException: Object reference not set to an instance of an object
    SelectionManager.Update () (at Assets/Surivival/UI/scripts/SelectionManager.cs:1 }
    this is code 18
    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    can any one help pleas

  • @GeetMusic06
    @GeetMusic06 9 หลายเดือนก่อน

    hello there
    i am having a problem in the SelectionManager Script
    Firstly the pastebin link isnt working
    secondly when you drag the interaction_info_UI script to selection manager i am only able to see 1 option which is 'script' where altho we cant edit it but as in your video i am not able to see the refrence section where i can drag the interaction_info_UI.
    i tried many times tried typing the scrpit by myself, coping scripts from comments, using TextMeshProGUI,new project everything but i am stuck there
    hope you understand the problem and help me out!!

    • @Mikes-Code
      @Mikes-Code  9 หลายเดือนก่อน +1

      Well the pastbin link is working, I just tried it right now.
      Try opening it with another browser, maybe some browsers block the website or something.
      About the missiong option in the inspector, make sure that all properties are "public" and not "private" this will make them visible in the inspector.
      Following the tutorial should give the same results, but it's easy to miss something that can mess things up.

    • @GeetMusic06
      @GeetMusic06 9 หลายเดือนก่อน

      @@Mikes-Codethanks you so much mike sir,
      if will comment again on your video if anything is needed thank you for your help

  • @richardlonigro4178
    @richardlonigro4178 10 หลายเดือนก่อน

    Great tutorial! My bunny appears for a split second when I first play my game, and then immediately disappears! I'm not sure what I'm doing wrong hah.

    • @richardlonigro4178
      @richardlonigro4178 10 หลายเดือนก่อน

      I figured it out. My rabbit was falling through the world. Once I spawned the rabbit a bit higher above the terrain, it was there bouncing around being cute :D

  • @Sir_doughnut
    @Sir_doughnut 7 หลายเดือนก่อน

    Hi Mike, I have a question for the selection manager script because it says “the type or namespace“interaction-able object” could not be found” pls help

    • @robertorodriguez4304
      @robertorodriguez4304 6 หลายเดือนก่อน +1

      You need the InteractableObject Script to be "at least" in your Project folder for the selection manager to detect it and eventually attached to an object as a component for it to display the name. The code is on the description of the video.

    • @ETAFree
      @ETAFree หลายเดือนก่อน

      @@robertorodriguez4304 Thank you for your enthusiasm, bro. It saves my day.

  • @TechGamerzv2
    @TechGamerzv2 ปีที่แล้ว

    error CS0246: The type or namespace name 'Text' could not be found (are you missing a using directive or an assembly reference?)
    How to Fix Help me

    • @Mikes-Code
      @Mikes-Code  ปีที่แล้ว

      You simply need to add the UI namespace.
      Hover over the Text, click on "show potential fixes", and then click on "using UnityEngine.UI".
      or simply add "using UnityEngine.UI" at the top of the script

    • @Obliterator786
      @Obliterator786 11 หลายเดือนก่อน

      Bro i was facing the same same problem but here is solution it worked for me
      it is updated script for TextMeshPro Unity Version
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using TMPro;
      public class SelectionManager : MonoBehaviour
      {
      private TextMeshProUGUI textMeshPro;
      public GameObject interaction_Info_UI;
      TextMeshProUGUI interaction_text;
      private void Start()
      {
      textMeshPro = GetComponent();
      interaction_text = interaction_Info_UI.GetComponent();
      }
      void Update()
      {
      Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
      RaycastHit hit;
      if (Physics.Raycast(ray, out hit))
      {
      var selectionTransform = hit.transform;
      if (selectionTransform.GetComponent())
      {
      interaction_text.text = selectionTransform.GetComponent().GetItemName();
      interaction_Info_UI.SetActive(true);
      }
      else
      {
      interaction_Info_UI.SetActive(false);
      }
      }
      }
      }

  • @mr.gamersystemthundergod3012
    @mr.gamersystemthundergod3012 4 หลายเดือนก่อน

    Hello, Can you make a story dialogue tutorial? I hope you consider it since I need it for my capstone project.

    • @smokinjoe9415
      @smokinjoe9415 4 หลายเดือนก่อน +2

      Pay him a couple thousand or do it yourself, nobody is going to do your work son.

    • @mr.gamersystemthundergod3012
      @mr.gamersystemthundergod3012 4 หลายเดือนก่อน +1

      @@smokinjoe9415 did I do something to offend you? I'm not talking to you idiot. unless the owner of this video/tutorial decides it to my comment, not you. If he rejects it that's fine with me.

  • @TheCoolPersons
    @TheCoolPersons 11 หลายเดือนก่อน

    How did you get art, then ui art, then sphere? They weren't there for me, and I created art and then ui art in that, but how do i get the sphere? Also wondering how you had the rabbits in the hierarchy area

    • @Obliterator786
      @Obliterator786 11 หลายเดือนก่อน

      Bro you are using different unity version i think

    • @v_xx_official
      @v_xx_official 10 หลายเดือนก่อน +2

      it because he made those folders him self

  • @allugames8958
    @allugames8958 6 หลายเดือนก่อน

    It all works after i got a bunch of errors and tried again but my fps got 6 times worse

    • @allugames8958
      @allugames8958 6 หลายเดือนก่อน

      nevermind. i resetted the game and it started workin again

  • @Fortkitty
    @Fortkitty ปีที่แล้ว +1

    [SOLUTION IN REPLY] Getting an object reference nullreference exception error:
    NullReferenceException: Object reference not set to an instance of an object
    SelectionManager.Update () (at Assets/Scripts/SelectionManager.cs:19)
    this is line 19: Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    pls help

    • @Fortkitty
      @Fortkitty ปีที่แล้ว +6

      Hey for anyone else having this issue I fixed it!
      It was because I deleted my main camera, to fix this make a new camera and then set the tag to MainCamera in inspector!

    • @obiwancanosi
      @obiwancanosi ปีที่แล้ว

      @@Fortkitty Should I rename my main camera to MainCamera ? I dont understand it would you help me ?

    • @obiwancanosi
      @obiwancanosi ปีที่แล้ว +1

      I found it thx, it means a lot to me :)

    • @notgager7290
      @notgager7290 11 หลายเดือนก่อน

      thanks man, been pulling my hair out for fucking hours over this lol

    • @rrrzzz7801
      @rrrzzz7801 10 หลายเดือนก่อน +1

      @@Fortkittythank u!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @joecraft9098
    @joecraft9098 ปีที่แล้ว

    Bit of help here-
    Assets\Scripts\SelectionManager.cs(9,5): error CS0246: The type or namespace name 'Text' could not be found (are you missing a using directive or an assembly reference?)

    • @sethluca
      @sethluca ปีที่แล้ว

      change all Text references to TextMeshProUGUI

    • @mikeyororke9114
      @mikeyororke9114 ปีที่แล้ว

      @@sethluca that’s not working anything else I can try

    • @user-zh2dl4vw9k
      @user-zh2dl4vw9k ปีที่แล้ว +1

      @@mikeyororke9114 add: using UnityEngine.UI; to the top of the selection manager script

  • @LunaticOnPixiv
    @LunaticOnPixiv 7 หลายเดือนก่อน

    When I tried to use the SelectionManager script it said "interactableObject" was missing.
    Any idea how to fix this?(all the other scripts worked fine though)
    Any help or a copy/paste script would be appreciated, thanks in advance.

    • @robertorodriguez4304
      @robertorodriguez4304 6 หลายเดือนก่อน +1

      You need the InteractableObject Script to be "at least" in your Project folder for the selection manager to detect it and eventually attached to an object as a component for it to display the name. The code is on the description of the video.

    • @firecreeper9059
      @firecreeper9059 6 หลายเดือนก่อน

      ​@@robertorodriguez4304OMG TYSM!!!
      I didn't wanna go farther in the video until I figured it out XD
      Though I should have realized, again, tsym

  • @Hiddenruins2
    @Hiddenruins2 3 หลายเดือนก่อน

    hey i am confused on how i can do the SelectionManager scripts. I don't know how to do it

    • @Leaks_the_vegetable
      @Leaks_the_vegetable 2 หลายเดือนก่อน

      If you are having trouble with the selection script you first also have to have the interactable object scripts

    • @Hiddenruins2
      @Hiddenruins2 2 หลายเดือนก่อน +1

      @@Leaks_the_vegetable oh ok thanks!

  • @ZenGaming6000
    @ZenGaming6000 ปีที่แล้ว

    hi im getting this error with selection manager can anyone help please?
    Assets\Scripts\SelectionManager.cs(6,33): error CS0246: The type or namespace name 'MonoBehaviour' could not be found (are you missing a using directive or an assembly reference?)

    • @tenzindayoe5783
      @tenzindayoe5783 ปีที่แล้ว +1

      It seems like you are not importing unity engine in your code. Add this on the beginning of the SelectionManager.cs :
      Using UnityEngine;

    • @Obliterator786
      @Obliterator786 11 หลายเดือนก่อน

      Here is updated script
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using TMPro;
      public class SelectionManager : MonoBehaviour
      {
      private TextMeshProUGUI textMeshPro;
      public GameObject interaction_Info_UI;
      TextMeshProUGUI interaction_text;
      private void Start()
      {
      textMeshPro = GetComponent();
      interaction_text = interaction_Info_UI.GetComponent();
      }
      void Update()
      {
      Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
      RaycastHit hit;
      if (Physics.Raycast(ray, out hit))
      {
      var selectionTransform = hit.transform;
      if (selectionTransform.GetComponent())
      {
      interaction_text.text = selectionTransform.GetComponent().GetItemName();
      interaction_Info_UI.SetActive(true);
      }
      else
      {
      interaction_Info_UI.SetActive(false);
      }
      }
      }
      }

  • @Matthew-Liu09
    @Matthew-Liu09 9 หลายเดือนก่อน

    when they stop they hit their head and they fall and sometimes they are floating

    • @arkerirulat
      @arkerirulat 8 หลายเดือนก่อน

      Box collider very big.

  • @FlamberetElg
    @FlamberetElg ปีที่แล้ว

    PLS HELP GUYS!!!!!!!!!!!!!!!!!!!!
    I have a problem with the script, mine says:
    Assets\Scripts\SelectionManager.cs(25,49): error CS0246: The type or namespace name 'InteractableObject' could not be found (are you missing a using directive or an assembly reference?)
    how do i fix this?

    • @psychologe112
      @psychologe112 ปีที่แล้ว +1

      you have to put an extra script into the object likes trees he mention this later in the video but have not uploadet the script. so look full video then try it again.

    • @FlamberetElg
      @FlamberetElg ปีที่แล้ว

      Ok i Will try that, thx!

  • @dimitarnikolov9570
    @dimitarnikolov9570 ปีที่แล้ว

    l really need help when l klick right butten and go to "UI" l dont have "text" can someone tell me why

    • @Obliterator786
      @Obliterator786 11 หลายเดือนก่อน

      Bro because we are using different unity version there is textMeshPro if you want script for textMeshPro i can provide you ❤

    • @Obliterator786
      @Obliterator786 11 หลายเดือนก่อน

      Here is updated script
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using TMPro;
      public class SelectionManager : MonoBehaviour
      {
      private TextMeshProUGUI textMeshPro;
      public GameObject interaction_Info_UI;
      TextMeshProUGUI interaction_text;
      private void Start()
      {
      textMeshPro = GetComponent();
      interaction_text = interaction_Info_UI.GetComponent();
      }
      void Update()
      {
      Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
      RaycastHit hit;
      if (Physics.Raycast(ray, out hit))
      {
      var selectionTransform = hit.transform;
      if (selectionTransform.GetComponent())
      {
      interaction_text.text = selectionTransform.GetComponent().GetItemName();
      interaction_Info_UI.SetActive(true);
      }
      else
      {
      interaction_Info_UI.SetActive(false);
      }
      }
      }
      }

  • @swatioswal6249
    @swatioswal6249 3 หลายเดือนก่อน

    Can anyone please write me the whole code of intractable objects

    • @ETAFree
      @ETAFree หลายเดือนก่อน

      link at desription