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

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ม.ค. 2025

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

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

    you totally forgot the option to close the door

    • @DIGAHub
      @DIGAHub  3 ปีที่แล้ว +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 2 ปีที่แล้ว

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

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

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

    • @DIGAHub
      @DIGAHub  2 ปีที่แล้ว

      Glad it helps!

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

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

  • @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 10 หลายเดือนก่อน

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

  • @28.nguyenvanhuy73
    @28.nguyenvanhuy73 9 หลายเดือนก่อน

    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

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

    how to open animation set new state, not a DoorOpen

  • @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?

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

    where did you get the sound of the door?

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

    the animation doesn't work for me

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

    where am i can download this assets?

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

    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?

  • @federicorenkine4340
    @federicorenkine4340 2 ปีที่แล้ว +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.

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

    De onde você tirou o som da porta?

  • @sioswolff8896
    @sioswolff8896 2 ปีที่แล้ว

    Thank you :D

  • @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 ปีที่แล้ว +1

      @@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.

  • @donilofreedom692
    @donilofreedom692 2 ปีที่แล้ว

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

  • @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.

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

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

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

      I'm having the same problem did you ever figure it out?

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

    its automatically disabling the Text when i touch the collider it doesnt show the text

    • @daily_whatwouldyourather
      @daily_whatwouldyourather 20 วันที่ผ่านมา

      Make sure your player has the tag 'Player'. This worked for me

  • @SIS_GAMER
    @SIS_GAMER 6 หลายเดือนก่อน +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

  • @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

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

      Did u figure it out?

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

      If so could you pls tell me

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

    Pls project link

  • @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).

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

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

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

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

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

    Can i get the fps script

  • @user.-795
    @user.-795 3 ปีที่แล้ว +5

    No script??

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

      in description at the bottom (:

  • @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#