3 Ways to Open Doors in Unity!

🎮 Submit your Game Idea for a chance to win $25,000! www.ultimategameidea.com #Fiverr
✅ Get the Project files and Utilities at unitycodemonkey.com/video.php...
Let's look at 3 ways we can Open and Close Doors in Unity, next we're going to look at 4 methods we can interact with our Doors.
Sponsored by Fiverr.
I made a Top-Down Shooter in 7 Days!
• I made a Top-Down Shoo...
Character Controller in Unity 2D! (Move, Dodge, Dash)
• Character Controller i...
Simple Key Door System in Unity
• Simple Key Door System...
Sprite Outline (Animated!) - 2D Shader Graph Tutorial
• Sprite Outline (Animat...
If you have any questions post them in the comments and I'll do my best to answer them.
🔔 Subscribe for more Unity Tutorials / @codemonkeyunity
See you next time!
📍 Support on Patreon / unitycodemonkey
🤖 Join the Community Discord / discord
📦 Grab the Game Bundle at unitycodemonkey.com/gameBundl...
📝 Get the Code Monkey Utilities at unitycodemonkey.com/utils.php
#unitytutorial #unity3d #unity2d
--------------------------------------------------------------------
Hello and welcome, I am your Code Monkey and here you will learn everything about Game Development in Unity 2D using C#.
I've been developing games for several years with 7 published games on Steam and now I'm sharing my knowledge to help you on your own game development journey.
You can see my games at www.endlessloopstudios.com
--------------------------------------------------------------------
- Website: unitycodemonkey.com/
- Twitter: / unitycodemonkey
- Facebook: / unitycodemonkey

Пікірлер: 85

  • @CodeMonkeyUnity
    @CodeMonkeyUnity4 жыл бұрын

    Here's 3 ways to Open and Close Doors and in the next video we're going to look at 4 methods to interact with them! 🎮 Submit your Game Idea for a chance to win $25,000! www.ultimategameidea.com

  • @Palerider1011
    @Palerider10114 жыл бұрын

    More stuff like this please!!! Two years into this, and I'm just now finding out about hinge joints. Man, I need to study more.

  • @Creere
    @Creere4 жыл бұрын

    I love this Gordon Freeman xD

  • @Oxmond
    @Oxmond4 жыл бұрын

    Awesome! 👍🤓

  • @PedroJaimeCostaPereira
    @PedroJaimeCostaPereira4 жыл бұрын

    Amazing video, thanks.

  • @grimseal
    @grimseal4 жыл бұрын

    First :) Thanks for your videos!

  • @manicmillennial3287
    @manicmillennial32874 жыл бұрын

    Thank you! :)

  • @kankanaroy285
    @kankanaroy2854 жыл бұрын

    Cool!

  • @CurvedVacuum
    @CurvedVacuum4 жыл бұрын

    Nice work :) You could make the 3 doors implement an interface containing OpenDoor / CloseDoor, change DoorTriggerButton's door property type to the interface then no mod of the DoorTriggerButton script is needed (just drag a different door type on in the inspector)

  • @Mr-Anub
    @Mr-Anub3 жыл бұрын

    @codeMonkey - Hey, any chance you consider re-doing these for the new Input System? Im trying to start a new project in it, but aside from movement tutorials, there are no other tutorials on simple stuff like how to force button A to play animations or interact with anything :/ for a non-coder like me it's hell :/

  • @lokesh4847
    @lokesh48472 жыл бұрын

    @codemonkey 2 & 3 models are not working. There is no error. Anyone please help me. When i press key, it not working.

  • @Cretaal
    @Cretaal4 жыл бұрын

    Thanks for the quality videos. Could you possibly do "3 ways to swing swords in unity"? I know it'll be similar to the projectiles video, but I'm sure a few of us need help on the subject, me especially.

  • @marcosengelhard5456
    @marcosengelhard54564 жыл бұрын

    Great video! Could you make a video where you can make about a tutorial about healing (Just like Medic from TF2 or even Mercy from Overwatch). I'm excited to see the 4 methods we can interact with our doors :)

  • @rysiiyt86

    @rysiiyt86

    4 жыл бұрын

    Nice idea

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    4 жыл бұрын

    Actually a long time ago one of the first videos on the channel was making the Demoman from TF2 and right after that I was going to do the Medic but ended up doing other things. I guess I might go back to try that!

  • @alexkrat5562
    @alexkrat55622 жыл бұрын

    Hi, I got issue with first most simple door. Its not become active after pressing "G" button. There no errors in console and i check whole code in scripts few times. Where bug can be ? Also i tried to set door active without first script. And it works, door dissappeered. But dont want to appear Thx in advance

  • @alexkrat5562

    @alexkrat5562

    2 жыл бұрын

    Upd: because i decided to use door object without empty parental obj, after set it in inactive, it cant be turned on (activated by button). Thats all

  • @KingLiakos
    @KingLiakos4 жыл бұрын

    Could you do a 2d series? Fighting looting and bosses like a metroidvania thanks a lot for your videos

  • @lokesh4847
    @lokesh48472 жыл бұрын

    Help. Door not working (1st model) When i press F to open door. It's working. When i press G, the door not closing (door game object not active). DoorSetActive public void OpenDoor() { ganeObject.SetActive(false); } public void CloseDoor() { gameObject.SetActive(true); } DoorTriggerButton [SerializeField] private DoorSetActive door; private void Update() { if (Input.GetKeyDown(KeyCode.F)) { door.OpenDoor(); } if (Input.GetKeyDown(KeyCode.G)) { door.CloseDoor(); }

  • @evanraab2104
    @evanraab21042 жыл бұрын

    great video! how would you go back using the second method if you have multiple of the same type of door in a scene? maybe I did something wrong but no matter where I place any door in the scene, they all end up at the position of the animation at the start of the scene.

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    2 жыл бұрын

    Make sure when you record an animation you only move the child objects and never the parent. That way the parent can be placed anywhere and the child objects will still animate as intended. Animations record their local position

  • @evanraab2104

    @evanraab2104

    2 жыл бұрын

    @@CodeMonkeyUnity thank you so much!

  • @alirasheed3236
    @alirasheed32364 жыл бұрын

    Please make a video on 2d ropes and one for multiplayer setup with photon THANKS

  • @ZaCkOX900
    @ZaCkOX9004 жыл бұрын

    There are many ways to do doors that also aren't in this video. Sadly I am chronically sick and spent weeks making doors many ways. I would often lay down and continue after. The best reliable doors from all testing I did are collider bound intersect doors. I made doors work with slow motion and and speed slow smotion changes between doors. I also did blender shape key doors which gives awesome effects you cannot normally get.

  • @oldcat1790

    @oldcat1790

    4 жыл бұрын

    Well, if you upload your work somewhere, I'm sure many people will be happy to take a look at your solutions.

  • @ChozoNomad
    @ChozoNomad4 жыл бұрын

    I'm having an issue where the close animation is playing as the level spawns. Like the door spawns open then the close animation plays out. Not sure how to fix that so the door spawns in already closed :/

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    4 жыл бұрын

    Add an Idle State that contains a 1 frame animation of the door completely closed and start with that one

  • @ChozoNomad

    @ChozoNomad

    4 жыл бұрын

    Code Monkey hey, thanks!

  • @ChozoNomad

    @ChozoNomad

    4 жыл бұрын

    Code Monkey say, you wouldn’t happen to have a tutorial somewhere about having a door open in response to a particle collision even, a la Metroid, would you? I spent all day yesterday trying to suss out a script, but nothing seemed to work :/

  • @casachezdoom2588
    @casachezdoom25883 жыл бұрын

    I can't seem to be able to drag my Door onto the Door reference "None (Door Set Active)" on Door Trigger Button (Script)... :(

  • @sjsndm3072

    @sjsndm3072

    Жыл бұрын

    Hey, Im having the same problem, does anyone know what to do?

  • @ryanvislosky7170

    @ryanvislosky7170

    Жыл бұрын

    @@sjsndm3072 I had the same issue. remember to add your "Door Active Script" to the door Game Object. it worked after that

  • @franciscoalonso8302
    @franciscoalonso83024 жыл бұрын

    Thanks. Great video. A question though: why the need for writing [SerializeField] before DoorSetActive if that class is already public? I just wrote in my code "public DoorSetActive door;" and it worked just the same. Is there a reason for using [SerializeField]? (Disclaimer: I am just a beginner in coding). Thank you again!

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    4 жыл бұрын

    Yup, if your field is already marked as public then you don't need [SerializedField] You only need it when you want to expose a private field in the editor.

  • @franciscoalonso8302

    @franciscoalonso8302

    4 жыл бұрын

    @@CodeMonkeyUnity Thanks for your answer

  • @dontCallMe..
    @dontCallMe..11 ай бұрын

    But how can i make multiple ones??

  • @MCShvabo
    @MCShvabo2 жыл бұрын

    Will this tutorial work in 3D & 3rd person game?

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    2 жыл бұрын

    Yes just swap the door sprite for a door mesh

  • @rad9587
    @rad95874 жыл бұрын

    Hi, can you make a camera like in don't Starve?

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    4 жыл бұрын

    I'm actually working on something very similar to that perspective right now! Stay tuned!

  • @rad9587

    @rad9587

    4 жыл бұрын

    @@CodeMonkeyUnity Wow I'm glad

  • @abhishekkumawat91
    @abhishekkumawat914 жыл бұрын

    how can i make the 2d game smoother without changing the codes? Thank you very much for your hard work to help us.

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    4 жыл бұрын

    You mean performance? Depends on what you're doing, check the Profiler to see where your hotspots are.

  • @abhishekkumawat91

    @abhishekkumawat91

    4 жыл бұрын

    @@CodeMonkeyUnity thanks for the help but sorry bro i don't know how to use profiler? can you tell me how to use it to optimise the game?

  • @adityavarma2145
    @adityavarma21453 жыл бұрын

    Hey Code Monkey, Your videos have great content but why are you skipping the part where unchecking "Has exit time" in animated doors?????

  • @adrianalomia9089
    @adrianalomia90893 жыл бұрын

    I have two errors when playing (after having finished everything) NullReferenceException: Object reference not set to an instance of an object DoorAnimated.OpenDoor () (at Assets/Scripts/Doors/DoorAnimated.cs:16) DoorTriggerButton.Update () (at Assets/Scripts/Doors/DoorAnimated.cs:13) NullReferenceException: Object reference not set to an instance of an object DoorAnimated.CloseDoor () (at Assets/Scripts/Doors/DoorAnimated.cs:22) DoorTriggerButton.Update () (at Assets/Scripts/Doors/DoorAnimated.cs:17) I was reviewing it and I don't know what it is.

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    3 жыл бұрын

    Use Debug.Log to find out what is null kzread.info/dash/bejne/Z52m2JVpXcW6eto.html

  • @ayoubbelatrous8080
    @ayoubbelatrous80804 жыл бұрын

    remember me of channel do videos about how to do anything in 50 diffrent ways

  • @nico_crowned
    @nico_crowned3 жыл бұрын

    For one door it works fine, but when duplicating the door, every time i press the button, they all open ... if I have 10 doors, should I create a different animation and script for each one ??? How can I make this process more efficient?

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    3 жыл бұрын

    You don't need a different animation for each one, sounds like you're using some duplicate references somewhere. Each door should be a separate object and the player should only interact with that door.

  • @nico_crowned

    @nico_crowned

    3 жыл бұрын

    @@CodeMonkeyUnity But .. will I have to create a different script for each one? because ... if I tell it to open when pressing the "f" key and all doors have the same code, logically they will open at the same time ... How can I make it open only the one in front of the character without having to do 10 scripts for 10 doors ?? Sorry, I'm still learning ... thanks for your quick response by the way !!

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    3 жыл бұрын

    @@nico_crowned You need to add some sort of distance logic to only affect the doors within range, watch this video kzread.info/dash/bejne/dH5oxLB_gNiqh6Q.html

  • @striverfor7628
    @striverfor7628 Жыл бұрын

    0:37 2:09 Back to the video

  • @indracode7
    @indracode74 жыл бұрын

    Can you make video tutorial puzzle hidden object game please.

  • @jakovannic3440
    @jakovannic34404 жыл бұрын

    In what program do you draw your art

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    4 жыл бұрын

    I draw it in Photoshop

  • @jakovannic3440

    @jakovannic3440

    4 жыл бұрын

    Thanks because you draw realy great art

  • @antoll3091
    @antoll30914 жыл бұрын

    Only me cannot copy the OpenDoor animation ? Please help me !

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    4 жыл бұрын

    What can't you copy? It just plays the Animation in the Animator

  • @linguinichannel
    @linguinichannel4 жыл бұрын

    What do you use to make games??

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    4 жыл бұрын

    This is made in Unity

  • @macfrazer4052
    @macfrazer4052 Жыл бұрын

    why dont u use this intro song on your videos now i like this song

  • @maistrogaming7911
    @maistrogaming79114 жыл бұрын

    That what I call a video....

  • @jakanater7763
    @jakanater77633 жыл бұрын

    my door doesnt show in game view

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    3 жыл бұрын

    Check the Z position

  • @casachezdoom2588

    @casachezdoom2588

    3 жыл бұрын

    Might be the Order in Layer, make sure its number is higher than your background (background was probably set to 0 by default, so try a number above 0 like 1, 2, or 10 just to try)

  • @supercoloraby8460
    @supercoloraby84603 жыл бұрын

    I got an email from unity, recommending your video.

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    3 жыл бұрын

    Really? That's interesting!

  • @supercoloraby8460

    @supercoloraby8460

    3 жыл бұрын

    yes!

  • @jakanater7763
    @jakanater77633 жыл бұрын

    who else did it appear in game view but when you press play its not there

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    3 жыл бұрын

    The sprite isn't visible in game view? Check the Z position

  • @jakanater7763

    @jakanater7763

    3 жыл бұрын

    @@CodeMonkeyUnity thanks but it didnt work my door shows up in game view but when I start the game and test it it isnt there

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    3 жыл бұрын

    @@jakanater7763 What didn't work? The door isn't visible even with Z = 0? If so then maybe you put the door on a different Layer and your camera isn't rendering that layer. Or are you simply destroying the door? Does it exist in the hierarchy when playing?

  • @ibrahimrashwan
    @ibrahimrashwan4 жыл бұрын

    So I send them the idea and they make it for me that really kills all the fun of creating your game and also you cannot call it YOUR game any more you are not the one who made it

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    4 жыл бұрын

    You're supposed to be involved in every step of the way, not just submit an idea and someone makes it. You send the idea and if you're one of the finalists you get $1000 and some help to turn that idea into a better version and then you might win $25000 to finish it.

  • @benhoughton1736
    @benhoughton17363 жыл бұрын

    I hate in-video adverts!

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    3 жыл бұрын

    Check out KZread premium for an ad-free experience or support on Patreon

  • @brewstewfilms8752
    @brewstewfilms87524 жыл бұрын

    Second

  • @abdosarmini
    @abdosarmini4 жыл бұрын

    Why first 5 minutes is intro?? Too long

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    4 жыл бұрын

    What do you mean? The intro is 20s and the sponsor is 60s, then you have 1200s of excellent learning content.

  • @a.labyad1473
    @a.labyad14734 жыл бұрын

    /////// // // // ///////

  • @sansavatar5929
    @sansavatar59294 жыл бұрын

    THREE ways ?? It's illegal

  • @folkenberger
    @folkenberger4 жыл бұрын

    Thank you, now i can make my own Nazi game