Please do make an explanation video of vrchats examples! It'll be very helpful. I do like how well you explain what your doing and how the logic works on your videos!
Long time no see XD Damn I arrive late here haha. Amazing tutorial, I was looking for something like this, many thanks Player! As always, an amazing video! Thank you for your dedication and tutorials!
@@PlayerBush001 Quick question, I've made 2 doors successfully, however on my third door I'm unable to interact with it in its closed state in game. When I open the animator and manually check isOpen, the door will open and I'm then able to interact with the door and close it in game. Any idea what might be causing this?
Glad you found the problem ^^ Sorry for the late reply, but unfortunately this is one of those problems that is completely dependent on your use case. I would have just recommended seeing if any other colliders were overlapping the object when closed (like the door frame/ wall it's on), and that's about it
Love this video, helped me out so much. Didn't realize setting up animations was so easy! Could you possibly make a tutorial on items/objects interacting with colliders? I'm trying to make a key that interacts with the lock when it's touching it, but can't exactly figure out how to do it. No worries if not, it may be more complex then I realize. Again, keep up the great work, your videos are amazing and have helped me out so much!
glad you found the video helpful ^^ About the key idea, this is certainly something I want to cover, just it will be a while before I can. As for how I would do it, how good are you with cryptic? See what you can make of this: First, make the key have a collider with 'isTrigger' set to true on it, and the lock have a collider on it (isTrigger = false). Then add a script on the lock with: 'onTriggerEnter'(collider) -->> string,contains ("insert key name, or part of name, here. no spaces" ) -->> 'branch' -(true)->> "key has been inserted. play door open script stuff" Hope that helps ^^
Apologies on the late response, finally got back on Unity. Haven't been able to figure out the whole lock and key thing, I tried to follow your instructions but I'm not good with cryptic. (nor do I really know what cryptic is lol) I've put this aside for now, might try it again in the future when I have a better grasp on what I'm actually doing lol. I have yet another question though. How would one setup up the lock from the tutorial to start in the locked state instead of the unlocked state when starting up the world. I've been trying to fix this for hours xD, yet I can't figure out how. I know it's a silly question to ask, but if you could point me in the right direction I'd really appreciate it. This is getting a bit long so I'll rap it up here- Again, thanks for all the help, you're doing an amazing job! P.s. Loved the new video!
@@AKRFTR haha, cryptic is just my name for the writing style I use when showing udon graph nodes in text format. Not the easiest to read and follow, but many seem to follow it okay of they have the graph open (this was a harder one though). Actually in this case, you will find a lot of similarities with the last script shown on my latest video.. As for your other question, you would just need to change the default state of the 'isLocked' bool to be true. Can't remember if I made it public, so you may have to change the default value by hitting the dropdown on the variable itself. Just remember to hit the compile button located at the top right corner afterwards, as it won't auto compile. May have to also change it on the animator's bool value. Hope that helps ^^
I did notice that the code seemed similar, I need to go back and rewatch it and see if I can implement it into what I was trying to do. As for the lock, It is not set to public. -But I was able to change the bool value and it worked! Thanks you so much!
How can i make the door play sounds when either open and close(door opening sound and door closing sound)? I can make a single sound play once everytime interact with the door but not with both sounds. I tried to put them into open and close animation but they are not working good. the open door sound always play on awake on start, which is not intended
Good question. You will want to use the node 'audioSource, play one shot', and get it to play after you call the animator. You will need to give it the audioSource you want it to play from, the audioClip you want it to play, (and if you hit the dropdown) how loud you want it to play. Then, on your audioSource itself, you want to make sure it is active, but disable 'play on awake', to avoid it playing any sounds when the game beings. You could also delete it's audio clip, as the node won't be using it Hope that helps ^^
i've done everything how you explained it bu my door doesn't want to open. the animation works and i get the prompt to use the door but it just doesn't want to open. the only steps i skipped where the ones about the lock as i didn't need a lock on the door
Ah, yea, that would do it. Udon auto compiles whenever you make a change, but it doesn't do that when you make a change on any of the nodes. If the last thing you did was set a bool to true or something, it won't update that value unless you manually tell it to compile, or do something else that would
@@PlayerBush001 say if i wanted to have the doorknob be the button, how would i do that? i've tried but it doesn't become a button. i put the Udon behaviour on the door knob and all the settings fitting to it but it still doesn't want to work.
@@uccaroo9468 you'll need a collider component on the object in order for vrchats interaction system to see it. For a door nob, I would use either a sphere collider or mesh collider. Set 'is trigger' to true on it, so the player won't collide with it (but can click it) You may however find it hard to click in vr. This is because the door collider can interfere with the door nob trigger. The fix is a little cumbersome, but you will need to duplicate the door object that has the collider on it (none of its child objects), and make the duplicate a child of the original. Then, delete the collider from the original, and the mesh renderer from the duplicate (that will make the duplicate invisible). Then switch the duplicate object's layer to 'mirror reflect'. This layer is a special one, that doesn't interfere with the players interactions, but also only makes the object visible in mirrors. If you did it correctly, you should have a door object that is the visuals; and another that is only a collider, and is set to 'mirror relect'
Question is there a way to create a lockable door toggle that unlocks if someone leaves the room upon respawning or leaving an instance because my doors stay locked whenever someone does that and I’m stumped I use canvas for the toggles
hmm... good question. to solve the respawn problem, it's not too hard. just create a 'onPlayerRespawn', and grab it's playerApi and put it through a 'playerApi, equals' node with a 'networking, get owner' node plug into the other slot. Then, put the bool into a branch node, and if they match, get it to unlock the door. As for checking if the person who locked the door left the world, you would want to use the event 'onPlayerLeft'. Now, I'm unsure if this node plays before the ownership gets transfered back to the instance owner, or afterwards/ during (random before or after). If it's before, you can simply do the same check that I mentioned for the respawning. If it's afterwards, you will need to do a bit more. Create a playerApi variable and call it something like 'localOwner'. Then, whenever you go to lock the door, set this variable to = 'networking, local player'. Then on 'event, onOwnershipTransferred' , get it's player api and put it though a 'playerApi, islocal', to see if it's the local player. If it is, then check to see if the local player is the same as that variable, using: playerApi, equals('localOwner' , 'networking, local player'). If they are the same, then we requested the transfer instead of being given it (like if someone left). So if they don't match, we should unlock the door. Also with that method, if the event's playerApi is not the local player, change 'localOwner' to = 'networking, get owner' A little cryptic in writing, but I hope that helps ^^
@@PlayerBush001 it would be nice if you could possibly create a tutorial on this I’m more of a watching or hands on learner. But I can somewhat understand what your saying so I’ll try it out. Thank you for taking the time to respond.
It wouldn't be a bad idea to come back and make a tutorial on this, but as of right now, I'm got a couple of large projects I'm working on. I'll keep this in mind though. Hopefully what I wrote will give a little direction at least^^
what if I want to lock a room from being accessed from teleporting from the other side, meaning say I used a door to teleport to a private room, is there a way to lock the room from being accessed from the other side so no one else can enter while it is being used?
Sure, your would just need to make it so that 'on Interact', check if door is locked, and then if not, use a playerApi, teleport to node to teleport the player Referencing this script for that, you would just need to replace the animator, set bool (door open) with a 'playerApi, teleport to' node for the Interact node. Delete the 'isOpen' check for the lock event, and then delete the 'isOpen' for the deserilstation node (basically anything that is changing or checking if the door is open) Hope that helps ^^
I used your example, in hope to get more familiar with both unity / VRC SDK, also it's well explained, I didn't manage to make the animations work well, although I was only focused on the opening and on the closing animations. Eg, you didn't show the time loop checkbox, it's checked by default. I have 2 issues today : my character cannot interact with the door, although the outlines are bright, and by checking the isOpen parameter, both the closing and opening animations are ran :/
If the object is lighting up, that means that the udon event 'Interact' is be recognised. I would make sure that you have given the script both the animator, and also make sure you have copied the parameters names exactly (no extra spaces, Case sensitive, etc). Other than that, if it still isn't working, check the console to see if there are any error messages popping up. If not, perhaps post a bunch of debug messages in your code, to see that it is doing as it should. If all that doesn't work, I recommend asking in the official VRChat discord; as there are plenty of people there that can help you bug fix your code, and the ability to post images makes it much easier ^^
Hmm.... can you not find the script, does the variable not show, or are you unable to drag and drop the object into the variable slot? If you can't find the script, with the new SDK, it's been moved to Packages\VRChat SDK - Worlds\Samples\UdonExampleScene\UdonProgramSources. If you have the script, but the variable doesn't show up: Open up the event, and make sure it is identical to what's shown at 10:18. If you make any changes, make sure to hit the 'compile' button, found in the top right If you just can't drag and drop your object containing the script, into the variable slot: Create a new inspector window. Select you target object, and hit the tiny padlock symbol found at the top right, for one of the inspectors. Then select you script object, and drag and drop the udon component of your locked inspector, into the slot directly. This sometimes helps when it gets confused Hope that helps ^^
@@PlayerBush001 Thank you for your response. Should I find it necessary to use your process, I will give this suggestion a try, and let you know how it goes. It is the issue of not being able to change the target using drag-and-drop, or Unity's "target search", for lack of a better name. I have however since I left this comment managed to get the door opening to work in a slightly different manner. I simply omitted using the custom event and just used a regular Event Interact. As such, I can attach the single script as an Udon Behaviour to any object I wish to use as a trigger, and set the desired door as a target.
@@Jenachy yea, that works too. This script allows you to have a button on a wall to open the door as another option, or toggle the Interact object itself to avoid it showing up; but if you don't need any of that, then what you have should be fine ^^ Would recommend at least making sure you know how to do it though, as sending custom events is a super useful thing to know how to do ^^
How could I change the udon graph to where only people within a collider can trigger the lock? So people don't click it through the wall or use playspace to click it.
You could use the script I did for my mirror toggle button, but instead of toggling the mirror gameObject, you could instead make it either toggle the 'udon behaviour, interactable', or the 'collider, set enabled'. You may have to set the bounding box trigger to be 'mirror reflection', to avoid it colliding with the player laser. That being said, you might still be able to lean though the door to activate the lock. One idea I had was to make it so that when you click the lock button itself, it makes you the owner of the lock and activates the lock. Then do a check that when the lock activated, and if so, make everyone check to see if they are the owner of the lock. If they are not the owner, then disable the lock. That way, no one can re-enable the door except the person that locked it. When the lock gets disabled, make it so everyone then can click the lock.
can you make a video how do this as same way but using game object side since my base never uses animators and i cant find way do it without been game object. and since very less videos about locked doors on SDK 3 and VRChat discord doesn't give enough help at all too. (Trying make TP Door that can be locked other side provent other players entering room in global) issue is my old script only does local and no way do it global part this 1 but trying make as click and TP with locked door Thanks
(why did youtube mark this as spam...) I probably won't, as I don't like to make videos that are too similar to each other, as I feel like there are plenty of topics that still need to be covered. That being said, in your case, it isn't that much of a change. To make the lock work for you in your case, you simply want a bool to determine whether or not the door is locked. If it is locked, you don't want it to do anything. but if it isn't locked, then you want it to teleport the player. That is exactly what my script in this video is doing at the end, but instead of making it toggle 'is open', you instead want to run your bit of the code that teleports the player If you still need any help, I would ask in the 'udon-questions' channel in the vrchat discord Hope that helps ^^
@@PlayerBush001 thank you awser, i try get all done as i can. just how you did video was confusing how do it threw locked and teliport but i try figure it out and i did asked vrchat discord about it then since then no one has never responded and pretty much went 0 blank my message so yeh. i try again if you in there.
These tutorials are so insanely helpful and concise. Thank you! Definitely make more.
Glad you like them! More to come ^^
Please do make an explanation video of vrchats examples! It'll be very helpful. I do like how well you explain what your doing and how the logic works on your videos!
Long time no see XD Damn I arrive late here haha. Amazing tutorial, I was looking for something like this, many thanks Player! As always, an amazing video! Thank you for your dedication and tutorials!
Thanks for sticking around!
You've been around for a while now, and I appreciate how supportive you've been ^^
Thank you so much for these tutorials!
Glad you liked them ^^
@@PlayerBush001 Quick question, I've made 2 doors successfully, however on my third door I'm unable to interact with it in its closed state in game. When I open the animator and manually check isOpen, the door will open and I'm then able to interact with the door and close it in game. Any idea what might be causing this?
nvm was a box collider :/
Glad you found the problem ^^
Sorry for the late reply, but unfortunately this is one of those problems that is completely dependent on your use case.
I would have just recommended seeing if any other colliders were overlapping the object when closed (like the door frame/ wall it's on), and that's about it
@@PlayerBush001 No problem, thanks for the responding!
Love this video, helped me out so much. Didn't realize setting up animations was so easy! Could you possibly make a tutorial on items/objects interacting with colliders? I'm trying to make a key that interacts with the lock when it's touching it, but can't exactly figure out how to do it. No worries if not, it may be more complex then I realize. Again, keep up the great work, your videos are amazing and have helped me out so much!
glad you found the video helpful ^^
About the key idea, this is certainly something I want to cover, just it will be a while before I can. As for how I would do it, how good are you with cryptic? See what you can make of this:
First, make the key have a collider with 'isTrigger' set to true on it, and the lock have a collider on it (isTrigger = false). Then add a script on the lock with:
'onTriggerEnter'(collider) -->> string,contains ("insert key name, or part of name, here. no spaces" ) -->> 'branch' -(true)->> "key has been inserted. play door open script stuff"
Hope that helps ^^
Apologies on the late response, finally got back on Unity.
Haven't been able to figure out the whole lock and key thing, I tried to follow your instructions but I'm not good with cryptic. (nor do I really know what cryptic is lol) I've put this aside for now, might try it again in the future when I have a better grasp on what I'm actually doing lol.
I have yet another question though. How would one setup up the lock from the tutorial to start in the locked state instead of the unlocked state when starting up the world. I've been trying to fix this for hours xD, yet I can't figure out how. I know it's a silly question to ask, but if you could point me in the right direction I'd really appreciate it. This is getting a bit long so I'll rap it up here- Again, thanks for all the help, you're doing an amazing job!
P.s. Loved the new video!
@@AKRFTR haha, cryptic is just my name for the writing style I use when showing udon graph nodes in text format. Not the easiest to read and follow, but many seem to follow it okay of they have the graph open (this was a harder one though).
Actually in this case, you will find a lot of similarities with the last script shown on my latest video..
As for your other question, you would just need to change the default state of the 'isLocked' bool to be true. Can't remember if I made it public, so you may have to change the default value by hitting the dropdown on the variable itself. Just remember to hit the compile button located at the top right corner afterwards, as it won't auto compile. May have to also change it on the animator's bool value.
Hope that helps ^^
I did notice that the code seemed similar, I need to go back and rewatch it and see if I can implement it into what I was trying to do.
As for the lock, It is not set to public. -But I was able to change the bool value and it worked! Thanks you so much!
How can i make the door play sounds when either open and close(door opening sound and door closing sound)?
I can make a single sound play once everytime interact with the door but not with both sounds.
I tried to put them into open and close animation but they are not working good.
the open door sound always play on awake on start, which is not intended
Good question. You will want to use the node 'audioSource, play one shot', and get it to play after you call the animator. You will need to give it the audioSource you want it to play from, the audioClip you want it to play, (and if you hit the dropdown) how loud you want it to play. Then, on your audioSource itself, you want to make sure it is active, but disable 'play on awake', to avoid it playing any sounds when the game beings. You could also delete it's audio clip, as the node won't be using it
Hope that helps ^^
Yes please go over all the udon examples.
i've done everything how you explained it bu my door doesn't want to open. the animation works and i get the prompt to use the door but it just doesn't want to open. the only steps i skipped where the ones about the lock as i didn't need a lock on the door
figured it out on my own after half an hour of rewinding. i missed the step telling me to press compile on the script
Ah, yea, that would do it. Udon auto compiles whenever you make a change, but it doesn't do that when you make a change on any of the nodes. If the last thing you did was set a bool to true or something, it won't update that value unless you manually tell it to compile, or do something else that would
@@PlayerBush001 thanks for the helpful information, just starting out with world creation. your video's are very helpful indeed
@@PlayerBush001 say if i wanted to have the doorknob be the button, how would i do that? i've tried but it doesn't become a button. i put the Udon behaviour on the door knob and all the settings fitting to it but it still doesn't want to work.
@@uccaroo9468 you'll need a collider component on the object in order for vrchats interaction system to see it. For a door nob, I would use either a sphere collider or mesh collider. Set 'is trigger' to true on it, so the player won't collide with it (but can click it)
You may however find it hard to click in vr. This is because the door collider can interfere with the door nob trigger. The fix is a little cumbersome, but you will need to duplicate the door object that has the collider on it (none of its child objects), and make the duplicate a child of the original. Then, delete the collider from the original, and the mesh renderer from the duplicate (that will make the duplicate invisible). Then switch the duplicate object's layer to 'mirror reflect'. This layer is a special one, that doesn't interfere with the players interactions, but also only makes the object visible in mirrors.
If you did it correctly, you should have a door object that is the visuals; and another that is only a collider, and is set to 'mirror relect'
Question is there a way to create a lockable door toggle that unlocks if someone leaves the room upon respawning or leaving an instance because my doors stay locked whenever someone does that and I’m stumped I use canvas for the toggles
hmm... good question. to solve the respawn problem, it's not too hard. just create a 'onPlayerRespawn', and grab it's playerApi and put it through a 'playerApi, equals' node with a 'networking, get owner' node plug into the other slot. Then, put the bool into a branch node, and if they match, get it to unlock the door.
As for checking if the person who locked the door left the world, you would want to use the event 'onPlayerLeft'. Now, I'm unsure if this node plays before the ownership gets transfered back to the instance owner, or afterwards/ during (random before or after). If it's before, you can simply do the same check that I mentioned for the respawning. If it's afterwards, you will need to do a bit more. Create a playerApi variable and call it something like 'localOwner'. Then, whenever you go to lock the door, set this variable to = 'networking, local player'. Then on 'event, onOwnershipTransferred' , get it's player api and put it though a 'playerApi, islocal', to see if it's the local player. If it is, then check to see if the local player is the same as that variable, using: playerApi, equals('localOwner' , 'networking, local player'). If they are the same, then we requested the transfer instead of being given it (like if someone left). So if they don't match, we should unlock the door.
Also with that method, if the event's playerApi is not the local player, change 'localOwner' to = 'networking, get owner'
A little cryptic in writing, but I hope that helps ^^
@@PlayerBush001 it would be nice if you could possibly create a tutorial on this I’m more of a watching or hands on learner. But I can somewhat understand what your saying so I’ll try it out. Thank you for taking the time to respond.
It wouldn't be a bad idea to come back and make a tutorial on this, but as of right now, I'm got a couple of large projects I'm working on. I'll keep this in mind though. Hopefully what I wrote will give a little direction at least^^
what if I want to lock a room from being accessed from teleporting from the other side, meaning say I used a door to teleport to a private room, is there a way to lock the room from being accessed from the other side so no one else can enter while it is being used?
Sure, your would just need to make it so that 'on Interact', check if door is locked, and then if not, use a playerApi, teleport to node to teleport the player
Referencing this script for that, you would just need to replace the animator, set bool (door open) with a 'playerApi, teleport to' node for the Interact node. Delete the 'isOpen' check for the lock event, and then delete the 'isOpen' for the deserilstation node (basically anything that is changing or checking if the door is open)
Hope that helps ^^
I don't have the examples folder
This was before the VCC update. All sdk files are now found under:
packages/VRChat SDK - Worlds/ UdonExampleScene/
Hope that helps ^^
@@PlayerBush001 ah yes, thank you! o7
I used your example, in hope to get more familiar with both unity / VRC SDK, also it's well explained, I didn't manage to make the animations work well, although I was only focused on the opening and on the closing animations. Eg, you didn't show the time loop checkbox, it's checked by default. I have 2 issues today : my character cannot interact with the door, although the outlines are bright, and by checking the isOpen parameter, both the closing and opening animations are ran :/
If the object is lighting up, that means that the udon event 'Interact' is be recognised.
I would make sure that you have given the script both the animator, and also make sure you have copied the parameters names exactly (no extra spaces, Case sensitive, etc).
Other than that, if it still isn't working, check the console to see if there are any error messages popping up. If not, perhaps post a bunch of debug messages in your code, to see that it is doing as it should.
If all that doesn't work, I recommend asking in the official VRChat discord; as there are plenty of people there that can help you bug fix your code, and the ability to post images makes it much easier ^^
would be nice see how make private lock room door us teleporter and so room open after is empty like b club 3
The SendEventonInteract script does not allow me to change target.
What do I do?
Hmm.... can you not find the script, does the variable not show, or are you unable to drag and drop the object into the variable slot?
If you can't find the script, with the new SDK, it's been moved to Packages\VRChat SDK - Worlds\Samples\UdonExampleScene\UdonProgramSources.
If you have the script, but the variable doesn't show up: Open up the event, and make sure it is identical to what's shown at 10:18. If you make any changes, make sure to hit the 'compile' button, found in the top right
If you just can't drag and drop your object containing the script, into the variable slot: Create a new inspector window. Select you target object, and hit the tiny padlock symbol found at the top right, for one of the inspectors. Then select you script object, and drag and drop the udon component of your locked inspector, into the slot directly. This sometimes helps when it gets confused
Hope that helps ^^
@@PlayerBush001 Thank you for your response. Should I find it necessary to use your process, I will give this suggestion a try, and let you know how it goes. It is the issue of not being able to change the target using drag-and-drop, or Unity's "target search", for lack of a better name.
I have however since I left this comment managed to get the door opening to work in a slightly different manner. I simply omitted using the custom event and just used a regular Event Interact. As such, I can attach the single script as an Udon Behaviour to any object I wish to use as a trigger, and set the desired door as a target.
@@Jenachy yea, that works too. This script allows you to have a button on a wall to open the door as another option, or toggle the Interact object itself to avoid it showing up; but if you don't need any of that, then what you have should be fine ^^
Would recommend at least making sure you know how to do it though, as sending custom events is a super useful thing to know how to do ^^
How could I change the udon graph to where only people within a collider can trigger the lock? So people don't click it through the wall or use playspace to click it.
You could use the script I did for my mirror toggle button, but instead of toggling the mirror gameObject, you could instead make it either toggle the 'udon behaviour, interactable', or the 'collider, set enabled'. You may have to set the bounding box trigger to be 'mirror reflection', to avoid it colliding with the player laser. That being said, you might still be able to lean though the door to activate the lock.
One idea I had was to make it so that when you click the lock button itself, it makes you the owner of the lock and activates the lock. Then do a check that when the lock activated, and if so, make everyone check to see if they are the owner of the lock. If they are not the owner, then disable the lock. That way, no one can re-enable the door except the person that locked it.
When the lock gets disabled, make it so everyone then can click the lock.
can you make a video how do this as same way but using game object side since my base never uses animators and i cant find way do it without been game object.
and since very less videos about locked doors on SDK 3 and VRChat discord doesn't give enough help at all too.
(Trying make TP Door that can be locked other side provent other players entering room in global)
issue is my old script only does local and no way do it global part this 1 but trying make as click and TP with locked door
Thanks
(why did youtube mark this as spam...)
I probably won't, as I don't like to make videos that are too similar to each other, as I feel like there are plenty of topics that still need to be covered. That being said, in your case, it isn't that much of a change.
To make the lock work for you in your case, you simply want a bool to determine whether or not the door is locked. If it is locked, you don't want it to do anything. but if it isn't locked, then you want it to teleport the player. That is exactly what my script in this video is doing at the end, but instead of making it toggle 'is open', you instead want to run your bit of the code that teleports the player
If you still need any help, I would ask in the 'udon-questions' channel in the vrchat discord
Hope that helps ^^
@@PlayerBush001 thank you awser, i try get all done as i can. just how you did video was confusing how do it threw locked and teliport but i try figure it out and i did asked vrchat discord about it then since then no one has never responded and pretty much went 0 blank my message so yeh. i try again if you in there.
If you post in vrchats 'world-development' channel I'll likely not see it, but if you post in 'udon-questions' I likely will