Open Door with Key Press C# in Unity 3D. Survival Game Lesson5

Поділитися
Вставка
  • Опубліковано 30 жов 2024

КОМЕНТАРІ • 49

  • @OmarMolina98
    @OmarMolina98 2 роки тому +6

    you totally forgot the option to close the door

    • @DIGAHub
      @DIGAHub  2 роки тому +6

      Yes, totally forgot to add that option in this!! To close the door, the easiest way is, at 2:15 in this video, to extend the "DoorOpen" animation, and add more frames to create the close door animation. For example, from 0 - 1 second is open door animation, 1 - 4 second is keeping the door open, 4 - 5 second is close door animation. That way, you don't have to change anything in this script, and the door will automatically shut after it has been opened for 3 seconds.

    • @soulbringer8435
      @soulbringer8435 2 роки тому

      @@DIGAHub But if we wish to close it using the "E" button , what will we add or change in the script ?

    • @worldcup202-6o
      @worldcup202-6o Рік тому

      @@DIGAHub How to open door with a key , if you have a key

  • @korosenseicomics
    @korosenseicomics Рік тому +1

    I spent the whole day trying to make a functional door, your tutorial was the only one that worked. Thanks

  • @SimeonKoller
    @SimeonKoller 7 місяців тому

    Hey DIGA Hub i have a question. When i open the door and it closes again (I have made it so it also closes in the animation) It's shows the option Press (E) to open but i does not open again could you help me out here?

  • @kaaasis
    @kaaasis 3 роки тому +4

    Very nice would've been even better if you added the code in the description so people could quickly copy it.
    And could you make it so I can close the same door

    • @SimeonKoller
      @SimeonKoller 7 місяців тому

      its in the description u just have to scroll down a bit (:

  • @28.nguyenvanhuy73
    @28.nguyenvanhuy73 6 місяців тому

    hi, i have some problem that is when i copy and put in another location. When I play, when I press both doors open at the same time and I use raycas instead of keycode

  • @heixiao5690
    @heixiao5690 Рік тому +2

    Sir, I had a problem, I followed your tutorial in doing the door but when I try the second door, it wont open but just disappear and my first door cant be open anymore..... may I ask for sir help?

  • @federicorenkine4340
    @federicorenkine4340 Рік тому +1

    Nice videoo,
    but you could rather call a Coroutine when the collision is triggered, and stop it when is exited. This way unity will only be checking wether the E key is being pressed if the player is on range, and not in every single frame of the game.

  • @ern3922
    @ern3922 Рік тому +1

    When I open the door for the first time, everything works but I can't open it for the 2nd time.

  • @handiirawan4439
    @handiirawan4439 2 роки тому +2

    where am i can download this assets?

  • @sioswolff8896
    @sioswolff8896 2 роки тому

    Thank you :D

  • @uduarteextras
    @uduarteextras 7 місяців тому

    where did you get the sound of the door?

  • @donilofreedom692
    @donilofreedom692 Рік тому

    So... you can open this door even if you don't look at it?

  • @uduarteextras
    @uduarteextras 7 місяців тому

    De onde você tirou o som da porta?

  • @ACtudio001
    @ACtudio001 Рік тому

    Hello DIGA hub. I have a problem, when i press E the door opens even when you are not in the trigger, how can i fix that?

    • @DIGAHub
      @DIGAHub  Рік тому

      Hi there! In the script, two conditions must be met to open the door: (1) Player is in the trigger, (2) Player pressed "E" key. See this tutorial at 10:17. At Void Update line, if "Input GetKeyDown" (pressed E key), and if "Action is true" (player is in the trigger), the door would open. Double check your script and you should be able to solve this issue.

  • @SIS_GAMER
    @SIS_GAMER 3 місяці тому +1

    how to open animation set new state, not a DoorOpen

  • @gamewithansh
    @gamewithansh Рік тому +1

    please help me some budy i am getting this error
    ArgumentNullException: Value cannot be null.
    Parameter name: source

  • @SsjSaucy
    @SsjSaucy Рік тому +2

    the animation doesn't work for me

  • @saniyakhansaniyakhan9076
    @saniyakhansaniyakhan9076 Рік тому +1

    Can Someone please help my first door is opening but the second door when i press E just disapear and the first door open automatically

    • @DIGAHub
      @DIGAHub  Рік тому +1

      It sounds like something is wrong after you did copy and paste. Your first door is fully functioning so that's good. I recommend just delete the second door group. Select the first door group (the whole GROUP containing the door and the trigger), duplicate it, and move it to the new location. Refer to the video to see how I group the door with its trigger. If you copy and paste it correctly, your second door should working without any issue.

    • @saniyakhansaniyakhan9076
      @saniyakhansaniyakhan9076 Рік тому

      @@DIGAHub Brother can plz plz plz pleasss make a video now on this. how to open doors in unity using c# plz bro.

    • @itsAJ819
      @itsAJ819 Рік тому

      @@DIGAHub Mine just disappears on the first one lol.

  • @SIS_GAMER
    @SIS_GAMER 3 місяці тому +1

    i have some questions for you,
    1. why my door is not animation but play sound
    2. why my door is not animation but play sound
    3. why my door is not animation but play sound
    4. why my door is not animation but play sound
    5. why my door is not animation but play sound

  • @sola5110
    @sola5110 2 роки тому

    Do I have to make a new animation if each door has a different shape? Can't you copy it?

    • @DIGAHub
      @DIGAHub  2 роки тому

      No, you don't have to create a new animation for new door with different shapes. The animation was create on a cube (see 1:23) and the door model was parented to the cube. That means that you can simply duplicate this whole door group ("DoorV1" in the video), place it at a different location, replace the door model under the cube. Your can also duplicate the DoorOpenTrigger, but remember to change the "Anime Object" to the new door (see 13:24).

  • @GabrielLopes-ou3ji
    @GabrielLopes-ou3ji Рік тому

    The door open but closes right after and i cant open it ever again unless i restart. Any ideas? I havent changed the script

  • @furkanturkylmaz3781
    @furkanturkylmaz3781 4 місяці тому

    Bro where is UI? In my unity version there is UI KIT

  • @bojanmileski6541
    @bojanmileski6541 2 роки тому +2

    Hey this stupid door rotates in center instead being attached to the cube and the cube rotating on its center

  • @DpzSpyGaming
    @DpzSpyGaming 17 днів тому

    Can i get the fps script

  • @barzanfuntime6486
    @barzanfuntime6486 5 місяців тому

    Pls project link

  • @user.-795
    @user.-795 3 роки тому +5

    No script??

    • @SimeonKoller
      @SimeonKoller 7 місяців тому

      in description at the bottom (:

  • @saniyakhansaniyakhan9076
    @saniyakhansaniyakhan9076 Рік тому

    Brother can plz plz plz pleasss make a video now on this. how to open doors in unity using c# plz bro.

  • @mackas_3213
    @mackas_3213 2 роки тому

    Great tutorial! But how to open double sides door? :D

    • @mackas_3213
      @mackas_3213 2 роки тому

      Solved! Just added "public GameObject AnimeObject2;" and put the second doors in there

    • @DIGAHub
      @DIGAHub  2 роки тому

      @@mackas_3213 Yes, that will replicate the animation.

  • @ncsmccalihan9801
    @ncsmccalihan9801 2 роки тому

    Where is this so called presskey script? I followed every other step.

    • @DIGAHub
      @DIGAHub  2 роки тому

      You can download it here: drive.google.com/file/d/1axYKr394qoI4utodY-Jyi6-3iyXkPQ6S/view?usp=share_link

  • @TheBrunoRM
    @TheBrunoRM 3 роки тому

    C++? Unity uses C#