OPENING a DOOR in UNITY on TRIGGER EVENT

  Рет қаралды 110,006

SpeedTutor

SpeedTutor

3 жыл бұрын

In this Unity C# tutorial I show you how to animate a door, interact with it to open and close with animation using a basic trigger event script. I show you how to set the pivot, create the animation, write the scripts and then implement a fully open/close door feature!
➡️Playing and Creating Animations: • Creating SIMPLE Animat...
➡️Creating a Crosshair UI: • Creating a Crosshair i...
➡️Door Interaction Kit: • Door Interaction Kit -...
➡️Check out the FREE tutorials here:
➡️Basic Raycast Door: • INSPECT System Tutoria...
➡️Trigger Door: • INSPECT System Tutoria...
➡️Raycast Button Raycast Door - • OPENING a DOOR using a...
➡️Key Open Door Raycast - • OPENING a DOOR with a ...
➡️Hinge Door - • Creating a HINGE DOOR ...
➡️Door Sounds: • Door SOUNDS in Unity |...
🎁 Get OVER 220+ Scripts, Projects and premium content on my PATREON HERE:
➡️bit.ly/SpeedTutorPatreon
·························································································
➡️(My Game) Left Alone on Steam: tinyurl.com/LeftAlone2024
🔥SpeedTutor Unity Store: bit.ly/STUnityStorePuzzlePacks
🔥 INSANE UNITY SAVINGS: bit.ly/UnitySalesHub
🕹️Unity Sales: bit.ly/UnitySalesHub
🕹️Quick-Start Bundle: bit.ly/UnityQuickStartBundle
🕹️Weekly Publisher Sale (+FREE Asset): bit.ly/WeeklyPublisherSale
🕹️Unity New Release Discount Sale: prf.hn/l/BdvEmg3
🔥 INSANE HUMBLE SAVINGS: bit.ly/HumbleBundleDeals
🕹️Learn To Code Bundle: tinyurl.com/CompleteLearnToCod...
🕹️UE5 Game Making Tutorials: tinyurl.com/MakeGamesUE5Bundle
🔥 FANATICAL GAMEDEV BUNDLES: bit.ly/FanaticalGameDevBundles
🕹️Fanatical Bundle Savings (+20% OFF): bit.ly/FanaticalProgrammersDa...
🕹️Low Poly Unity Bundle: bit.ly/FanaticalLowPolyBundle
🕹️RPG Game Builder Assets: bit.ly/FanaticalRPGGameAssets
🕹️Unity-Unreal-Godot eLearning Bundle: bit.ly/MassiveUnityCodingGame...
🔥Synty Discounts & Savings: bit.ly/SyntyLowPolyAssets
🔥Unity Pro Deals: bit.ly/UnityProDeals
🔥Topcashback: bit.ly/TopcashbackReferral
·························································································
💰BIG DISCOUNTS on my website, for my UNITY ASSETS:
➡️www.speed-tutor.com
💬Join the Community Discord:
➡️ / discord
💝 Make a donation to the channel:
➡️www.paypal.me/speedtutor
·························································································
⬇️ SpeedTutor Puzzle Assets:
➡️Unity Store: bit.ly/STUnityStorePuzzlePacks
➡️My Website Discounts: www.speed-tutor.com/
⬇️ SpeedTutor Best Selling Assets:
🧩Adventure Puzzle Kit: bit.ly/STAdventurePuzzleKit
🗒️ Note & Letter System: bit.ly/STNoteLetterSystem
🔍Examine System: bit.ly/STExamineSystem
🔢Keypad System: bit.ly/STKeypadSystem
⬇️SpeedTutor Model Packs:
➡️Unity Store: bit.ly/STUnityStoreModelPacks
➡️My Website Discounts: www.speed-tutor.com/
My Assets include: Gas Mask, Flashlight, Generator, Themed Key , Padlock, Phone, Chess Puzzle, Lever, Valve Puzzle, Fuse Box & Safe Systems. Cardboard, Debris, Massive Models and more!
························································································
⭐ Connect with me:
💬| Discord: / discord
🐦| Twitter: / speedtutor
📱 | Facebook: / speedtutoruk
🖥 | Website: www.speed-tutor.com
·······················································································
#Unity #GameDevelopment #DoorTrigger #OpeningDoor

Пікірлер: 207
@SpeedTutor
@SpeedTutor 2 жыл бұрын
If you TRIGGER me, this door is going to open SO FAST! 🔥UNITY SAVINGS: bit.ly/UnitySalesHub 🔥SpeedTutor Unity Store: bit.ly/STUnityStorePuzzlePacks 🔥HUMBLE SAVINGS: bit.ly/HumbleBundleDeals
@lucutes2936
@lucutes2936 2 ай бұрын
hi
@MacCraig8
@MacCraig8 3 жыл бұрын
For the door open/close animations, easier to copy DoorOpen in the animator and set the playback speed to -1 and rename it DoorClose. That way it's less data since both animations are sourced from the same clip file! Just needs to not loop and not write default state either.
@SpeedTutor
@SpeedTutor 3 жыл бұрын
I didn't know this but thanks for the suggestion! :) I'll be sure to share this in my next video and mention your comment!
@dunderguy
@dunderguy 2 жыл бұрын
THANK YOU SO MUCH I'VE BEEN TRYING TO DO THIS FOR WEEKS
@SpeedTutor
@SpeedTutor 2 жыл бұрын
I'm so glad you thought so! Thanks for coming to watch my friend! :D
@kuromiLayfe
@kuromiLayfe 3 жыл бұрын
Really useful tutorial as always
@SpeedTutor
@SpeedTutor 3 жыл бұрын
Glad you think so!
@bananaramaman9031
@bananaramaman9031 2 жыл бұрын
Thank you for this, very helpful building block for a beginner
@SpeedTutor
@SpeedTutor 2 жыл бұрын
That's no problem at all, thanks for coming to watch! :D
@armorguy5563
@armorguy5563 2 жыл бұрын
This tutorial is pure gold
@SpeedTutor
@SpeedTutor 2 жыл бұрын
I'm glad you think so, my friend! Thanks for coming to watch! :D
@letsplaysbyjyrixx7146
@letsplaysbyjyrixx7146 3 жыл бұрын
Thx for this Tutorial VERY VERY HELPFUL =)
@SpeedTutor
@SpeedTutor 3 жыл бұрын
I'm glad you think so, thanks for watching! :)
@MarioSpiteri
@MarioSpiteri 3 жыл бұрын
Good video :) ... May I suggest an improvement. You could make just 1 trigger around the door. When the player enters the trigger, it opens the door. When the player exits the trigger, the door closes ... Further to this, if you have multiple players accessing the door, you don't want the door to close when any player exits the trigger. In this case you want the door to close when ALL the players exit the trigger. To do this, the door keeps a counter of how many objects (Players) there are in its trigger and it would open when this counter is equal to 1 (first Player entered the trigger). The trigger exit event would decrement the counter every time an object exits the trigger and the door would close when the counter goes down to zero (ie. no more objects in the trigger).
@SpeedTutor
@SpeedTutor 3 жыл бұрын
This is very, very true! There are multiple ways to do things within games, not just on trigger events and if I showed every eventuality it would be a really long video. I was just showing one way, which is a basic concept of how you could implement it! :) Thanks for the comment though! :)
@MarioSpiteri
@MarioSpiteri 3 жыл бұрын
@@SpeedTutor ... Hello again SpeedTutor. Thanks for the reply. Yes, there are many ways to implement the same features in games. It's always nice to share ideas to help the game development community :) ... Keep up the good work.
@SpeedTutor
@SpeedTutor 3 жыл бұрын
Thanks again for taking the time to comment! Really helpful! :)
@Blinkers2007GameDev
@Blinkers2007GameDev Жыл бұрын
In my game, I have made it so that when the player is colliding with the door, if the player presses a certain key, the door opens up. and if the player presses a different key it closes. Also, the door opening up and closing doesn't even have to be an animation, it could very well be a rotation that is implemented in update. That way, if we want to implement this script on multiple doors, it would work. Idk really know if animations from one door is transferable to others.
@someloafofbread2417
@someloafofbread2417 11 ай бұрын
@@MarioSpiteri how do you do this??? I really want to add this but I just cant figure it out.
@tinxdevelopment4982
@tinxdevelopment4982 3 жыл бұрын
Nice Simple vid !
@SpeedTutor
@SpeedTutor 3 жыл бұрын
Thanks very much! :)
@random_precision_software
@random_precision_software 3 жыл бұрын
SORRY, Matt... Another bloody good video m8!!.. I nearly forgot to say that cos I was confused about the "FIRST" viewer
@SpeedTutor
@SpeedTutor 3 жыл бұрын
Don't worry about it! :)
@abcdefghjijklfgu
@abcdefghjijklfgu 2 жыл бұрын
Used this method thank you
@SpeedTutor
@SpeedTutor 2 жыл бұрын
Fantastic! I'm glad this was helpful to you! :D
@gatheringmatter4289
@gatheringmatter4289 Жыл бұрын
Ive been trying to do this for two straight days which has been very frustrating. Thank you so much for your video. Now I just have to figure out how to make it so it opens and closes on both sides
@gatheringmatter4289
@gatheringmatter4289 Жыл бұрын
I figured it out! If anyone finds this video and wants to do the same thing I did, here is the code I used using System.Collections; using System.Collections.Generic; using UnityEngine; public class TriggerDoorControl : MonoBehaviour { [SerializeField] private Animator myDoor = null; [SerializeField] private bool openTrigger = false; [SerializeField] private bool closeTrigger = false; private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { myDoor.Play("open", 0, 0.0f); } } private void OnTriggerExit(Collider other) { if (other.CompareTag("Player")) { myDoor.Play("close", 0, 0.0f); } } }
@SpeedTutor
@SpeedTutor Жыл бұрын
Thanks for sharing your thoughts, my friend! I hope you found my tutorial useful! :D
@jkace7541
@jkace7541 Жыл бұрын
Thank you so much
@SpeedTutor
@SpeedTutor Жыл бұрын
You're very welcome! :D
@Bobob..
@Bobob.. 5 ай бұрын
Thanks its work
@SpeedTutor
@SpeedTutor 5 ай бұрын
I'm glad you found it useful! :)
@Ball_Zach
@Ball_Zach 3 жыл бұрын
even better than Brackeys, it's... SpeedTutor, congrats on 100k subs too :)
@SpeedTutor
@SpeedTutor 3 жыл бұрын
Thanks man! I appreciate it! :D
@GoofieRider
@GoofieRider 3 жыл бұрын
I got it in the end. The video missed a couple of points I had to figure out cos some parts of the video editing were cut short. But I'd recommend this vid for learning.
@SpeedTutor
@SpeedTutor 3 жыл бұрын
Thanks very much! :)
@nightcrow578
@nightcrow578 8 ай бұрын
hi, thankyou for your tutorial and it really helps me alot, but i want to add audio when my door open and close, how to add audio in it?
@SpeedTutor
@SpeedTutor 8 ай бұрын
Hey there, thanks for checking this out. I have a tutorial all about door sounds on my channel, I've got the link in the description too :)
@watercat1248
@watercat1248 3 жыл бұрын
SpeedTutor do you you have eny weapon pic up system. I really struggle to make the weapon pickup system in the fps I'm working now I have make omost all the systems the only problem I have now is how to check if is the corect object on the ground if use the tags method I will have a to meny tags and if use the name method I by not able to duplicate objects that mens both methods is not working correctly I need to find same alternative method eny idia? Maybe is same way I don't know yet if you have eny segestions I want to heard One more question haw I'm using layers in code and what is the difference if use layers instead form tags in code?
@mizerrz1872
@mizerrz1872 3 жыл бұрын
too good
@SpeedTutor
@SpeedTutor 3 жыл бұрын
Thanks very much! :)
@mizerrz1872
@mizerrz1872 2 жыл бұрын
Thank you very much
@TheAntox007
@TheAntox007 11 ай бұрын
Thanks lot, I had a button trigger before but when ent5ering a let's say a arena I wanted them closed on a trigger, this helped me alot! Thank you!
@SpeedTutor
@SpeedTutor 11 ай бұрын
You're very welcome, I'm glad I could help :) How did you find me? :)
@TheAntox007
@TheAntox007 11 ай бұрын
@@SpeedTutor just typed open/close door on trigger unity3d hahah
@zonoscopePictures
@zonoscopePictures 3 жыл бұрын
Any thoughts on why the triggers don't work in VR? I have a scene with triggers , and the XR Rig tagged as "Player". However, my door does not open when I approach the trigger.
@SpeedTutor
@SpeedTutor 3 жыл бұрын
I'm not sure at all, does one of your objects you're trying to trigger use a Rigidbody?
@zonoscopePictures
@zonoscopePictures 3 жыл бұрын
@@SpeedTutor I will look when im home and check -- thanks!
@Shubham-bk2cf
@Shubham-bk2cf 3 жыл бұрын
Raycast Locked Door and Key Plz :)
@Kingstantin
@Kingstantin Жыл бұрын
How can I do this with 3 or more buttons/triggers/etc to open a door? So 3 buttons have to be pressed before the door will open.
@SpeedTutor
@SpeedTutor Жыл бұрын
You'd have to keep track of which buttons you've pressed and then once all have been pressed, use a method to open the door :)
@valentijnrecord5348
@valentijnrecord5348 3 жыл бұрын
Nice vids ! How can I make it work multiple time ?
@SpeedTutor
@SpeedTutor 3 жыл бұрын
You would have to make some logic that when you exit the trigger the door might close or make a check to see when the door is open and if you walk into it again, it closes. It's really up to you! :)
@ptato_
@ptato_ Жыл бұрын
What if i coming from out side its will open or not?
@cate01a
@cate01a 6 ай бұрын
if the animator was empty it could just be because youve lost the origin. to fix close the animator tab then open it again and it should put you back to 0,0
@SpeedTutor
@SpeedTutor 6 ай бұрын
Thanks for the tip!
@themaskyyt
@themaskyyt 3 жыл бұрын
Selecting a method, whether is it using raycast or triggers, depends on the game? Or there are some benefits using one or another?
@Shubham-bk2cf
@Shubham-bk2cf 3 жыл бұрын
Raycast is much better than triggers
@SpeedTutor
@SpeedTutor 3 жыл бұрын
It's very dependant on your use case, if it's a top down 2D style game you might want this solution but raycasts can be either first or third person.
@dwdwipermana4134
@dwdwipermana4134 3 жыл бұрын
And how to make Door like RE 7? If player collide with Door slighty, the Door will open A bit and if player force in to the door, The door will open properly. Like the player and the door have a physics
@SpeedTutor
@SpeedTutor 3 жыл бұрын
I was actually creating something like this, it was a combination of a hinge joint with a limit and then if you push on it again, it will open fully.
@chimerathekid6630
@chimerathekid6630 3 жыл бұрын
Anyone else having trouble getting the tick boxes to appear? And Unity won't let me use [SerializedField] :(
@SpeedTutor
@SpeedTutor 3 жыл бұрын
Why not? Are you missing a "Using namespace" at the top?
@dak5327
@dak5327 Жыл бұрын
When I wanted to create a double door feature with this script. I did the same exact thing for "Door2" as I did with "Door1" (with door 1 being the door i created by following the tutorial). However, even when I created new triggerclose, triggeropen & scripts + animations with it, it comes up with the error "Animator.GotoState: State could not be found". I double checked my Animator Base Layer and I have properly set "Idle" as the layer default state. I've looked everywhere and tried everything I could come up with and I have still not been able to find an answer for this.
@SpeedTutor
@SpeedTutor Жыл бұрын
Did you give the code the correct animation name?
@dak5327
@dak5327 Жыл бұрын
@@SpeedTutor Haha sadly i forgot about that until my brother pointed it out! Thanks for responding though! Good to know you respond! Love the tutorial and will definitely watch more ❤️
@SpeedTutor
@SpeedTutor Жыл бұрын
No worries at all! :D It's just sometimes I miss the odd comment because replies aren't easily accessible and all the comments get in the way. Thanks for watching though! :D
@carinaragg4266
@carinaragg4266 2 жыл бұрын
Quick question: the door doesn't open, the errors are: "Animator.GotoState: State could not be found" and "The referenced script (Unknown) on this Behaviour is missing". I'm very new to coding, what does that mean and how do I make it work?
@SpeedTutor
@SpeedTutor 2 жыл бұрын
Is the animation name the same as what you referenced in the script? Is the correct animation component on your door?
@random_precision_software
@random_precision_software 3 жыл бұрын
Hi, I wonder if you can help?..I have a music play system that i want to put on my pause menu. I need to put a donotdetroyonload on it. BUT i need it to be on on a child off the pause menu but donotdestroyonload DOESNT work on childobjects, is there any other way around this? Thanks.
@SpeedTutor
@SpeedTutor 3 жыл бұрын
That is a really good question, what about having the DontDestroyOnLoad - On your parent object?
@random_precision_software
@random_precision_software 3 жыл бұрын
@@SpeedTutor that's what I had it on originally. I've tried every way can't do it..bit silly that you can't have a deactivated object on a do not destroy on load
@SpeedTutor
@SpeedTutor 3 жыл бұрын
I know exactly what you mean, I don't know if there is another way around it. Do you need them to be attached?
@random_precision_software
@random_precision_software 3 жыл бұрын
@@SpeedTutor I'll show you what it is (in the link) , it's a CD player canvas, that I only want to be displayed in an option in the pause menu,. So that means it still be set active(false) until you need it, the only way it works of its displayed all the time which is what I want. kzfaq.info/get/bejne/qJeZd9VkrbqvqJc.html
@Flimcy
@Flimcy Жыл бұрын
hey do you know how to fix the door starting open?
@SpeedTutor
@SpeedTutor Жыл бұрын
Make sure to check your animation :)
@evolight6319
@evolight6319 2 жыл бұрын
hey man, ive been trying for days to get the triggers working on my 2d game, i have not used your code as my doors work a little different. so basically when the player stands in the trigger, he can press F to "buy" the door with points, but currently i come across issues where my player can either press F from anywhere around the map, or it doesnt work at all. would you ever consider making a video on this? thanks
@SpeedTutor
@SpeedTutor 2 жыл бұрын
What about you create a boolean or use "OnTriggerStay" (Which is like update but in a trigger scenario). So in these cases that ONLY when you're inside the collider / trigger can you buy the door! :)
@evolight6319
@evolight6319 2 жыл бұрын
@@SpeedTutor hello, i tried that but i dont think my triggers work properly, when i press F even outside the trigger the door still opens. i really thought my script would work public class BuyDoor : MonoBehaviour { public Transform door; public void BuyDoor1() { gameObject.SetActive(false); } } other script public class DoorTrigger : MonoBehaviour { [SerializeField] private BuyDoor door; void OnTriggerStay2D (Collider2D collider) { if (Input.GetKeyDown(KeyCode.F)) { door.BuyDoor1(); } } }
@SpeedTutor
@SpeedTutor 2 жыл бұрын
Are you sure this isn't being activated anywhere else?
@evolight6319
@evolight6319 2 жыл бұрын
@@SpeedTutor ive fixed the issue, turns out when i shoot at the door my bullet activates the trigger, hence why i was able to open the door from anywhere around the map, i used comparetag to fix it
@SpeedTutor
@SpeedTutor 2 жыл бұрын
Haha, good spot! :) You're a smart man.
@samyukta4369
@samyukta4369 3 ай бұрын
How did you create the box triggers (the green ones)?
@SpeedTutor
@SpeedTutor 3 ай бұрын
Just choose Create > 3D > Cube and then give it a green material :)
@jasonmonsalve8822
@jasonmonsalve8822 3 ай бұрын
It's not working for me, idk whats wrong. I did everyting step by step and correctly. Mine's a mobile app. I'm using unity nav mesh if that has anything to with why it's not working? I'm walking on the trigger but the door isn't opening
@jasonmonsalve8822
@jasonmonsalve8822 3 ай бұрын
I tried ticking the "Provide Contact" on the box colllider of my Trigger Objects, still didn't do anything. I tried adding a rigidbody on my Player, since i saw that you have one on your. Still nothing. Please help
@SpeedTutor
@SpeedTutor 3 ай бұрын
Is there a tag you're missing? Did you try and add a debug log to this and see if it fires when you walk into the trigger?
@skullish7046
@skullish7046 3 жыл бұрын
im not sure if i missed anything whenever i copied it down but whenever i try to drag the script onto the triggers it says "the script dont inherit a native class that can manage a script" i literally started coding yesterday so i have no clue what that means lol. also my [SerializeField] code is not getting highlighted and recognized for some reason????
@SpeedTutor
@SpeedTutor 3 жыл бұрын
Is the name of your script the same as your class name?
@skullish7046
@skullish7046 3 жыл бұрын
@@SpeedTutor oh i accidently put spaces for the name lol. thank you for your help
@SpeedTutor
@SpeedTutor 3 жыл бұрын
No worries! Haha. :)
@TheFloatzy
@TheFloatzy Жыл бұрын
@@SpeedTutor what is a class name?
@jeremyphilips138
@jeremyphilips138 3 жыл бұрын
hey man it seems like a great tutorial and im sure its something on my side but ive spent a good hour trying to figure out whats wrong and i have no clue. followed everything and theres no issues with the code or the names but the doors just wont open for some reason. if anyone could help me out thatd be great! :)
@SpeedTutor
@SpeedTutor 3 жыл бұрын
No errors at all? Add some Debug.Log lines into your code and see if it adds that to the console when you run specific code? Then you can try and find the culprit! :)
@appelbanaan2633
@appelbanaan2633 2 жыл бұрын
@@SpeedTutor hi it doesnt work for me to, do you have any tips?
@distant_distraction
@distant_distraction Жыл бұрын
what is wrong with myy code in unity it says assets\TriggerDoorController2.cs(13,34): error CS0246: The type or namespace name 'collider' could not be found (are you missing a using directive or an assembly reference?) please help
@SpeedTutor
@SpeedTutor Жыл бұрын
What's the code on that line?
@distant_distraction
@distant_distraction Жыл бұрын
@@SpeedTutor private void ontriggerenter (collider other)
@SpeedTutor
@SpeedTutor Жыл бұрын
If you did spell it just like this, it needs to be: void OnTriggerEnter(Collider other) - I hope that helps! :)
@thatcodinspud
@thatcodinspud Жыл бұрын
@SpeedTutor my code doesnt work it says "Animator" does not contain a definition for 'play' etc can you help
@SpeedTutor
@SpeedTutor Жыл бұрын
Did you create the correct reference at the top?
@striverfor7628
@striverfor7628 Жыл бұрын
I want to learn how to use OnTriggerExit to make the door automatically close upon exiting the trigger
@SpeedTutor
@SpeedTutor Жыл бұрын
Did you work it out?
@striverfor7628
@striverfor7628 Жыл бұрын
@@SpeedTutor No. I tried something and it didn't work. I need a proper tutorial on it
@marissaszweda1763
@marissaszweda1763 Жыл бұрын
Hey i get this error after i save the script. NullReferenceException: Object reference not set to an instance of an object. i followed it to a Tee but it is saying Animator myDoor Null is is not set to a instance of an object, i tried fixing but cannot figure it out. Would Appreciate help.
@marissaszweda1763
@marissaszweda1763 Жыл бұрын
So it wont allow me to add my door to the script
@SpeedTutor
@SpeedTutor Жыл бұрын
You must have an error? Is your script name the same as your class name?
@oscarlopez8186
@oscarlopez8186 Жыл бұрын
im coming up with a problem where the trigger isnt getting "triggered". nothing happens. I set the box collider's IsTrigger state to true. not sure what else I could be missing? The script is on the box, and the OpenTrigger button is set to true. I even put a Debug.Log inside of the function but it is never called, as if no trigger had entered
@SpeedTutor
@SpeedTutor Жыл бұрын
Did you tag the player controller you're using?
@oscarlopez8186
@oscarlopez8186 Жыл бұрын
@@SpeedTutor I did, it has the Player tag
@SpeedTutor
@SpeedTutor Жыл бұрын
No errors?
@oscarlopez8186
@oscarlopez8186 Жыл бұрын
@@SpeedTutor no errors at all :( just nothing happens
@rrendbarggq
@rrendbarggq Жыл бұрын
@@oscarlopez8186 same
@user-if5ho1zv8o
@user-if5ho1zv8o 4 ай бұрын
can you put the code in the description for the people who struggle to write that?
@SpeedTutor
@SpeedTutor 4 ай бұрын
All the scripts and projects are on my Patreon :)
@mohammadilman1083
@mohammadilman1083 Жыл бұрын
I used double door in my project, the open door script is working but the close door doesnt, also the trigger doesnt disapear when i touched it, any solution?):
@SpeedTutor
@SpeedTutor Жыл бұрын
Do you disable the trigger when you walk into it?
@mohammadilman1083
@mohammadilman1083 Жыл бұрын
@@SpeedTutor actually it was because i havent changed the closedoor on the script, but thank you for the reply
@SpeedTutor
@SpeedTutor Жыл бұрын
Great work on fixing it! :)
@mohammadilman1083
@mohammadilman1083 Жыл бұрын
@@SpeedTutor do you have any tutorial on making jumpscare? i need one, i tried the one that using multiple camera but there's a bug which makes the audio wont play, if you have one please let me know :)
@zeroerror2338
@zeroerror2338 2 жыл бұрын
I could not move that white scroll when i tried to travel between key frames😶? any idea
@SpeedTutor
@SpeedTutor 2 жыл бұрын
Was it locked?
@zeroerror2338
@zeroerror2338 2 жыл бұрын
@@SpeedTutor idk i anyhow got work from that scroller by after 20 mins 🙂 thx for the tutorial.
@fabwasd3154
@fabwasd3154 2 жыл бұрын
I know im late but it keeps on crashing when I put the script in the trigger boxes
@SpeedTutor
@SpeedTutor 2 жыл бұрын
That's pretty strange, does your Unity crash often?
@QUIKCaspa
@QUIKCaspa 5 ай бұрын
Nothing is in my animator? how did you get all of those buttons in there at 3:18
@SpeedTutor
@SpeedTutor 5 ай бұрын
Have you clicked on the object with the animator component?
@QUIKCaspa
@QUIKCaspa 5 ай бұрын
@@SpeedTutor Uh... Nope... 😂 That was the fix haha, cheers buddy 😀
@SpeedTutor
@SpeedTutor 5 ай бұрын
Haha, you're very welcome! :D
@someloafofbread2417
@someloafofbread2417 11 ай бұрын
anybody know how to make it so the door automaticaly closes when you step off?
@SpeedTutor
@SpeedTutor 11 ай бұрын
Use OnTriggerExit :)
@someloafofbread2417
@someloafofbread2417 11 ай бұрын
ye I got it thanks@@SpeedTutor
@mirapakulinek
@mirapakulinek 2 жыл бұрын
I have big problem I have same Script And same settings But when i go to trigger , doors doesnt start open animation. Please HELP
@SpeedTutor
@SpeedTutor 2 жыл бұрын
You didn't set your door to static, did you?
@mirapakulinek
@mirapakulinek 2 жыл бұрын
@@SpeedTutor ah thank you
@SpeedTutor
@SpeedTutor 2 жыл бұрын
Did that fix it? :)
@mirapakulinek
@mirapakulinek 2 жыл бұрын
@@SpeedTutor yes Now Its ok
@CrazyCaboose009
@CrazyCaboose009 Жыл бұрын
Figured out most of the process here. But i am getting error code: CS0542 "member names cannot be the same as their enclosing type". Everything looks right to me. My Code: using System.Collections; using System.Collections.Generic; using UnityEngine; public class ButtonPress : MonoBehaviour { [SerializeField] private Animator ButtonDown = null; [SerializeField] private bool ButtonTrigger = false; [SerializeField] private string ButtonPress = "ButtonPress"; private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { if (ButtonTrigger) { ButtonDown.Play(ButtonPress, 0, 0, 0f); //ButtonPress is name of animation gameObject.SetActive(false); } } } }
@SpeedTutor
@SpeedTutor Жыл бұрын
That's because your field "ButtonPress" is the same name as your class. Make sure you have field names in a different case, like: buttonPress, buttonDown, buttonTrigger. It's usually good practise! :)
@OvernightOats1
@OvernightOats1 6 ай бұрын
Is the free asset still available? I can't find it
@SpeedTutor
@SpeedTutor 6 ай бұрын
It's on my Patreon but if you downloaded this before, it's available on the Unity store within your account :)
@megantropuspaleojavanicus
@megantropuspaleojavanicus Ай бұрын
I've been trying this tutorial for hours but still not working 😢 welp.. The triggers seem okay, and the controller also could detect and made a transition from null to DoorOpen. But still the door didn't move at all T----T
@SpeedTutor
@SpeedTutor Ай бұрын
Your door isn't marked as static, is it?
@alexussantiago649
@alexussantiago649 2 жыл бұрын
I'm getting a "invalid Layer Index '-1' error
@SpeedTutor
@SpeedTutor 2 жыл бұрын
Did you create the layer?
@this_is_sukie
@this_is_sukie 3 жыл бұрын
My player will walk into the trigger but nothing happens...what did I do wrong?
@SpeedTutor
@SpeedTutor 3 жыл бұрын
Did you tag your player?
@this_is_sukie
@this_is_sukie 3 жыл бұрын
@@SpeedTutor yes, I followed step by step by the trigger blocks don’t work when I walk into them
@gamertech4589
@gamertech4589 2 жыл бұрын
i followed tuturial but trigger doesn't open door , Need Help
@SpeedTutor
@SpeedTutor 2 жыл бұрын
Any errors?
@dhhdh1161
@dhhdh1161 2 жыл бұрын
I want to create an event system for the door so that it only opens if the Pinpad is correct. How can I implement it with your triggerdoorcontroller script. This is my code(I already delegate my pinpad script): public class DoorEvent: MonoBehaviour { void OnEnable() { PinPadtwo.open += ; } void OnDisable() { PinPadtwo.open -= ; } public void () { } }
@SpeedTutor
@SpeedTutor 2 жыл бұрын
You can use the EventSystem in Unity. Check out my tutorial on this channel for events and I explain them there! :)
@Ravennwashere
@Ravennwashere Жыл бұрын
how do you make the triggers stay
@SpeedTutor
@SpeedTutor Жыл бұрын
I'm not sure what you mean?
@someloafofbread2417
@someloafofbread2417 11 ай бұрын
did you figure it out? if not take out the game object set active false part of the code. (its under the myDoor.Play(doorClose, 0, 0.0f) code), hope that helped :)
@rorothegoatboat
@rorothegoatboat 2 жыл бұрын
why is Play for myDoor.Play red for me?
@SpeedTutor
@SpeedTutor 2 жыл бұрын
What is your line of code?
@justbeeeb2061
@justbeeeb2061 3 жыл бұрын
Edit: I kind of understand it now, Your video is AMAZING!!!!!!!+!%++!/!! Hello, this is the first video from You I see, and I'm just starting to do Stuff in Unity, at 5:30 why do You use myDoor, the door is named Single_Door_Model, the animations for the door are named DoorOpen and DoorClose, so neither of these 3 are myDoor. I don't understand that part; Could You please help?
@justbeeeb2061
@justbeeeb2061 3 жыл бұрын
@SpeedTutor
@SpeedTutor
@SpeedTutor 3 жыл бұрын
myDoor is literally just a variable name, you can name it however you want! I only use "myDoor" so you know where you'll put the door gameobject!
@justbeeeb2061
@justbeeeb2061 3 жыл бұрын
@@SpeedTutor Thank You 👍
@random_precision_software
@random_precision_software 3 жыл бұрын
I REALLY don't get this "FIRST" statement people have got going on with themselves? or is it me? I'm not arsed if I'm first or last that views the videos LOL
@SpeedTutor
@SpeedTutor 3 жыл бұрын
It's always appreciated Roy! :)
@zaynecarrick1763
@zaynecarrick1763 6 ай бұрын
does anyvody know how to make the triggers reapear?
@SpeedTutor
@SpeedTutor 6 ай бұрын
Use .SetActive(true) when you walk into the other?
@cubingbot28
@cubingbot28 3 жыл бұрын
I really don't know why this is happening but My code doesn't work using System.Collections; using System.Collections.Generic; using UnityEngine; public class TriggerController : MonoBehaviour { [SerializeField] private Animator ObstaclesRise = null; [SerializeField] private bool RiseTrigger = false; [SerializeField] private bool DownTrigger = false; [SerializeField] private string Rise = "Rise"; [SerializeField] private string Rise2 = "Rise2"; [SerializeField] private string Rise3 = "Rise3"; private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { if (RiseTrigger) { ObstaclesRise.Play(Rise3, 0, 0.0f); ObstaclesRise.Play(Rise2, 0.0, 0.0f); ObstaclesRise.Play(Rise1, 0, 0.f); } } } } Only "Rise3" works but not "Rise2" and "Rise1" can you help me?
@ducker5815
@ducker5815 2 жыл бұрын
I know this is a super late response but incase anyone else needs help with this issue, You are using "Rise1" instead of the Private string name "Rise" you also forgot to put "" on ObstaclesRise.Play(Rise3, 0, 0.0f); ObstaclesRise.Play(Rise2, 0.0, 0.0f); ObstaclesRise.Play(Rise1, 0, 0.f); So the fixed version of this would look as shown ObstaclesRise.Play("Rise3", 0, 0.0f); ObstaclesRise.Play("Rise2", 0, 0.0f); ObstaclesRise.Play("Rise", 0, 0.0f); any other changes are up to you, hope this helps :)
@cubingbot28
@cubingbot28 2 жыл бұрын
@@ducker5815 lol I already stopped coding
@skurficisntavailable
@skurficisntavailable 8 ай бұрын
how to select both cubes
@SpeedTutor
@SpeedTutor 8 ай бұрын
I'm not sure what you mean?
@skurficisntavailable
@skurficisntavailable 8 ай бұрын
@@SpeedTutor dw i got it now
@hamishdelaforce1048
@hamishdelaforce1048 4 ай бұрын
i followed this tutorial and it still doesnt work
@SpeedTutor
@SpeedTutor 4 ай бұрын
Any errors?
@paulkruger4156
@paulkruger4156 8 ай бұрын
Be nice if it did not open all doors of that type!
@SpeedTutor
@SpeedTutor 8 ай бұрын
This opens all of your doors?
@paulkruger4156
@paulkruger4156 8 ай бұрын
@@SpeedTutor Yes. My environment is placed procedurally, So every door has the sane animator and scripts etc. Which means, all the doors open or close, when activated.
@MONGALOW
@MONGALOW 4 ай бұрын
can you please just upload the scripts in your vids, i cant code and i need atleast an hour even if you show it because theres always like lowercase and uppercase letters that i got wrong. adn then i need to open the script again and correct them, its so anoying. please upload scripts :D
@SpeedTutor
@SpeedTutor 4 ай бұрын
Hey there, all of my scripts are on my Patreon and you can check out all the stuff on there too in the big list in my description :)
@MONGALOW
@MONGALOW 3 ай бұрын
@@SpeedTutor Thank you!
@bigchunges6791
@bigchunges6791 Жыл бұрын
Yeah free..
@SpeedTutor
@SpeedTutor Жыл бұрын
Sadly it had to be moved from the asset store because of issues and it's now on my Patreon but this tutorial is absolutely free on KZfaq here! :)
@Funesti_Tenebris
@Funesti_Tenebris 3 жыл бұрын
ITS NOT WORKING
@SpeedTutor
@SpeedTutor 3 жыл бұрын
What happens?
@nejatulusal1475
@nejatulusal1475 3 жыл бұрын
FIRST EVERYTHING
@SpeedTutor
@SpeedTutor 3 жыл бұрын
Good job! :)
@random_precision_software
@random_precision_software 3 жыл бұрын
@@SpeedTutor I've put another game on ITCH.IO you dont fancy giving me some Constructive Criticism? if I give you the link?
@ocdadd3775
@ocdadd3775 2 жыл бұрын
It’s called DOOR, not DAW. Smh
@SpeedTutor
@SpeedTutor 2 жыл бұрын
I swear it's said in an almost identical way, haha. It's how people have mentioned the way I've said "Sauce" for "Source" but I literally can't say it any differently. Haha. It's exactly the same.
@As1aMUSlC
@As1aMUSlC 3 ай бұрын
it’s not working.
@SpeedTutor
@SpeedTutor 3 ай бұрын
Any errors?
@As1aMUSlC
@As1aMUSlC 3 ай бұрын
@@SpeedTutor I don’t know, there are no errors, everything in the script is error-free, but it still doesn’t work.
@SpeedTutor
@SpeedTutor 3 ай бұрын
Did you check out my video in the description about trigger event checklist? That might help? :)
@tuannguyenquoc1170
@tuannguyenquoc1170 3 жыл бұрын
video so baddd
@SpeedTutor
@SpeedTutor 3 жыл бұрын
I'm happy to listen to suggestions on making it better! :)
@faded87
@faded87 Жыл бұрын
Can I have this work in a multiplayer game cause Iv been looking all over for a multiplayer door system for my game with photon.pun
@jordankoroma9662
@jordankoroma9662 4 ай бұрын
When I did the could I got Animator.GotoState: State could not be found, I was wondering if you could help me, I don't understand what this means
@SpeedTutor
@SpeedTutor 4 ай бұрын
Did you give the correct name for your animation and in the code?
OPENING a DOOR in UNITY with a RAYCAST
18:18
SpeedTutor
Рет қаралды 52 М.
OPENING a DOOR using a BUTTON
18:38
SpeedTutor
Рет қаралды 24 М.
ЧУТЬ НЕ УТОНУЛ #shorts
00:27
Паша Осадчий
Рет қаралды 10 МЛН
MISS CIRCLE STUDENTS BULLY ME!
00:12
Andreas Eskander
Рет қаралды 20 МЛН
Can A Seed Grow In Your Nose? 🤔
00:33
Zack D. Films
Рет қаралды 24 МЛН
Creating a HINGE DOOR in UNITY!
4:41
SpeedTutor
Рет қаралды 56 М.
OPENING a DOOR with a KEY! (Unity Beginner Tutorial)
20:25
SpeedTutor
Рет қаралды 35 М.
How to ACTUALLY get into Gamedev
14:01
DaFluffyPotato
Рет қаралды 708 М.
Unity - Open Door, with Safe Code.
19:13
GAW
Рет қаралды 5 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 699 М.
3 Hours vs. 3 Years of Blender
17:44
Isto Inc.
Рет қаралды 4,4 МЛН
PAUSE MENU in Unity
12:13
Brackeys
Рет қаралды 982 М.
REALISTIC Foot Placement Using IK in Unity
30:09
b3agz
Рет қаралды 126 М.
ЧУТЬ НЕ УТОНУЛ #shorts
00:27
Паша Осадчий
Рет қаралды 10 МЛН