#udon-general
59 messages · Page 48 of 1
What is VRCPlayerAPI.isModerator? It doesn't seem to be documented here https://docs.vrchat.com/docs/players
it's not documented because it's not usable in Udon
from: https://docs.vrchat.com/docs/player-forces#getgravitystrength--setgravitystrength
GetGravityStrength / SetGravityStrength
float, working range around 0-10
Multiplier for the Gravity force of the world (set to Earth's default). Don't change Unity's Physics.Gravity in your project, get and set it here instead. Default is 1.
Why the "don't" here? For now Physics.Gravity seems to work fine, and it's the easy way to change gravity for all players and all rigidbodies
Momo?
does it work in the client or just in the editor? It would affect all other worlds if you modify the Physics.Gravity value directly. Not sure if we allow it and just reset it when you change worlds, but in general we discourage modification of properties that could persist when you visit other worlds.
It works in client. In the case of the world I made, I modified the project setting rather than using an Udon program
So that definitely makes sense if the setting is in the realm of stuff that could screw with people's games outside of your world. Does this mean changing this value is an 'exploit' of sorts that might stop functioning in a future update?
It's possible.
setting the project gravity has been one of the things that has worked for a long time even in SDK2
pretty sure VRC explicitly applies it on world load
It seems likely that they do, but the question is whether they need to do it that way or need not. If something in the future makes it desirable not to do it that way, then this becomes a landmine
That would be hilarious if you could somehow get the player mods to persist...would be a super fun time until you got b&
And that's why they pack so many big brains into closed and open beta 😉
It's one of those things where it'd make a bunch of worlds act differently and they have support for it
¯_(ツ)_/¯
they could remove it, but it'd break worlds for no particular reason
Today I've had to use Physics.gravity to circumvent an issue with VRChat's player gravity: https://feedback.vrchat.com/vrchat-udon-closed-alpha-bugs/p/setgravitystrength0-does-not-actually-disable-gravity
I think it could be removed if SetGravityStrength(0) worked properly, and if gravity was applied in FixedUpdate().
Try doing SetGravityStrength(Mathf.Epsilon)... no idea if that works or not lel
Oh goodness! You should mention that in the canny
Does it work?
Setting it to 0 set it to 0.1 for me instead, would be funny if Epsilon actually worked
Igbar technically said exactly that
just in a less "formal" way
Epsilon is in mathematical theory a number that is infinitely close to but not zero
Since computers like to be discrete, here its just the smallest number representable
trying it rn. though that still leaves the update vs fixedupdate issue
thank you for the suggestion!
yep, that seems to have done the trick
-giverep @fiery yoke
😄
good chat folks
way to keep it relevant
now I can make quicksand
couldn't figure out how to get that gravity down
I'm sure this has been asked before, but is there any definitive limit on the number of udon synced variables?
Or is it just however much Photon can handle?
anyone knows here dope tutorials for udon?
Thanks for the links! Appreciate it. I actually did the first one already
is there a player audio occlusion method for udon for world objects? For example, reduce or even negate player audio when they move behind a wall. I know guribo's audio system can do it for occlusion between players or facing/distance, but not objects. Goal is to have areas that work like camera occlusion to prevent audio traveling outside boundaries
cansomeone help me my mic is working and everything in the setting and everything is working but stell cant speek
@broken bear jetdog has a prefab where it has zones you can use but i havent seen anything public like a material barrier or just a basical audio barrier yet. but it is technically possible
Hello, I am wanting to have the skybox slowly rotate in the world and I used this video as a guide script wise to allow for that but when attempting to build and run the world with the script running on a game object I am crashing immediately but placing it onto a camera (attempted with the main and a secondary) does not cause it to execute. Would anyone have information on how to fix this? https://youtu.be/cqGq__JjhMM
You can't use Unity Scripts in VRChat - you'll need to learn Udon to make things happen.
?whatisudon
VRChat Udon is a programming language built by the VRChat Development Team for use in VRChat worlds! It enables complex behaviors and logic in VRChat worlds. Read more about Udon in our documentation: https://docs.vrchat.com/docs/what-is-udon
What’s this Udon thing anyways? VRChat Udon is a programming language built completely in-house by the VRChat Development Team. It is designed to be secure, performant, and easy to use via the VRChat Udon Node Graph, a built-in visual programming interface that uses nodes and wires (we call them “no...
Just quick question, it possible to check if player holding item and the type/name of the item?
Item from the world
You can access the current holder of a pickup with VRC_Pickup.current_player (iirc), and you can access pickups in the hand of a player with VRCPlayerAPI.get_pickup_in_hand (names might be slightly different, but that's the gist)
From there you can access gameobjects and udonbehaviour components and variables, etc.
Gotcha, thank you very much!
No problem, good luck!
If player pick ups an object, he turn to IsOwner of this object?
Sure, they do, but ownership is inconsistent sometimes (supposed to improve in upcoming versions of udon), and you're better off using the current_player from the pickup component
But yeah, whoever picks up a gameobject with a pickup component automatically becomes the owner, after several networking ticks
Is it possible to find out the radius and height of player capsule?
I have a rotating skybox shader I got off the asset store, you might try something like that
Can anyone tell me how i can damage the player in udonsharp? or have a small example?
wasabi
RED_SIM has a great sky shader specifically for VRC if you're willing to sub to him on patreon. You can change the time if day by rotating the directional light in your scene or you can animate it. https://www.patreon.com/red_sim
@dim horizon @paper plinth thanks for the info, appreciate it
Does the game work without a VR Headset and if it does, how well does it work?
Yes on both questions.
It works without VR.
It works just as well on Keyboard^Mouse as it does in VR.
VRChat is not large, Super small download. Just download and test
I am enjoying it rn
Would anyone have example of how to build a udon graph for UdonSyncPlayer to have a time position slider (to be able to fast forward into a video to some point) ??
Check out @cunning mist's Youtube channel. He has a tutorial video on it.
How do I switch avatars without going home?
Not #udon-general , Just click the avatar button
hey does anyone know a way i can change my worlds fog to black at night?
i dont need any fancy slow move to black just a instant click would be fine, i mean thats how the shops cycle works
ive looked it up online but all i have sound is scripts and stuff that i have no idea how the hell to use
Not sure how you have it setup the fog but can you just make a duplicate of it and have a button switch between two different "Fogs" ? One is darker, One is lighter
its not like particles
its using unity's built in fog render
its in the lighting tab
but no idea how to play with it
the fog looks fine in the day
but at night.. less so
it is close to what i want @cunning mist but i have no idea how to do those scripts, dont know the programming language, and ontop of that i cannot use a hex code to get specific colors
All scripting words are the same as their nodes. Just search in Udon for RenderSettings and see if anything comes up.
ill have a look now
tbh i might just have to live with the wierd fog
also this works surprisingly well
this also makes me feel REALLY small
like wow
I did.. he did not make a time slider in his tutorial.. (I went through the 3 hour one even x.x)
Make a slider that goes between 0 and 1. Then when you start playing a video, set the max value of the slider to be the length of that video. In update, while it's playing, set the value of the slider to be the current video time. On the slider, add an Event Trigger component. OnPointerClickDown, call an event that pauses the video. OnPointerClickUp, call an event that sets the time of the video to the current value of the slider, then resumes the video.
Thanks! goes to poke around
@cunning mist did you ever figure out any workaround for this issue?
https://feedback.vrchat.com/vrchat-udon-closed-alpha-bugs/p/1048-toggling-disablestationexit-does-not-affect-player-currently-in-station
nnnnope
I'm setting a delay timer that locks exiting for 3 seconds, and it never unlocks
womp womp
There's a chance you can try turning the chair's gameobject off, but I haven't actually experimented with it.
Last time I experiemented with Stations ... toggling them (while sitting in them) leads to a lot of unexpected behaviour 😅
yeah this is getting ooky. Disabling the GameObj might be an OK idea
i kinda want to create an NPC in my world
is that possible ?
if not can some one send me a tutorial for toggling in between 2 things ?
so if A is on and you toggle it B will turn A off
It is! But it's a big project if you're just getting started. If you need a tutorial in order to toggle between two objects, I think you're best path forward is to start with the basics.
https://docs.vrchat.com/docs/getting-started-with-udon
https://www.youtube.com/playlist?list=PLe9XHNvXcouQjg5GULWGLj1tMzeythnQi
like ican toggle things on / off
i thought i could make panels with text
and turn it into an menu maybe
xD
so i would fake it being a NPC o3o
its mostly if people want to ask me stuf
i can put the FAQ on the model in my world
and people can ask there
Does uh.. did anyone have a prefab for teleporter doors that I could use? There's only one recent tutorial that covers it and it didn't seem to work for me.
This is such a simple thing I could get done in SDK 2.0, I don't know why I have to struggle this much for udon
If anyone has a prefab they could throw my way I'd appreciate it
cool
i would love that as well
is it then if you hit a collider your automatically teleported then ?
i cant dm you for some reason
Hello hello. Is there a way to ragdoll/kill players like in SDK2? Looked around and saw that SDK3 and the combat system for it was highly discouraged so I was wondering if there was a work-around for that.
No there is not.
The only way is to use the "outdated" CombatSystem.
A general question to put things in perspective: How long as SDK2 existed and how long has SDK3/Udon existed? (As mainline releases that is)
Ahhhh, alright. Thank you very much for the information! I suppose I'll make do with it for the time being until another method is made available.
I'm wanting to create a Club world with Udon but I've only worked with SDK2, does anyone have any sources for tutorials or prefabs I could use for it? (Light effects, DJ booth, audio, etc)
So hm, I have a question / an issue i'd like to talk about.
I made a world with a videoplayer for quests users using u# (in case it matter, the one shared by Merlin), the videos seem to play fine and stuff but everytime, the video just stop in the middle of the file.
I guess it's because quests don't have a lot of cache space / don't allow files over X in files, but is there a way to tweak that on quest ? (The video files are kinda big and I don't wish to re-encode all of em to 480p or smh)
Asking them to restart the instance 2 times to clean the cache is a bit MonkaS aswell :(
do you get any errors when this happens? You'll need to use Android Debug tools to pull logs, not sure what we log on Quest, I know we turn most logging off for performance.
I sadly don't have a quest myself to try it ! Is there any tutorial to pull up logs anywhere I could ask someone to do ? :o
there's some information here: https://docs.unity3d.com/Manual/LogFiles.html
Seem to honestly be a pain 👀
it is - debugging Quest is not easy
I'll just let the people re-make instance for the time being, but yeah, it happen after the file hit a certain size I think since clearing the cache just seem to do the trick
and 480p seem to play all the way trough it
is there a vector version of the udon logo available?
There's a prefabs list if you search the discord.
the press kit for vrchat, ironically, mentions in the usage guidelines to 'avoid artifacts' but issues no vector format for any of the logos, nevermind the udon one
there's a relatively low quality raster version in the SDK that gets used for UI but if a higher quality version exists i'd want to use it because the raster version will look awful on docs pages on mobile where hidpi logos really show
we don't provide one generally, where are you looking to include it? The Udon logos in the SDK are 1024 pixels wide, what size are you looking to make it?
i'm mostly looking to include it in docs pages and readme files, etc, potentially as part of a header. the udon logos in the SDK have whitespace around them so they end up being maybe 250px? high, which is fine for desktop displays, but tends to look worse on mobile and print formats (such as PDF builds of doc pages)
what PDF docs are you making?
a higher quality version at all would be nice, but ultimately vector will always render better than raster across screens (because it can ensure sharpness), and presuming one exists it'd be nice to use it
i'm making effectively "udon libraries" that utilize U#. the docs are interface docs that describe signatures, API reference, guarantees etc of scripts within them
sounds cool! I'll see if we have a vector version we can share.
also as an aside: the time it takes to download and render a vector version on mobile is usually faster than it would take to download an equivalent quality raster image, so can help reduce FOUC there as well
Is there any way to get a bone transform for parenting purposes? i.e. say i'd like to parent an object's position to someone's arm
i'm guessing that the answer is a no so that you can't modify the transform from udon, which is a shame, and i'd just have to make do with setting the object's position/rotation periodically, but i figured i'd ask instead of making an assumption
you can't directly parent something to the bone, you need to update the item's position to match
If you need several objects, then make a proxy object that you update and parent to that
nods thanks for the confirmation
@trail hazel here you go!
hey I forgot to ask something
the other day I was in a world that was a complete disaster
it was very fun but without a doubt breaks rules because it vibrates the player and makes all the game controls unuable
so chernobyl guy if you're in here I sent you a friend request
that's about all I can do besides this
If you're out there, let's collab...
@ivory thorn You want the highest sample rate you can get, for the best quality, so you can divide it later. Also you can scale cubes with a Vertex shader, instead of actually setting their scale. Has some problems, but it generally works fine. Depends on what you want.
imo it looks ok with 64 sample and then I have 6 ranges of frequencies which output nice -0-1 float to use
Well yeah it solely depends on what style/look youre going for
e.g. I can take only low freq if I want mat to blink only on base or something
What I am not sure is the perf. impact of like 256 sample
For Unity getting the 1024 samples is no problem at all
You just cant do anything with them in Udon because Udon is way too slow for processing that
Thats why my world relies purely on shaders
Well then I will stick with 64 for udon 😄
If you have know any useful shaders I could buy for visualization let me know, shaders and black magic for me 😛
Same.
So right now im having a problem where i updated to the latest udon and version of vrchat but when i build and test its not updated and is using the last version of vrchat. i need to test a udon using the new is valid but it wont work since it keeps using the last version. Do i need to reinstall udon or vrchat to fix?
Does anyone know if there's a way to make it so that if you click a button, it'll change the skybox for everyone in the world and not be local only?
You'd need to use SendCustomNetworkEvent -> [NetworkEventTarget] All, "MyEvent"in some capacity
Ah ok. ty, ty! I'll try that, although I'm not sure how to use that node yet. XD
make sure your VRChat SDK Control Panel Settings point to your install of VRChat: https://docs.vrchat.com/docs/using-build-test#setting-up-your-settings
Thank you so much!! It worked!! 😄 😄 😄
i feel really stupid but I can't find it 😅 do you know what channel?
anybody know how to make it so people can slide up a whole wall? i've seen in some worlds where they probably put colliders in a very specific way so when you touch the wall you kinda get shot up to the top of the wall
like for a ladder or something
that udon yeet world had it
I will find the link

Does anyone know when the Udon will have midi?

thought it did?
hello
it is pointed to the install of vrchat. Its able to build and test and even upload. The problem is it just starts vrchat in a older version (the last version) (build 1040 i think). I can start vrchat fine regularly and when ingame it says the latest version. Maybe i just need to reinstall vrchat. if i cant get it to use the newer version ill try reinstalling udon/vrchat.
Is it normal to have Unity hang for 10-20s pretty regularly between tabbing over to edit some U#? Any tips for how to improve this? 😄
It happens every time I save the U# source. I think it's just compilation triggering because a file is modified.
You can disable this in the Edit > Project Settings > Udon Sharp tab.
Turn off "Auto Compile On Modify", and "Compile On Focus" and it should stop hanging until you manually compile everything
Speaking of, I should probably turn those off too - considering I compulsively recompile anyway 🤷♂️
it's because the editor has to rebuild
Hm I only have compile on modify on, but I don't always see the "n scripts compiled" log when it hangs, I guess it could be checking if they are modified being slow? But I'd expect that to be pretty quick.
I'll definitely test turning it off to verify if it's actually u# or not
well i didn't expect much when checking this channel today
But that's a very good piece of information
thanks you 👀
when you edit your scripts, unity has to build a version as part of Assembly-CSharp (UdonSharp reads data from the compiled version, as opposed to reading the source code itself). because UdonSharp has to use reflection on it to build the program sources in the editor, it must be present from the perspective of the editor as opposed to the engine, and so changing it causes all editorscripts to be recompiled and loaded
this means that during this freeze unity is effectively unloading all of your editor scripts, compiling everything as part of a single assembly, and loading it again (and so you might notice the VRCSDK 'flash' when this occurs)
Ah ok, a much better response, thanks!
the freeze is kind of unavoidable if you're doing quick testing, but what can help is making your unity install an exception in your antivirus and windows security (so it doesn't get profiled when the build tools start up)
You can go into your Unity preferences and turn off auto refresh if you don't want Unity to recompile every time you modify a C# script
i asked in the world dev chat about changing fog at runtime, apparently UDON can do it?
i want to have the fog clear during the night but then come back as soon as the lights turn on, the world is a remake of SCP-3008: Lone Survivor, but obviously modeled different ect, i have my day/night cycle somewhat working but the fog remains the gray color it is at daytime ruining the pitch blackness of the map, does anyone here know how to toggle fog off during the night parts?
the day is attached to a directional light if that helps
it uses the unity fog lighting system as particles would lag too much because of the maps size
even if its just changing the color of the fog id be fine with it
u tryna use an animation?
Or do you want to control the color of the fog by accessing the renderer with a script maybe?
the fog is using unitys lighting system, i considered particles but the maps size would make it lag like hell
the map is sized at 2500x2500
so X2500 Z2500
i want the fog to just not exist or be black at night
but during day
it would be the grey/white color it is now
i have my week day/night cycle working using a animation that toggles them on and off
@paper plinth
if theres another way to render fog id use it
as long as it doesnt cause lag
as the world scale is massive
I wonder if you could just control that aspect with a script like you can with material settings
maybe
unity scripting isn something i know how to do
don't know C#
just some basic JS and discord.js stuff
ive seen in the unity docs you can use scripts to change the fog during runtime
but
no clue how to use C# scripting
so the knowledge of that is useless to me
You can probs just do it in nodes, find the renderer and access the fog. I'm not in front of a PC or I would look
ill have a look later
for now i need to focus more on the map details
what i really will hate doing is making every single chair, table, bed and lamp, grabable and moveable, they will not have gravity but doing that will allow for people to make bases
Search by type or tag in unity and apply the pickup component all at once
why don't they add a way so keyboard players can can move there hands
so, there is technically a easy “live hack” where a desktop user can hold an object thats invisible and their hand is up, but youd have to make like screen graph and a lot of controls to make something like the AS desktop object grabber
thatd would probs be the easiest way to script something in since it can be done with extra keybinds and tracking
another way is to have them controlled as a emote in your menu
I suspect this person is just asking for a feature request for VRChat in general, which belongs on canny, and they're in the wrong channel
if your using 3.0
think of it like this remote but it controls each arm
@dapper lion
it is possible but you would have to set the avatar up to be able to do it
but most likely say bye bye to any VR usage
as they loose the ability to be arms that way
so your actual arms are invisible
yea, you can probs set up a radial that can move your hand around
probs add a enable and disable function
like that image
however that only applies to that avatar
We now have parameters if they are in desktop, 3pt vr or 6pt now in avatar 3.0, so you could run an animation in a way for desktop only, but I don’t know if those parameters are available in udon
i think wed have to move bone positions based on keys. but it would def be wonky since its never really been done
avatar 3.0 would def be the easiest solution. but it wouldnt apply to all avatars which is probs not ideal
I’m sure there’s a proxy_holding animation in av3 that can be copied over that the world could run but like you said it’s the desktop check, not sure of that status is available in udon, though it is part of the player component running at least client side so maybe it’s accessible by u#
if you had a hundred pickups, you could set one up perfect and just copy and paste the components into the other 99
so question, does udon worlds not support the default quest keyboard that usually appears when you click on a text box?
wait so if i setup a UDON code for one pickup, i could just clone it
and get like several hundred more?
Ideally for similar pickups you would have one script and maybe only change the references
I have a world with a few dozen little globes that you shoot at
fair enough
i can just give all my objects the same physics
as they do not really need anything different
as theres no gravity
does having alot of pickups lag the world at all?
just want to know before i start this
i know ones with physics will because good god the physics
but ones that dont shouldnt lag right?
yes, especially if they have gravity and they try to collide while synced
alot of the models in my ikea also use box colliders
as its cheaper
than mesh ones
few things use mesh colliders
i think even without physics, they add some performance drop, its just not as bad
yea
ill have to experiment
as i want to have a unique thing as i havent seen many worlds that allow for building
i think anything with rigid body usually cause a tiny bit of lag
and if you hve like a billion synced objects, that cause also cuase other issues
the only other SCP-3008 map is pretty bland, no hate to the creator, they had a good idea, just could have had better execution
thats what i plan to achieve with my 3008 vrchat remake
i mean i have my whole week day/night cycle mapped out
just need to get the fog to disapear at night
i think there is an environment slider somewhere but I don’t know if it still works or even exists
yea
my fog uses this option however
hold on let me load up unity
also my map allows for flashlights, but i will provide my own too
i cant open images but im assuming its the lightmap options?
in short my world uses the built in unity fog option
the one that fogs up objects but the skybox is left visible
its why i completely enclosed my world
i feel like that is exposed in udon but I don’t know if anyone here has done it before
thats how i am doing fog currently
i might just temporerally remove it
unless theres another way
this is what night should look like
pitch black
outside the lamps and overhead lights in the show off areas
without the fog though the world looks fking wierd
you can even see the top of the world
some world creators use particles for fog. I don’t know if youve considered that
i have
but uhh, the world is 2500x2500 it would be VERY laggy
if only there was a system like unitys fog but it wasnt
possibly make the particles only spawn near by
yeah but the other issue is they are not instant either
as the lights in the IKEA literally just go BANG full daylight
wouldnt be surprised if it sent people blind
you could also do ths stupid idea : make a sphere around the player that looks like fog. and all you could do is either edit the material or disable the sphere
that is a good idea but idk how i could fade it in
nor do i know how to make it sync to the player
and only that player
as you could overlap spheres
you can tell the sphere to track like their heads and make the sphere not sync between clients so everyone has their own sphere
i did see volumectic fog would work, but the issue there is i need to create a whole new project
and yeah no
and overall i have no idea how it would work
odd
or if it can be changed in runtime
when i eventually figure out how to make color of the fog change on day/night change ill do it
as since i have 3 types of weather now, Day, Night, and Blood night
blood nights happen every sunday night
if i ever get into adding any form of AI (as i know its possible)
ill add employees in
thatd be cool. but as i said, its like a really stupid idea cus im pretty sure there has to be a way to edit the fog. i just dk what the namekey would be
it's easier just to rip off people's scripts and remake them in graph
my quicksand is too real
there's literally no way out
how do I get the jump button? I can't find it on any of the input cheat sheets
well you need to set your jump impulse to something not zero
it's in the vrcworld prefab
one of the public variables for the world script
I don't like the defaults
Animation events
yeah if you just want it to switch on and off use an event
or black to grey
if you want it to get progressively darker you can hook it to a value, there's ways to multiply colors
I have a light that changes color by an animation already and I just went off that
but if you want instant bang dark use an event and shut it off or drive it off the same event that makes night happen
disco fog is pretty goofy
what does it toggle?
I mean on the light
what part of the light do you toggle to make it turn off
set active?
ok so game object is active
probably something like this but keep in mind active self will only check if the object is active because you set it that way
if it's not active because a parent object is not active then this will not work
just don't get fooled
yup
render settings
Hey im trying to make a system where you can select a player by their id and it do something to that player. But since udon as far as i can tell does not reuse id's so to prevent it from breaking i tried to use the new isValid for the VRCPlayerApi. Although when testing it always seams to go false. Am i doing something wrong here?
What's the recommended max length for a synchronized string?
Depends on pretty much everything. For a single object, and a single string the max length seems to be around 125 from what I heard. But its all fuzzy limits and tons of factors.
how are you saving / setting those IDs in the first place? FYI if you use the generic IsValid node instead of the VRCPlayerApi verson, you'll get a branch built-in to it
i just figured out it was just something weird in testing. i uploaded it and joined the world and it worked. Also im using jetdogs player list to show the id number and to select it im using a slider. im currently working on a moderation menu for worlds. I will most likely make a public version soon once done.
Gotcha, for mine the worst case right now is ~50 or so. Just wanting to make sure I don't hit the limit since it seems to end up breaking things when that happens 😂
There is only a limit for the overall outbound data and per behaviour. How those limits look like or which data type contributes how, is unknown to me, as its not documented anywhere.
Is Fire2 the jump button?
good show
badass
the grind continues
yeah I hooked mine into to a constantly changing disco light and it was real horrible
transform.position += Vector3.forward
what is this in graph?
@paper plinth
thx!
is there a nice simple udon mirror prefab someone can link me?
Move the items to a new layer, then go Edit > Project Settings > Physics, and tick only the player, and playerlocal boxes (and any other layers you want them to block) in the collisions matrix.
(for the new layer)
You might also want to check out the edge case of a player picking up an object that they're standing on. If it launches somebody into the stratosphere, you might need to add some Udon to turn a collider into a trigger while it's held.
The SDK comes with a prefab VRCMirror.prefab and some examples which you can copy/modify accordingly
I'm having a very interesting issue. I'm specifically working on a Quest world. And let me preface by saying I am admittedly pushing the quest 2 right up the the boundary of what it should handle. I have a lot of heavy meshes, particles, shaders etc, so it's certainly not the MOST performant world, but it's still pretty decent considering, and i've optimized quite a lot. The issue is, I have a few pickup items in my world that have scripts attached, (for instance, the basic rainbow QV Pens set) and when I pick them up, my frames drop A LOT. Now I know this is natural to some degree, especially since like I said I have a lot going on. HOWEVER there are a few aspects that tell me there's more to it than that.
- When I pick up the objects and move them through space, I drop to 11 frames per second. No more, no less. Exactly 11.
- When I first spawn into the world, I have this issue. BUT if at ANY point I respawn, whether it's by the respawn button, or by travelling through a teleporter, after that point the pens work perfectly. Consistently, without fail, the pens are broken, but only until I respawn at least once per instance. So my solution was going to be to just have the player automatically respawn upon arrival and problem solved. BUT unfortunately,
- this fix does NOT work if there is more than one player in the world.
So it's super wierd, and is not just about performance, but networking as well. I'm hoping this is a known issue with a fix. Any ideas would be greatly appreciated!
Does anyone know the exact position offset and direction of the VRC default UI raycast pointer? I have a need to replicate that info with precision as a custom raycast. I've gotten close but there are edgecase angles where it doesn't align. (Hoping momo or one of the other devs sees this 🙏 )
Hi so I am very new to making maps but I really would like to, currently I am running into not being able to load into my would. Did I do something wrong?
Are you using the Unity play button or are you using the VRCSDK Build & Test button?
Do you have the VRC Scene Descriptor script add to your scene? If not, try adding the VRCWorld prefab to the scene.
Thank's let me see if that fixed it
Also, make sure to update the walk/run/strafe values at the bottom of the inspector for the VRCWorld object. I've had times where the all 0'd out and had to change them to be able to move in game lol.
Yes thank you it worked
Ok now quick question why cant I collide with the prototype props?
Are they just their for scale/model of what to make?
prototype props?
Oh its a model
It's these things that come with VRCSDK
anyways thanks for the help
how does onRenderImage working?
sorry to say that it's not as simple just an offset and direction. However, you can add an invisible UI layer over an object to force the pointer to show and then accept that event and send it along
More specifically I need to be able to get/recreate the exact pointer hitpoint on the UI's collider so that the player can interact with the UI whilst holding a pickup, which normally prevents the UI pointer from showing up.
It's explicitly just a visual feedback problem related to pickups and UIs.
ah gotcha.
I don't think I have a solve for that while keeping the UI, but you could add your own actual raycast to an object with a collider
That's what I'm doing atm, but the alignment is never 100%, and I keep getting reports that players find it's accuracy problem annoying.
I'll re-angle the question maybe. Is there a way to get the hit position of the raycast off of a UI collider? I can fake the source point easy, but the intersection is what's needed for the "phantom" pointer to aim properly. if not that's understandable. Just spit-balling for a raycast of hope.
not as far as I know, sorry. But I appreciate your pun fwiw
Alright. Thanks for responding. I'll try to find a work around...
Unrelated curiosity: [Is there a/what is the] maximum number of uasm instructions that can exist in a single script?
Yes, there are a few different limits you could run into but I don't have numbers. Would be nice to document somewhere but it's not a common occurrence to exceed them afaik.
I think the instruction limit is pretty much just uint max so around 4 billion, which you're probably going to run into other issues with beforehand
The heap has a maximum size which people used to run into, but it was raised to 1 million heap values which again you'll probably run into scalability issues before you hit it
Neat
Before I'm looking into stuffs i'd like to ask here, is there a simple way with udon to know if a player is currently calibrating his FBT ? :o
That's a really good question honestly would allow for something like showing a automatic mirror in front of the user for calibrating
Def possible but not sure how simple
That's what i had in mind :)
Spawn a local small mirror for em, i'm a bit annoyed about having to look for one when my tracking decide to yeet itself
If I was on a computer rn I would try to come up with some ideas for you but sadly I'm heading to work
all good eheh, i'm heading to bed tbh right now ^^
Potentially you want kinematic objects and then script the interaction with each other, like making the cubes stack up straight
Yeah then a lot of game physics won't act on the object at all
If you're trying to create building blocks that snap into place, that is
As a rec room player I have opinions on how base building should work
Because it ends up working and looking like crap lol
Because the cube stacks aren't straight T
Straight
Looks like a stack of boxes in a storage unit
Instead of a base
There was a guy in here who did legos
His only issue was you can't parent two objects to the same thing at the same level
So linking a 2x2 to a 2x4 was a little problematic but he was so close
Including having the resulting object respond to physics
Those are pretty straight
lol
You can get around that with baked area lights and such...there are big boys who will delete the directional light and build it all themselves
Are those chairs pickups that you can't sit on?
Thought so
In that case I think you're good
The trouble is if they're kinematic you need to script them so the orientation is right when you drop it
Like put y on the next object down and orient it to the nearest 90 at least
Or 45
And orientation is pretty easy, just pick an object's rotation and use it for everything
Take the eulerangles, pull out the right axis, round it to the nearest 45, plug the noodle back in
One thing that helped me out quite a bit in the beginning was creating another scene in the project and importing pickups, and putting settings on in different ways, and then interacting them for a while to see how the settings affect the way the objects move
I'll release the quicksand prefab today maybe
???
They'll put out their real-time light
Well I don't think you can set them to mixed or baked if you're going to move them around, I don't think it works that way
Put a cube at world 0,0,0 and put everything at scale 0,0,0 world position 0,0,0 until you need it
You can also make an inside-out dome and set it as a trigger and respawn objects that hit the trigger.
I can’t tell by the screenshot, Is the object distorting when moved
Make sure all of its parents in the hierarchy are scaled at 1,1,1
I just had this issue last night
ive seen that before. I don’t know how people fix it tho but I think 🤔 its cus of its armature or something
they probs have something extra for some reason like armatures or weird LODs
also theres this weird glitch that rarely occurs when you change your avatar. certain meshes will expand or shrink depending on avatar size. I don’t know if that could also be happening
is the thing static?
I had the same pickup object scaling issue last night and it was fixed by changing scaling of patents to 1,1,1
Oh sorry I typed that already
makes sence
The best way is to just play with it until you find the combination that works....i ended up ditching pickups altogether
i dont think ive made a pick up object on purpose for 2 months now
This all may be better for #world-development for progress updates to the world
thats cus world dev was supposed to combine both basic standard dev kits
its not sdk2 exclusive
i dont see that
hmm odd, but i dont really see any reason why itd be sdk2 only. plus it says “questions” not discussion sadly so I have no idea then, either way id post in world dev as no one reads the description either way
i dont even see a description
ye
In some open source code I saw this check included, is there a particular reason you might need this?
I figure this wouldn't be called if you are the owner, but is there a possible race with ownership changing hands?
@scarlet lake you've been flooding the channel a bit - you're welcome to share significant updates in #udon-showoff and ask udon-related questions here, can you please take your 'dev blog' style updates to another channel?
Ah, interesting. I don't know of any situation where this event would be triggered on the owner of the object, it might just be a case of being super-careful.
This was seen in MerlinVR/USharpVideo if helpful, maybe they know 😄 There's also some interesting logic around deserialization where they use a counter to try and avoid some problems
I know why that is
And its sort of a bug
After becoming owner of a gameobject again you still receive OnDeserialization events from yourself sort-of
Its a little complicated, but essentially you will receive old data from yourself. No idea why that is, but it has been a long standing bug that has been reported multiple times afaik.
So is it good practice to throw that logic into any object that transfers ownership a lot with synced variables?
I definitely saw that behavior when I tried to implement multiple people controlling the default graph video player
Ohh actually I think Im mixing it up with something else
There is a few weird bugs regarding networking at the moment, with multiple different guards
that is just a guard to make sure that nothing unintended happens-
Yeah there is another way where you just ignore the first few deserializations after becoming owner
but this should be effectively the same and shouldnt cause any problems
Follow up question to improve my understanding of this logic, I thought OnDeserialization was only called when a variable was changed, how does this counting up to 10 work if there aren't 10 changes? Does it send on an interval or something instead?
in the current networking system, it's more of an interval, yes. It can be called when any variable changed, not tied to a specific one
Cool cool, is it any (synced right?) variable on the specific object with the handler or on any object in the scene?
VRChat uses a (probably) heavily modified version of PUN. Their networking architecture is very similar to that of general P2P, however the data goes through a middleman (the Photon Servers).
Currently Synced Variables of some behaviour are serialized by the networking owner of that behaviour every "network frame", send to all other users connected to the instance/room and are then deserialized on the corresponding behaviour.
There are two events called "OnPreSerialization" and "OnDeserialization" relevant for this. Note that serialization only takes place when two or more users are connected to an instance.
Network Events are essentially named RPCs. They are sent from an instance of an UdonBehaviour component to the corresponding behaviour on a remote client.
Thats pretty much all there is to know about the fundamentals of VRCs networking. Ohh and networking data is badnwidth limited, per-variable and per-behaviour and there is an absolute global limit across all behaviours. ( I believe)
That is the message I typed out a few days ago
Thats pretty much all the generally available knowledge compressed into one paragraph (bugs aside).
Detect bone rotation to see if T posing? Lol
🤔
how does one make it so these textures are the same scale?
#world-development may be a better channel for learning about textures and uv mapping
is there no gameobject.get tag?
like if I want to check a collision and see what tag the other collider is
get tag
lol oops
oh you can't, got it
I have a avatar I didn't make that got banned for lewd reasons I was wondering if there is a way for me to get it "revived" without its emotes?
For like a second chance
contact http://help.vrchat.com/hc/en-us/requests/new for support
THANK YOU
check #faq to learn where to ask different questions. This channel is for questions about Udon, our custom programming language for VRChat worlds.
ok
can I make an array of float arrays?
we don't support multidimensional arrays at this time, sorry
all good I don't know how to do it anyway thx
would have to look it up lmao
tryna make an inventory system with object IDs
in the past I would just make my own custom data structure but I don't see where you can do that either
the only usable collection right now is an array.
that's a lot more than they gave us with a slc500 honestly
we don't offer custom data structures as every type has to be compiled ahead of time
there's tons of array types
the closest thing to a custom data structure is the symbolTable on an UdonBehaviour itself, which is a string-to-object lookup
we generate every Array Type ahead of time
I think that's probbaly the best I can do
it's one of the reasons we've held off on introducing Lists. It's not just List, it's List<bool>, List<int>, List<object> etc etc
and Dictionaries...oof
I can store at least 9 floats in the transform of an empty gameobject if I can figure out how to find the object
like if I can concat the playerid onto the end of a string like Inventory1 Inventory2 and make those gameobjects the data structures
well,you can inline your values instead of arranging them into a multidimensional array. Like if you wanted an array of three float[3] arrays, you'd just make a float[9] and just offset your lookup
automatic sync will not be coming, we're removing that disabled button.
you can sync it yourself
so I get the player id that's holding the handle and I multiply it by 10 to offset the array, and then add an object ID from 0 to 9 and increment the integer to count how many I have of each ID. It's an array of 1024 ints. Any opinions?
in the above I harvested a green flower
lol just rip off other folks
Did you ever solve this?
Just been hit with this myself and struggling to find why
U need to restart unity
That's a little different lol
The problem is in your script
Did you just install Odin Serializer?
There aren't a lot of programming contexts where you start with literally nothing.
At minimum you have templates and standards documents to guide you, and requirements and specifications that define what needs to happen and how.
So it's natural to use other people's stuff. It's never going to be a perfect fit but it's pointless to blaze trails when there are well traveled roads for routine stuff
What does animation syncing actually mean?
Syncing values of some kind, and adjusting animations locally based on the values.
Is there any way to make it so a world "remembers" your progress, somehow?
nothing built-in to support this, yet. I've seen some people offer a text box that generates a string based on some world data that you can copy to save data, and paste to restore it.
yep
At the same time, it may be a bit intensive with what I want to use it for
ye
deleting the SDK then reimporting it
Can U# access and/or set local avatar synched parameters? Like if a script knew what to look for, could it read/write that parameter locally on the player.
if so then the world could use a password avatar that can use the av3 128 bits now to set the parameters that save locally, and then could be read at a later time. the avatar is the save file. I think I know the answer though
Udon cannot directly read from, alter or affect the player character except for the API available on the VRCPlayerApi type.
Does anyone know how many youtube videos can be played in one scene with UdonSyncPlayer (Unity)?
I put two UdonSyncPlayer (Unity) in the scene, the second one won't work
video players are rate limited to loading 1 URL every 5 seconds, this limit is global for your entire map
if you have multiple video players you need to stagger their loading of urls
What does it mean?
If I have one video of 30 seconds and another video of 20 seconds, how do I stagger their loading times?
it means after you load video 1, you have to wait 5 seconds before you attempt to load video 2
so dumb question to ask but what is UDON
and why has it come to vrchat.
is it some new scripting code? some kind of editor?
Then why do I check the loop parameter, the film will not loop, and check auto play, the beginning of the enter also did not automatically play
because if you just put 2 video players down
when they start playing at the same time, 1 will succeed, and the other will fail with a rate limit error
Using the Prefabs The easiest way to put a Video Player in your Udon world is by using one of the Prefabs, which you can find in Assets/VRChat Examples/Prefabs/VideoPlayers.Both of these prefabs will play a video of your choosing, synchronized for everyone in your world. They won't loop - the graph ...
see section on rate limiting
if you're going to have more than 1 video player, then it is a must for you to handle their loading in your udon behaviors, be it with a delay, a queue etc
But Udonsharp doesn't have the syntax of IEnumerator or yeild
you're going to have to handle the logic of it yourself with whats available, to ensure a url is only loaded once every 5 seconds
Okay, I'll give it a try, thank you!
Is the object syncing system changed at last update?
It seems maximum time of position lerp became unlimited at last update. That means any object teleport are replaced lerp movement that takes the time of last position update (on non-owner sight).
Example: If the position is updated after 30 second of last update, the object moves to synced position taking 30 seconds on non-owner sight
@scarlet lake Maybe make the audio source only play if you're inside collider bounds
but I don't know if that plays for all users all the time or just the one who needs to hear ti
it
how does have a switch to like toggle between 2 objects
like if one is off the other is on type thing
have it toggle 2 objects at once, so it disabled the enabled and enables the disabled
sorry, not at pc until like 10 or so more hours
if you have udon sharp, there should be a interact toggle script that allows you to do more than 1 thing
I made some switches in #udon-showoff lol oops literally almost tagged the wrong person @misty hedge
i didnt tag anyone
I can't find it, sorry could you send me like the message link?
This
You can see different ways to select
And then just wire your behavior to the output of the switch
Hello! I'm trying to debug something that needs OnDrawGizmos, but apparently there's no a node for it, which is kinda weird considering we have the other nodes to draw gizmos, is there's some other event I can use instead of OnDrawGizmos or I can't use those nodes?
I thought those were added a while ago...are you sure youre on an up-to-dare sdk? x)
Yup, I've downloaded the latest one, I have the nodes to draw Gizmos (like DrawWireCube and other stuff) but there's no OnDrawGizmos, so I can't actually use them lol
That was noted before...and I thought that they had actually added them...
came to brag a little about gizmos
Oh, i forgot, the code for this example:
void OnDrawGizmos()
{
Gizmos.DrawCube(transform.position, Vector3.one);
}
So what is it?
A weird cross between unity and udon functionality. Experimenting with my IL code postprocessor (or a compiler?)
Does anyone know how to make pickable objects global?
I think there's a check box for synchronize position
In VRC Pickup?
Mmmh, if not there, then on the standard VRC behavior / (Udonbehaviour as THH said)
its on the UdonBehaviour. Just add one with an empty program
Quick question, I want to set the spawn points for my world, so I go to my SceneDescriptor, but there's no way for me to tell it which objects I want to set as spawns
Is there something I'm missing here?
Spawns is an array, it only gives you slots if you set the "Size" to something greater than 0
you can
on interact
use a right thumbstick up (bool) to cycle it through your rotations
I do this on the switches I posted above, there's a slider that's 0-10 integers
for whatever reason, when I harvest a plant from my harvester, my text display freezes in position and stops letting me turn it active or inactive
doesnt' matter what hand I do the harvesting with
that's the collecting script
for some reason it causes my text display to just freeze there
When you accidentally leave Unity in play mode overnight https://i.imgur.com/UEJSjo3.png
re gizmos: you can register a custom event named exactly _onDrawGizmos in the graph and it will fire the proper event to draw gizmos in Unity. Udon doesn't register the event as a node, but it does exist and gets called if it's named properly. The main downside which makes it very limited with that method is that Udon code does not run in edit mode so you need to be in play mode to see any gizmos. So they're only useful for debugging game logic and aren't viable for providing editor markup. If you're using U#, there is handling for running gizmo code from edit mode via the editor scripting systems https://github.com/MerlinVR/UdonSharp/wiki/Editor-Scripting#using-gizmos you can also use Handles similarly
anyone know how to set up that thing where video players "emit light" based on the video?
I believe you'll want an Emissive material: https://docs.unity3d.com/Manual/lighting-emissive-materials.html
why is the public variables box glitched
i checked for errors in consoles, it doesn't have any errors
does it look like this on the actual UdonBehaviour or just the program asset?
how do you check that?
i just picked up udon recently but this prevents me from doing more progress to the world : (
It looks like you've selected the program asset in your project. What does this program look like when it's actually on an UdonBehaviour in your hierarchy? The UdonExampleScene, for example, has lots of UdonBehaviours on objects, do they have this issue?
i'm not sure where i'm going but that's the example scene and the public variable is bugged for one of the things
i'm probably lost
i'm probably not looking at the right place maybe
It looks like you're just getting started with learning Udon. That's great! I recommend you watch this video to learn how to open, inspect and build your first Udon world: https://www.youtube.com/watch?list=PLe9XHNvXcouQjg5GULWGLj1tMzeythnQi&v=8yaQY0arCnc&feature=youtu.be
Once you're up and running, I recommend reading through the "Udon Node Graph" articles on our docs which show how to use the node graph to build your programs: https://docs.vrchat.com/docs/udon-node-graph-upgrade
i already read the docs, but guess i'll reread again : |
need to remember some stuff again
i was just trying to build a mirror toggle button
in this case, you need to click on a Gameobject in the Hierarchy window instead of in the Project window.
The example scene has a mirror toggle button you can use as an example
Hey there. Just a quick question. What exactly is the difference between "is Master" and "is Owner" in Networking?
Owner is the map owner and Master is the instance Master
https://docs.google.com/document/d/1PuqqbIalSNLvOISgVyRKtPOHY-8i6ZH6vLJTTIF9rAc/edit?usp=sharing
I will refer you to this document I wrote
VRChat Content Creator Glossary - written by TheHelpfulHelper Disclaimer:This document is not officially affiliated with VRChat and should only be used as guidance. I am also not a member or part of the VRChat Team. Some of the terminology or information might be outdated, inaccurate or mislea...
generally, you want the owner of an object. The Master is either the person who started the instance, or the person who took over from them.
IsOwner refers to the "Object Owner" section
while IsMaster refers to the "Instance Master" section
They will be the owner of all the objects when the world first loads, but that can change. Generally, you care more about who is the current owner of the objects.
Okay. Thank you. That's what I needed ^^
How do I send a custom event to another GameObject? SendCustomEvent accepts an instance, but it is of type IUdonEventReciever, which doesn't even show up in the type list.
The graph is not telling you the whole truth there, UdonBehaviours are IUdonEventReceivers, so you can send it to an UdonBehaviour
So if I get the UdonBehavior component of the object I want to target and connect that to the instance, I should be good?
Yes
Cool, thanks!
When you send custom events, are they executed in the order they're sent? Do I need to be wary of race conditions or multiple threads?
Udon runs exclusively on the main thread, for local custom events they are executed in order.
What's the best way to trigger a particle emitter with Udon? Just needs to fire once consistently when told to do so.
so i just started up my game and all my models i uploaded veiw points are broken in game when the view point is in the eyes and such, public models views are find but it is broken for my models idk why
You want avatars, this is for Udon worlds.
sometimes i wish the Local testing was an actual local testing.
so i could still work on stuff when the servers are down
The testing is actually local. But VRChat is a SaaS type thing. You cannot use the service without logging in, which requires a connection to their servers.
Yush, it's a bit sad tho :(
I used to go with at least a good 4-5 days w/o internet a year ago, could've used this time to do a lot of testing instead but meh
The servers usually get fixed pretty quickly so
Just gotta wait
are the servers down right now or is it just my game?
Servers are down but @drifting sage is trying to fix them
oh ok
Yeah, hm.
^Happen when i'm trying to upload an update to my world, unsure of what's up, guess it have to do with the servers going madlad earlier :(
Any possible way to sync door position/animation?
I have a particle emitter that emits a 1s program when I set the gameobject active and so when I want a little burst of particles I just wake it up and put it back to sleep when it's done
Oh I could fudge that easily enough with an animation, I was just curious as to if there's a proper way to tell a Particle Emitter "trigger once with an X particle burst")
That's all settings
Any easy way to add additional launch options from VRSDK + Unity when running "Build & Test". I'm trying to see Debug.Log statements, anyway to turn these on for debugging? If not, how does everyone debug udon graph programs?
i think can use physics on roller coaster for udon?
Anyone know why this happened when I added the Billiards Prefab in my world?
make sure it's at Y=0, and you set up the collision layer. Also it needs udon sharp
I think that issue is fixed in xiexes fork of the project
collision matrix is still needed
The debug options are passed along automatically, make sure you have the path to the VRChat client properly set up in the control panel
What is Debugging? Debugging is how you learn about what's going on under the hood in the VRChat client and your world. It's a key skill to develop for programming in general, and for building your worlds. VRChat Logs When you use the VRChat client, it saves logs about things that happen like worlds...
how do i make a button with udon to switch mirrors? like, i have a button for a HQ mirror and one for LQ. i dont want to accidentally have 2 mirrors on at the same time so how do i get either button to turn off the opposite mirror?
i currently amd using Vowgan's object toggle thing
Use a branch
hopefully this is something simple...but I've got an invisible box collider that is used to turn a mirror on when someone enters the box. The issue is, if a second person enters the box, the mirror shuts off for the first person, and turns on for the second....any ideas what I might have set wrong?
So i was trying to update my world and this happened. Failed to delete previous version. I doin something wrong? Started yesterday when the servers went down.
You'll need to contact support or just upload to a new id
Uh hello there. I have a problem with using buttons to animate a door. Is this the right channel for that?
So here's what's right: I have the buttons working AKA you can press them, the door has an animator that also works, and the animator has a boolean that lets you transition between states.
However, the problem is that I have no idea how to code it where the boolean of the animator changes when you press a button.
I've tried several times in C# (even using a C# to Udon compiler) and I don't know Udon enough to code it in there, so that's where my trouble is
If you're doing it in Udon#, you could do it with just an assignment like doorToggle = !doorToggle; (I think. I haven't used C# or Udon# really, so going off my experience with other languages). In vanilla Udon, you will need to have a boolean variable for your door. Let's call the variable doorToggle. In Udon, you'll hold ctrl and drag the doorToggle variable onto the graph to create a node that sets the variable. Then, create a new node by pressing space. Navigate through the menu to Boolean > UnaryNegation. Drag the doorToggle variable under that (not holding ctrl this time). Connect that to the left hand input of the UnaryNegation. Then connect the right-hand output of the UnaryNegation to your Set doorToggle node. That should implement the toggle for you. From there, create a Branch node connected to your Get doorToggle node. For the true branch, play the door open animation. For the false branch, play the door close animation.
Okay so I have it but Im unsure if this is what I need. Let's see
How do I add this to the button?
You create a new Udon program and then add it to your button's GameObject as a new UdonBehavior component.
Nah, I mean a UI Button
Ah, you'll need to create an Event Interact node.
Where shall I place that?
First, you'll need to press space in the Udon graph editor, then choose Event > Event Interact. Put that on the left-hand-side (LHS) of your Set doorToggle node.
So this will make my button change the boolean each time, it's pressed, right?
yes
Unary negation basically switches a boolean value on or off.
If it was on (true), it will be switched to off (false). If it was off (false), it will be switched to on (true).
Like this right?
yes, that looks like it should do the trick.
you will also need to get those bool instances from the door's animator itself though.
For the part after the branch, I mean.
How shall I get an instance?
First, you'll need to have a variable for your door's GameObject and make that a public variable. In the scene editor, be sure to assign the door itself to the door variable in your Udon Behavior component for the button.
Next, in the Udon Graph editor, you'll need to get the boolean for the open parameter from your door GameObject's Animator component.
To do that, drag your door GameObject variable somewhere to the right of the branch. Then create a GameObject > GetComponent node. Create a Type Animator node under that, and connect that to the type input for the GetComponent node.
Connect your door GameObject's node to the instance input of the GetComponent node.
Under all that, create a Animator > SetBool node. Connect the GetComponent's Component output to the Animator > SetBool node's instance input.
For the Animator > SetBool node, be sure to set its drop-down menu to (string, Boolean. Set its name input to open or whatever the name of your animator parameter for it is.
Then, drag your doorToggle variable under that to create another Get doorToggle node, and connect that to the value input of the SetBool node.
So stupid question, how do I connect the instance of the door to the code?
You click and drag the little circle on the right of the door's node to the LHS circle next to the instance input of GetComponent.
If done right, you'll have a line connecting the input and output for those nodes.
So everything should look like this, right?
Almost. Thinking through it more myself, I realized, you don't really need the branch. You can just connect arrows from the Set Open node to a single SetBool node (the uppermost one you have in your graph).
So, you should end up with a program that looks like this:
Can I use this script on another button controlling another door?
You sure can!
Just in the scene editor, reuse the same script in the Udon Behavior component, but assign a different door GameObject to the door parameter.
You mean the hierarchy?
By "door GameObject" I mean the object for the door itself, which presumably has your animator with the open close animations tied to your open boolean parameter.
Shoot, it didn't work. The door doesn't open when you click the button. Anyway to check if the variable changes while playing?
You could create Debug > Debug.Log nodes to try to write your variables to your VRChat log file.
Imma try to see if I can get it to cause the door to just open then progress from there to make it open and close
What does your animator look like?
In your program, is your SetBool's name "open" or "Open" (case matters)?
"Open"
ok, the animator looks fine then.
Coding can just get stupid at times, lol
Im gonna try out the "play" function and see if I can get it to open
That would certainly help to make sure that animator itself is working.
Its best just to see if everything is working
In the scene editor, your button has the Udon program attached to it in an Udon Behavior component, and the door object set to its door parameter there, right?
I dont see anything there
Looks like you need to make your door variable public.
In the Udon Graph?
yes
Nope, it's public
You're sure? If it were public, there would be a Public Variables section under the Open Udon Graph button.
I think there's a problem with the compiler? It says "Object Reference not sent to an instance of an object"
In the Udon Graph editor, you should have this under your variables:
Can you share a picture of your Udon Graph program again?
No, that doesn't look right. Sure it would set your animator to the Door Open state, but it makes no change to the Open parameter, so it would immediately go back to the Door Close state.
I would recommend that you have your Udon Graph set the Open parameter of the animator instead of directly setting the Animator's state.
?
That's closer. That would make it so the button always opens the door, but never closes it.
Im just trying to see if it can open it
ok. Those are good first steps then.
But Im still getting the "Object Reference not set to an instance of an object" error
To be sure that your Door variable is set to public, could you expand it out?
It's public
Hmm... that looks fine there. It's strange that in the scene editor it wasn't showing the public variables.
Should I attempt starting over?
Maybe try removing the Udon Behavior component from your button, and try adding it on again.
It could just be a hiccup with Unity.
HAHAHA, It is the STUPIDEST solution I've ever seen. Apparently, I had 2 different programming scripts with the same name and they messed with each other
I see the Door variable now!
Oh no! I guess that would do it. XD
nice!
Now all you need to do is tie in that UnaryNegation bit and you should have a working toggle.
anyone experienced this?
The servers are crapping their pants, don't worry
i had this happen last night aswell, not during this outage
Try swapping the upload ID on the VRCWorld instead of overwrighting the old one.
Alright, new problem: it won't close
this is so odd
Correction: it does close. It just loops the animation
In the earlier screenshot for your animator, I didn't see the condition for the transition from Door Open to Door Close, but can you confirm that it is Open equals false
oh
Lets see if it works now
Make sure your Animation Clip file itself has Loop disabled.
It was on lol. I must say, it is a bit weird at times such as like it takes a second for it to toggle again. Though that could be the animations being weird, it works!
Huzzah!
So once I finish on some details, I need to add one more thing: a locking mechanism
I presume that'll be controlled by something outside your button?
It'll be a secondary button. I was thinking it could be another boolean that changes another animator boolean, but it uses a custom event when pushed instead of Interact
If you're just changing another boolean parameter on the same animator, you might not need to deal with any custom events.
You could just add it as another condition on the transition from Door Default and Door Close to Door Open.
You would need to modify your Interact event's workflow to check for whether it's locked.
That's already done with the animator transition conditionals
ok, that should be fine there then. Do you have your lock button sending a Lock custom event to your toggle button?
Udon looks really complicated to someone who's used to straight up text programming instead of GUI stuff
Is there some kind of non-gui version of udon or that the only way to use udon?
It is... I come from a text programming background too. XD
Would the correct thing be UdonBehaviour.SendCustomEvent?
Yes, you would use SendCustomEvent. You'll need to be sure to set the instance input of that to the UdonBehavior component of your toggle button.
Otherwise, it'll use the this object by default.
How can I be sure?
Your lock button's Udon program will look something like this, except remove the evtName node and just hardcode "Lock" for SendCustomEvent's eventName input.
UdonSharp
You would set your door toggle button as the evtTarget public variable.
UdonSharp? Sounds like a version of C# w/ some kind of Udon API and limited C# access?
Could I have some kind of link or page to read up on it. Sounds fun, really want to try it out
@scarlet lake https://github.com/MerlinVR/UdonSharp
Oh no, it's being weird again. I have the "Object reference and instance" error again
What does your lock button's program look like?
You don't have anything flowing into your SendCustomEvent node.
Do you mean to connect an Event Interact to that?
Wait... am I being an idiot or should I have just made a new script for this?
If this is controlled by another button, you should probably make a new script for it.
I did and now they both have Interact and the same error
Oh, no, lock door doesn't have it 🙂
Its called NullReferenceException
What's your lock button's script look like?
Are you using the same programs on the Udon Behavior component for both your toggle and lock buttons? You should have separate programs for both of them.
I have Open and Close Door on one and Lock Door on another
We already established that your Open/Close script was working on its own. Can you share your Lock script and can you confirm that the open/close button object is passed in as a variable to your lock script?
Here is my lock script
Ah... For your lock script, you don't event need the Door variable. You can just delete everything to the right of the SendCustomEvent node. However, you do need a variable to take in your open/close button. You need to connect that to your leftmost GetComponent node instead of the LockButton. Since LockButton is this anyways, you don't need LockButton either.
Huh? Isn't this script supposed to be used to a new button that controls another boolean in the Animator?
You could do it straight through just the lock button's script without custom events, but I got the impression that you wanted to do it with a custom event sent to your open/close button.
Also, how come I need to add in the Open/Close button to the GetComponent?
The SendCustomEvent node needs an instance of an UdonBehavior object. You need to obtain that as a component from your Open/Close button.
Oh! So the GetComponent is actually where the customevent will go to?
Sort of... it's the UdonBehavior object that gets forwarded from the GetComponent node that goes to the SendCustomEvent node.
Alright so CustomEvent is what I use to receive the SendCustomEvent?
OH! resetting Unity does the trick 🙂
Cool! Got your locks working then?
Too good. The door doesn't open anymore, lol
Like it doesn't open at all, or it doesn't open after being locked and then unlocked?
Doesnt open at all
What do your scipts and animator look like now?
Nothings changed to stop it from working
I took and put back in the udonbehaviour to see if that could work
Nope
So world uploading is broken.. ? PERFECT -_-
...Im an idiot
You figured out the solution?
I didnt have it connected to the click of the button
I should also fix the delay of the closing animation
The closing animation delay might just be something to do with the exit time for the transitions in your animator.
Hmmm, lock isnt working
but I can open and close it
Yep, I had it on a different toggle when you click it
You got it sorted out?
I'd like to congratulate everyone and say it works!
Huzzah!
hi i wonder can make physics like roller coaster made out udon. any idea?
Sure, that's just an animation
?
can i move my arms without vr?
.
@scarlet lake > #avatar-help you can via animations and puppet menu which av 3.0 provide https://youtu.be/VX-BoYUrUjM
may be a stupid question but Ionly started Udon.. can a gameobject have more than one udon behavior script on it? I got an area trigger that I want to run two concurrent behaviors and doubling up the area trigger with a clone doesn't seem efficient
I want to teleport someone, but not by interaction but by trigger. I want to check if the thing entering the trigger is a player and not something else. I was thinking of finding a "player" component in the collider/his parents but im not sure what to look for, nor that it is the right way to do it. Suggestions ?
(oh thats udonsharp btw)
If you want to teleport the current player you need to check player islocal
I dont have a player at the start, I have a collider :|
And on playertriggerenter teleport to the (world) pos/rot you desire
Ohhh
Then you want ontriggerenter
im curious about playertriggerenter, but ultimately I may need my teleporter to teleport other things as well
If you need the collision info then use oncolliderenter or whatever that's called
XXX playerObject = other.gameObject.GetComponentInParent<XXX>();
}```
what should I use for "XXX" ?
Either put var to let the compiler decide the best type or mouse over getcomponent and see what the type is in the tool tip. Documentation should also tell you the type.
Either im confused or there is a misunderstanding.
Any kind of gameobject can enter my trigger. When that happens, I want to check if that object is a player. So Im looking into the objects components to check if it has a "player" component. But I dont know what is the name of the component im looking for.
So that if the object has that "player" component I do something, otherwise I do something else
Udon has a special method for detecting collisions with players. The one that youre looking for is probably "OnPlayerTriggerEnter"
Wont the generic "OnTriggerEnter" method be triggered as well there ?
yes. so what?
so if I have code on OnTriggerEnter, and I want to check if its a player or a pickup that entered my trigger, I still need to check for that
or ... I instead of making conditions to check if the "object is a player", I could make conditions to check if the object is any of the non-players types the teleporter could accept. I guess that would work
Well VRChat could have gone with a different way of providing a means to convert a player object into a playerapi, but they didnt. So yeah.
kinda realted to my question above with this too, if I want multiple udon behaviors to run in a trigger area, should I duplicate the trigger area/collider (that doesnt seem optimized), or is there a way for the object to have multiple udon behaviors on it, I can just edit the U# to condense the behavior if needed but I don't want to do that if I don't have to
Momo why the heck does GetPlayers return players in completely random orders.. ? -_-
Also, is there a way to change world master within a node/script, no options seem obvious. Would like to have master restored when the intended master may rejoin
UdonSharpBehaviour doesnt seem to have a OnPlayerCollisionEnter(), do I just type my method this way and hope for the best ?
void OnPlayerCollisionEnter(GameObject go) { ... }
I don't think you can change master, but you can always set ownership of any specific GameObject with GameObject.set Owner
pretty much all master ever matters for is network ownership
and room kicking
Oh, is that how that works? First player in and then inheriting masters can instant kick? Didn't know that
I definitely wish there was more control over that
yep they have a 1-hour kick option special to them without vote. Lots of troublemakers have antikick though, but I'm contemplating in the event someone troublesome gets the master role. Would love to have a button to assign master by whitelist
As for this, no, I don't think you can have multiple UBs on one object. I might be wrong, but it'd be confusing if that were possible
I don't think there's really any problem with just copying an object so that you can have another, separate collider component
The soccer balls in Soccer Practice have three separate colliders on them, active at different times 😅
(ok, found this : "public override void OnPlayerTriggerEnter(VRCPlayerApi player)", testing it)
got it
I'm just trying to limit ways troublemakers can distrupt events. if Master is protected then it is what it is. issue: we have events where 1-3 troublemakers join on friends and distrupt. Plan to have a space 6000 meters away that will contain someone by a pre-set troublemaker list (on-enter area trigger to teleport them, and on-exit at the teleport area to pull them back in) or if someone new needs to be added, then an object a whitelisted player can spawn and collide with the troublemaker to add them to the troublemaker list. no idea how to graph that though so will just build on U# whitelist examples I have. Hopefully moded client teleport movement will still trigger on-exit of a trigger area. if not then I got to rethink this. I don't want the player space to be one collider with a constant check since that seems inefficient, only the spawn area.
Alternatively, you can have an object that operates only on the local player (all of them) periodically, or in an event that gets triggered for everybody's instance if you want to drop the ban hammer, such as the trigger system you were talking about. If they're a banned display-name, then flip a local (unsynced) boolean.
That boolean is checked in fixedupdate, and if it's set to true, then teleport the banned local player into to the ban-zone each frame. It's just local, so any extra performance cost of teleporting 50 times a second is shouldered by the person you don't care about, and it gets around modded clients potentially being able to teleport away.
You can also set their voice far-distance to zero, so they're completely muted, even if they do manage to escape.
Of course, this system amounts to (counter?-)griefing, but there's no native world-moderation tools, so we're stuck with these double-edged swords for now.
thanks for the review of that
I think instead of an area trigger I'll do a slow march down the player list periodically and set the boolean
If the master is able to dynamically "ban" people (eg. through a menu), then it's probably most efficient to run through the player list only when the banning event fires.
Unless you're hard-coding the ban list, in which case it's more straightforward for you, and you can just check OnPlayerJoin.
I may do both, a hard-coded, then a player list that a whitelisted player can bring up and interact with to ban or unban. this avoids using a collider trigger object which could go wrong
I'm still very new to udon so it will take some time to navigate this, but I do appreciate the feedback on this
Instead of also having a whitelist, it might just be easiest to let the instance's master control banning/unbanning. That way the griefers/cheaters can simply make their own instances to be in if they want to just experience the world.
No problem!
Actually you can. I do this for my prefabs to specify a color pallete for UIs of my assets
Right, but can you have more than one active at once?
Yes.
i dont know much about the new sdk3/udon but anyone know how can i upload my old sdk2 world to the new sdk3? i tried importing the assets folder to the new sdk 3 but i dont see my scene.
I've got a pickup with two children representing open and closed states. I'd like the player to click on the pickup to open and close it, and I want the current state to be synced across all players in the room including late joiners...
This is how I have it currently set up:
But I'm wondering if I should be using events for this instead, and if so, how I would do that with six different pickups without six different Udon scripts with different event names on toggle? Also, I seem to recall someone telling me that synced variables aren't synced very often, while events are instant? I can't recall exactly how long they said each takes though.
Varneon let's friggin goooo...I'm waiting for that prefab to drop
Heyo,
I'm having some trouble with a UI panel where I can interact with it in desktop mode, but I can't get the laser to appear in VR. The canvas has a VRC Ui Shape component, and is on a non-ui layer.
Anyone seen this before?
Try putting a box collider on the Canvas itself with a Z scale of like 0.01 or something, see if that helps.
oh heck, I've been making heavy use of your tutorials as I fumble through this, thanks for those!
Collider doesn't seem to have any effect, still can't get a laser goin 😦
Do you have any big Colliders in the way? If you have any large trigger Colliders, they need to be on MirrorReflection in order to keep your hand from getting blocked by them.
is that why buttons don't work inside my walkable ship?
or is it that you are being teleported about 50 times per second?
This was 100% it, thanks much
While I'm here, is there anyway to get a full list of players inside a collider? Or do I just have to keep track of everyone entering and exiting. Basically, I have a stage and I want players standing on it to have their voice volume increased when a button is pressed to "turn on the microphone"
Entering and exiting would be the easiest way to populate that list, though there's definitely route's both ways.
Glad the collider check worked 👍
The VRC_Panorama replacement isn't available yet, right?
There is no replacement yet.
ty
I've mostly got this working but I think I'm running into a permissions issue with SendCustomNetworkEvent. It's getting blocked in some situations, saying "RPC abandoned" in the logs. Is there specific rules about master/ownership I should know for network events?
hi anyone knows what could cause this? [USharpVideo] Video failed: https://1drv.ws
i have been using one drive direct links for a while but today it's not loading anything
Does anything see anything wrong with my code here? My magazines are behaving oddly.
So I've got some magazines in my world right? One is open, the others are closed. I could see them all until I designated them as pickups and added the script. Now all the ones that defaulted to closed are gone (presumably invisible) and the one that was open has both its open and closed states visible at the same time.
These are the parameters of the magazine that defaults to open:
So here's what I expect to be happening:
Each update, the graph runs, and sets the Open magazine mesh active state to equal MagazineOpen. Therefore, if MagazineOpen is true, the Open mesh will be visible, and if it is false, it will not. The Closed magazine mesh's active state meanwhile is set to the opposite (boolean negation) of MagazineOpen. So if MagazineOpen is true, the closed mesh will be hidden, and if it is false it will be shown.
Alongside this, the code is checking to see if the player's use button went down. (I assumed this only fires once, though now I'm wondering if it fires constantly while the button is down, though even if it did, that shouldn't be the cause of this bug since I was not holding the magazines.) If the button was clicked, then MagazineOpen is set to the opposite of what its current value is, thus toggling it true and false each time you click the object.
This all seems straightforward, and yet, my open magazine is showing both open and closed meshes, while the closed ones are apparently showing neither.
Since the only difference between theses objects is what I set the default state to... It seems like both open and closed active meshes are just being set to the default value. In other words, the boolean negation I placed before the closed mesh's active state is set to the value of MagazineOpen isn't working.
Hm, actually it has to be more than that, because the closed magazines default to having the closed magazine mesh visible. Which means not only is the closed mesh being made active on the open magazine... It's being made inactive on the closed magazines. While the open mesh... Well, that doesn't seem to be being touched at all. It remains hidden on the closed magazines, and remains visible on the open magazine.
Why aren't there any Udon examples for simple things like toggling a synced boolean?
I found these two examples for incrementing a counter, but they use an event, and I can't make heads or tails over what the difference between them is:
Like, I can't tell what these examples are supposed to DO. Does the first one increment the counter and sync that count to all players ONLY when the owner of the object clicks it?
And does the second one do it when anyone clicks it? And if so, why do that, since it's my understanding that as soon as you interact with an object, you own it, so only the owner should ever be able to interact with an object?
Perhaps the issue with my code above is I need to use OnDeserialization? I just found this page on that: https://ask.vrchat.com/t/how-to-send-data-over-the-network-using-synced-variables/2264
As of right now (07/16/2020) the only way to transfer any sort of data across the network is using “Synced Variables”. Unfortunately these variables do not tell you when they have changed. However you can setup your own logic to do exactly that. But lets start simple: Basic Synced Var The most basic way to handle synced vars is by just handlin...
But from what I can tell my code should still work even if I don't trigger it based on those deserlization events... But it might be running more often than it needs to since the data may not have changed. And even if a deserialization event has triggered, the state still might not have changed. Though I'm not sure if its really worthwhile to add the extra complexity of an if statement to check if the data has changed rather than just setting the active state, since I can't imagine setting active repeatedly is noticablly slower than doing an if statement repeatedly.
where can i find how to use Network.GetNetworkDateTime ?
i can not find an article about networking in vrchat documentation
I think you're overcomplicating the magazine thing. I think you need to start with your pickup scripted in one way, and then change it when the player interacts with it.
@paper plinth "I think you need to start with your pickup scripted in one way, and then change it when the player interacts with it." - I don't understand.
I have no idea what you're trying to convey. Start with my pickup scripted in one way and then change it? It sounds like you're suggesting I swap the script on the object after the player interacts with it, but that doesn't make sense.
Your graph looks like you're trying to write your entire script at once. Your script has multiple parts that interact with each other.
Sure but it's a very simple script.
I'll try removing the part to allow it to toggle the magazine and see what happens.
Envision how you want your object to look when it's not being interacted with and script it that way.
Then use blocks and branches to build on top of that
If you want to write it all at the same time you need to establish how you're going to do that first.
Like...write a requirements and specifications document
Also one of the benefits of graph is being able to visualize your script that way and when you have your elements interact like you're doing, you're not really using one of the great benefits of graph and nodes.
It's cool to spread out.
You're making this out to be way more complicated than it is.
Different strategies of writing scripts require different levels of planning and what I'm suggesting is that if you want to keep going down the path you're on, it would be helpful to you to have at least some metacode telling you how to build it. But you're right, it's a pretty simple script.
So I removed the noodle that toggles the value if the user is interacting with the magazine... And now they all retain their initial state the way I expect them to?
I just deleted that one noodle on "OnPickupUseDown" that went to SetMagazineOpen.
But I'm just more confused now. That node should never have triggered. Not only because I haven't even tried to pick up the magazines, but also because I just tested this in the editor where I literally can't interact with pickups.
The graph compiles okay so it's not that the graph isn't running at all...
I'm gonna see what happens if I reverse the inputs...
Okay.. the graph is definitely running...
When I did this, all my closed magazines opened and the opened one closed. So the graph is working, aside from that one OnPickupUseDown node which caused everything to go wonky.
I'm still at a loss to explain why this isn't working though. That OnPickup node should never trigger in these tests, so it being connected or not should be irrelevant.
Futhermore, even if it were triggering repeatedly, the state the magazines are ending up in makes no sense.
Also, what even is that Start node? I cannot find any documentation for it. I only used it because I saw others using it. But I'm wondering if maybe it only runs once the first time the script executes. Cause there's also an Update node, but that too is undocumented.
Don't forget Awake
Awake what?
And FixedUpdate
Well I've heard of FixedUpdate. But I don't know what you're getting at, unless I should go look in the Unity docs for a Start function somewhere. But I'd asssumed that was just a special Udon node.
Nah
Start happens when the game starts
Any object in a scene asset that has a start event
The start event fires
If your gameobject is not active when the game starts
Awake will fire when you make it active
Never seen anyone use it
Update fires every program scan/frame
I just found these docs: https://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html
If you're sequencing events and you need more determinism / predictably there's fixedupdate which I don't know how to use
But your script isn't working because it fires once when the game starts and never again
You need to use update if you want your code to execute
Hm... Well now I wish I could recall whose script I was looking at when I saw that Start node used because I want to know why they used it.
Start os for configurations, setting the pos/rot, setting variables that do t have defaults, setting up interaction conditions...
*is
Now that's where you get to see the utility of developing your program step-by-step
Yeah, I understand that now. I'm not new to programming, but I'm new to scripting within Unity. And to Udon. And I have no way to tell if a node is an Udon specific thing or a Unity specific thing and I keep forgetting that sometimes they're Unity functions.
You can do anything that's exposed and almost everything you need is exposed.
Nodes are just scripts in a different visualizer
I've got like 30 years of programming experience, so I know how to code, I just didn't realize the start function there wasn't doing what I thought it was. I thought it was the "start" of my program flow in an udon graph.
However, even if I fix that Start issue, this still does not explain why having that OnPickup node connected breaks everything.
