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

Поделиться
HTML-код
  • Опубликовано: 25 дек 2024

Комментарии • 49

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

  • @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 9 месяцев назад

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

  • @ern3922
    @ern3922 Год назад +2

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

  • @uduarteextras
    @uduarteextras 9 месяцев назад

    De onde você tirou o som da porta?

  • @handiirawan4439
    @handiirawan4439 2 года назад +2

    where am i can download this assets?

  • @sioswolff8896
    @sioswolff8896 2 года назад

    Thank you :D

  • @uduarteextras
    @uduarteextras 9 месяцев назад

    where did you get the sound of the door?

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

  • @SimeonKoller
    @SimeonKoller 9 месяцев назад

    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?

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

  • @28.nguyenvanhuy73
    @28.nguyenvanhuy73 8 месяцев назад

    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 5 месяцев назад +1

    how to open animation set new state, not a DoorOpen

  • @donilofreedom692
    @donilofreedom692 2 года назад

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

  • @kyo1152
    @kyo1152 19 дней назад

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

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

  • @SsjSaucy
    @SsjSaucy Год назад +3

    the animation doesn't work for me

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

  • @gamewithansh
    @gamewithansh Год назад +1

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

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

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

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

  • @SIS_GAMER
    @SIS_GAMER 5 месяцев назад +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

  • @furkanturkylmaz3781
    @furkanturkylmaz3781 5 месяцев назад

    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 2 месяца назад

    Can i get the fps script

  • @user.-795
    @user.-795 3 года назад +5

    No script??

    • @SimeonKoller
      @SimeonKoller 9 месяцев назад

      in description at the bottom (:

  • @barzanfuntime6486
    @barzanfuntime6486 7 месяцев назад

    Pls project link

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