How to OPEN A DOOR With KEY in UNITY - Easy Tutorial

preview_player
Показать описание
In this video, you will learn how to make a door openable by collecting a key object, which can be something other, like a cylinder or a cube. The door will be animated every time the player approaches it. The door will only work if the player collects the key.

To open a door in Unity, you need to collect a key. You need to create a simple cylinder object (or any other) and possibly assign a material with the color (as you like). Then you have to resize it to the size that is slightly smaller than the player. Unlike the previous tutorial, this time you need to only add a script to the key object, which is pretty straightforward.

Add a simple script that will open the door once the key is collected. Don't destroy the key before opening the door! Put that line of code at the last part of the brackets.

If you find this video helpful, consider subscribing. I will make videos every week. Lastly, I will make more game development tutorials and other content related to game industry. These videos will help beginner game developers become better and make amazing games. There will be more videos related to 3D platformer, 2D platformer and other game dev related content.

Support the Creator of Kozmobot on the social networks!

Рекомендации по теме
Комментарии
Автор

nice nice. keep making more tutorials . we need it

__Rizzler__
Автор

Whatever is set in the keys code dissapears the second i hit start how do i fix it?

MrGamingChair
Автор

Please help, I used the script and now the game is laggy The door is breaking my game and the key is flying away from the player I don’t know what’s happening and my computer is getting really hot please help me fix the issue unity tells me it’s something on my computer, but I know it’s lying to me just to be mean please help the door attacks the player and the key flies away

ToiletMemesGuyThing
Автор

I bought a computer from amazon for $95 it said it had a rtx 4090, and a core I 7, but on my computer it says core I 1 which i think is even better because of the lover number. also my computer had a GT730 4GB DDR3 Graphics Card HD+VGA+DVI Game graphics card. But once again i think its better because it has more numbers and letters. It was a really good deal, and i know what you may be thinking, but it runs really good actually. It cant run any games, but it runs google chrome like a boss. It takes only 55 seconds to open google, and can hoild up to 4 tabs before crashing. I hope you can help me, Thank you for everything.

ToiletMemesGuyThing
Автор

Nice, but can you give me the script here?

average_guy
Автор

i dont know why my door disapear, but when i grab my key the door apear

luzbel
join shbcf.ru