#udon-general
59 messages · Page 17 of 1
There is almost no one explaining stuff for VRChat specifically on forums
A normal developer has all the freedom
Yeah it’s been tough lol
Im not too sure on one aspect of it though
Oh, the effect in VR is terrific btw, as good as Elite: Dangerous. Just not as good looking lol
Well what if you stick your head outside of the windows? :P
Sounds refreshing haha
Well with my idea that wouldnt work
Actually
Nah it would
But again Im not too sure on one aspect of my solution to that specific problem
What’s that aspect?
I feel like doing as much locally and unsynced, like the individual player’s view rotation, as possible could work?
But their camera would just follow a synced ship
Alright so my idea is:
Put the spaceship in a big room that uses a custom shader, which writes 1 to the depth buffer and ColorMask 0.
Then render the camera in your "space" scene from the point of view of the spaceship.
Then render the normal player camera view.
However that requires your special camera to render before the player cam. And I dont know if there is a good way to ensure that
Ooh interesting
I have done a lot with shaders and custom rendering
So a render area? A large plane?
Oh I see
or just frontface culling
False skybox
Yeah essentially
That’s cool. Writing this down..
Yeah it’s way scaled down and just a camera with a colliders and script
It’s technically the real ship but doesn’t have a mesh
Then you have to respect that scale in the near and far plane of the camera
Youre basically doing Source-type Skyboxes
Now that Im thinking about it
Ah, is that pretty intensive?
If the windows of the ship are constrained enough, might be able to get away with three sides to the box? So would that be 3 cameras pointed out from the ship?
Interesting
Haha I see
It’s a ton of fun to fly around, set cruise control, and then walk around.
Im not much for flying around in VR. I get motion sick really quick. But making Source Skyboxes sounds like a nice challenge
If you do could you maybe send me a link to the world?
Well I have to work on it first 😅
Hah true. So the key phrase I have to research is source skybox?
That wont help you much
its just the same principle
you have a scene somewhere else that you want to make essentially into a Skybox
However its not quite the same
as in a normal Skybox you never move around
True
Essentially the Camera there is fixed in place. What youre doing is making it move around
Yeah. Hmm wait uh
Okay dumb idea but what if the skybox moved around in front of your vision? Haha
So there’s no distortion on the edges of the cube? Or is that different?
I have no idea what youre trying to say there
If a large plane basically childed itself to your camera, like a UI behind everything else
Its only geometrically a cube. The shader would make it appear as if it has no edges
since youre not even rendering anything
Ah that’s fascinating
It basically just "disabling" the skybox from being rendered
You could set the clear flags of the Main Camera to "Do not clear"
that would essentially have the same effect
however that would break handheld cameras
Ah yeah, I saw it not clearing earlier in that screenshot
Because it wouldn’t render the 2nd camera
Is there any name to the technique of using one camera to project onto a skybox with a shader like that?
No
At least not that Im aware of
thats just how I would approach that problem. Someone else might have a completely different idea
Question about namespace "UdonSharp" is this an old namespace?
UdonSharp is a custom compiler interpreting C# code into UdonAssembly. Written by the community member Merlin
I see, thank you so much! If you do this I’d love to hear how. I’ll keep you up to date if I get it running as well. If I’m not able to figure that out, is it possible to have a small floating plane (with a render texture from one rotating camera on the ship) follow people’s head movement and just be rendered behind everything?
I suppose. But thats definitely not the "clean" way
Gotcha. I’ll read more into this - I’m familiar with setting up cameras in OpenGL and GLFW etc, but never got into the weeds. Difficult sometimes to know what to search!
A lot of things are too specific to look up, especially in VRChat since its very restrictive.
I just gathered experience and knowledge by trying random stuff and talking to lots of people
It is exciting making things on such a new platform though! And the community is terrific. Thanks so much
yeah thanks helper... i still can't open the door, but at least i can make it squeak...
anyone know if there are known limits on VRCInstantiate? Im still debugging why, but i seem to have objects not spawning
this is after i have already spawned a bunch of objects
Dont know? All i know is pickup objects work funky and its local only
maybe a better question is the respawn mechanic for the combat system, does that interupt logic flow or can it disrupt spawning stuff
right now im doing a bomberman world, on death im spawning items around the map based on what they have. It spawns a few and stops spawning, but the list i build out does have a record of all the items to be spawned. Im wondering if by doing the combat death respawn mechanic could get in the way of spawning items
found the issue, didnt have anything to do with that, nm then XD
How do I set the variable of one gameobject's udon program from another?
Like what do I stick into these three nodes the instance node?
@shrewd mural:
- instance is the UdonBehaviour whose variable you want to set
- name is the name of the variable to set
- value is the new value you want
I get that what each of them does
I guess I should rephrase my question
How do I get an UdonBehaviour instance on a given GameObject?
Create an UdonBehaviour Variable, make it public, and point it to the object that contains the UdonBehaviour.
The thing is that the gameobject may be different each time
I just want a way to go from a GameObject instance to an UdonBehaviour instance
Here, lemme give context
after instantiating, perhaps using setVariable to change the value of the UdonBehaviour variable to that of the cloned gameObject's, and then using that might work? You would have to get the component from the cloned gameObject. The AvatarPedestal script has an example of this you can reference.
See, I tried that already. I'll try it again, but the problem last time is that the component output of GetComponent wasn't connecting to the instance node of the Set Variable.
Yeah, it aint wanna plug in
@shrewd mural ooh, I see. That's a known issue - the workaround is:
- Connect the Game Object Get Component to instance using the 'T' mode in the dropdown
- Switch it back to Type mode
Dropdowns stopped working, restart Unity time 🦀
Alright, looks like it connected. Time to test my code. Thank you so much @floral dove and @lusty glade
I have been scratching my head at this for a couple of hours now, how do I detect when the player enters a collider using Udon Sharp? When I read the UdonSharpBehavior, it does not have a OnEnterTrigger or OnTriggerEnter Method.
Yes
Can low file size text files be used to make functioning books in VRC? As opposed to conventional image files? Can VRC even use text files?
Imagined a full book in text format but used to populate pages of a book prop that changes what part of the text is populating the pages as you flipped through it.
TextAssets are text files, so yes
What do I put in Udon graph for getting a gameobject to toggle on onenter and off onexit?

Hello.
I think , I want to make world members counter.
but this code doesn't work.
Please help me.
Youre setting the text, but youre never setting the variable itself.
Oh! I'm stupid.
so i made a button in udon graph which toggles a box 'locally', how does one not make it local?
Well. There is two ways I can think of. Both of them have advantages and disadvantages
so there is no good way to do a global trigger? @fiery yoke
Well there is an easy way, but it has certain disadvantages
The easiest way is to simply have a synced bool to take care of synchronizing. However then you have to "know" when to check on it or checking it all the time (in Update). Having a synced bool is taking up a certain amount of bandwidth, and checking it in Update will take up a certain amount of Frametime.
Can anyone spot an error in here? The myPlayer variable of the instantiated object isn't getting set (I have checked for this already, and I'm sure that's the problem).
You need to delay setting variables on instaniated udon behaviours until the next frame
You cannot immediately after instantiating "use"...yeah what he says
ah, i see
They need a few (maybe just one) frames to intialize properly
I've had luck doing it in the late update call following whatever event I created the object in (typically a UI button press) but you would need to test if that holds true with OnPlayerJoin
The best way
is to set a VRCPlayerApi variable on the behaviour, then in Start of the other behaviour retrieve the value. However that requires that you need a reference
so you can only have a static referece, a reference by name, or some sort of other magic
lol
You may also need to handle multiple players joining before you can set your behaviours variables
Yeah what helpful said
Life would be too borring if things were easy :^)
So I had an idea for handling multiple people joining at the same time, but it looks like I can't do it
What exactly are you even trying to do?
I want some stats to show up above each player
I have a premade system for giving each player a dedicated object.
ofrick
This is probably the single most complicated thing to do that is used very often
It requires UdonSharp if you dont have that already tho
Does your system use an object pool?
object pool?
that allows you to deal with synced behaviours aswell, is that something your player stats system needs?
Object pool means that you dont create objects at runtime. You have all the objects that you use already in the scene and you reuse them as necessary
Ohh yeah youre right AirGamer, technically you dont need that
if you dont need sync
then its way easier
Sync makes everything harder
Definitely makes me harder ( ͡° ͜ʖ ͡°)
OwO
xD
btw thank yall for helping me :)
So do you need synchronization/communication between players?
yea
Are you sure?
absolutely
what this is supposed to do is display a list of flags for each language the player speaks
Ahh well yeah that would be difficult to do otherwise
I originally had holdable flags, but this is for a community who may speak several languages
And well, I don't think VRC supports 5 hands for one player :P
@fiery yoke
Unpack both prefabs and add your system to the handler
You mean like parent the root GameObject to the PlayerHandler object?
Ohh it seems that this is still a little outdated
give me a second
@shrewd mural Now its up-to-date. Please redownload. Sorry for the inconvenience
And yes it will make you the owner of all objects parented to your assigned handler
Does anyone know the correct syntax for using the event OnTriggerEnter in Udon Sharp? Itll help me greatly
public override void OnTriggerEnter(Collider other)
However that wont help you much with Player collisions
as players will always be null
@fiery yoke Sorry for keeping you on this, but it doesn't seem to work.
Does the position/rotation of the root object matter?
It generally shouldnt
I havent fully tested it in its current state
but it should work
No I tested it in game
Then what's with the Debug.Log stuff?
You have an ingame console. You need to setup a few things to access it tho. And also the logs are included in your actual log file.
I dont think theres a tutorial...but you can find it somewhere here...search for "open console" or something like that. Im too lazy to explain it all over again rn :P
@fiery yoke Ok, I think I've almost got it figured out. The object does get assigned an owner, but the position doesn't keep updating. Do I need to do that myself?
Well yeah ofcourse
My system just gives each player an object they own. The rest you have to do yourself
Mkay
Sooo i am trying to make a second chill world for a friend. In this world you can snowboard and stuff. Now i was thinking about how awesome it would be to build snowmen in vrchat. Any ideas how that would be possible with Udon? I am kinda stupid if it comes to stuff like that.
what is udon
No Im not a bot. Thanks.
oh
Or am I? :^)
they are one of the most helpful people on this server.
dayum this place is rly confusing
HelpfulHelper is quite helpful, yes
basically I want to make an audio play globally to everyone in the instance when a button is pushed. how do I do that? I just have a local button and not a global one @fiery yoke
it's not that important but example:
I have 3 players in a world and I cue an audio
then 2 other people come in
and I cue another audio and they hear the latest one
Hmm welp that aint too easy.
But I have other stuff to do rn. Maybe someone else can help you
all good thanks
does anyone know how to detect if a player is touching the ground or not?
Maybe if you check if localplayer's position y is at 0.
hmmm
A while back I posted a question about how to use kinematic on rigidbodies conneted to objects with Udon pickup components. This can't be done, because Udon Pickup hijacks the is-kinematic property when added to an object. But I found a workaround solution to my actual problem, and I'm posting in case anyone is doing the same in-discord search I was doing to try to find an answer to this. I can't force a rigidbody to not move while in the air until it's picked up, but I CAN put that object on an invisible shelf that disappears when the player picks the object up.
@dreamy tangle do you mean youre able to make the object be picked up? and/or possibly thrown?
im trying to figure out pickable objects with udon
@glad oak so long as the VRC Pickup component is on the object, you should be able to pick it up. This code allows you to have VRC objects with rigidbodies hover in the air before the player picks them up, then move around afterwards like regular rigidbody objects
Alright, I'm asking because there's no tutorial and whenever I add the pickup script in UDON, it doesn't work.
...I really hate to say it, but that's...basically the state of how I feel with literally anything I try inside of Udon at this point. Everything I think should be simple ends up feeling way harder than it should be. I dunno if it's the alpha state of the tool or I'm just dumb. Anyway, here's a repo with the scene I'm working in with my tests, and the pickup attached to a cube in that scene works. You can try to use that as a starting point just to have something working if you want. https://github.com/heyacfox/VRChatTesting
So I DID make progress on my code, but now im stuck at a wall again. I am trying to get an object to move towards the player when a certain condition is met so I needed to obtain the current players position on every frame. And Udon freaks out a bit trying to get it to work. Heres what it is complaining about:
private VRCPlayerAPI Target;
void Update()
{
var PlayerPosition = Target.GetPosition(); <-----------
}
Any ideas why Udon is having a sissy fit about it?
This is also what the console is stating
it's not that important but example:
I have 3 players in a world and I cue an audio
then 2 other people come in
and I cue another audio and they hear the latest one
@scarlet lake can use custom network events sent to everyone when you want to play audio
@errant pilot when are you setting the target player? if its not set before update gets to fire off then you're basicly doing null.GetPosition(), which is not good
if you want it to move twords a player, you will either need to get a list of players and have it move twords the closest player, or you could make the target the local player, which point you would want Networking.LocalPlayer.GetPosition();
OnTriggerEnter Can't set sync variable?
(I try it... by Check owner at first run event and set owner again before set variable)
After set.... all function in this object are stop. (I think it error)
@fair bough you can’t update sync variables directly after setting the new owner. Got to wait a few frames first.
oh I must wait few frames after set ownner?
I can't update text.
Please help me.
@sturdy ibex when do you want your text to update? Its currently setting your text to that set string every frame
I want to use like Debug.Log. when I Interact some Object.
You would want to change update to interact. Since it will change once you interact the object instead of 90 times a second
OK. I try it.
Does editing the main camera change the player camera as well?
Only certain settings, and only if you set it as the reference camera
Or even better, post processing effects
I've been able to set a synced value the line after setting owner, however it's not gonna update the value immediately, u have to wait a few franes
Thats not what I experienced.
What I experienced was when setting a synced var right after SetOwner, it will overwrite the value, by the masters value, since the network has acknowledged you as the new owner yet. But I might be wrong on that
In doing it with int
And have done it with string, haven't done it with var
Tho I don't use car xD
Var
Hmm maybe it is immediate locally. But yeah then it will still take a lot of time to update on other clients.
Ye
I have a system to collect players that works well by grabbing their player is when they step on a pad and setting it to a synced value, which on update updates the pad color to green and displays their name
It updates pretty quick but it still isn't immediate
Even just 100ms is an eternity in Frames.
It is
Thats about 10 frames at 60fps
That's why the system only collects the players after u hit a button and a 10 second timer finishes
is there a way to acess the localplayer camera component with udon?
No.
oof
So from my post yesterday, with the response of making a list of players, how do i obtain every players in that worlds position? So the object can go towards the nearest one?
You loop through the array and get everyones position, then evaluate them.
Ok so like, how does udon know which player is which and not just the local player?
A VRCPlayerApi is a View of a player
its not just your local one
every player that you connect with has a VRCPlayerApi that is dedicated to them
Oh. So like everyplayer has a unique id that you can grab from VRCPlayerApi right? And assign them to the array
Okok. So VRCPlayerApi is an Array and you can use said Array to grab information from each player as they connect. Sorry man, its been almost 4 years since i touched a programming language
No thats not how that works either.
Trying to get into programming (again) with VRChat Udon might not be the easiest/smartest move.
I hope they change the method within vrcplayerapi that gets all players to return an array or support lists at some point >.<
Yeah using U sharp isnt the easiest move but ive had this world i wanted to do and ill make it through all the pitfalls if i have to. Its a challenge and i accept it. Plus im not going in completely blind either.
Hey guys iam new at UDON and everything and made a world with 3 main places with a mirror in it....how can i change my Script that always when someone activate a mirror, the others got deactivated?
Two gameobjects. One for the one mirror to toggle and the other to be disable
Instead of doing a negation for the second mirror, just set it to false
so add a node with another gameobject and set a variable to that gameobject with = false?
Correct
now i get it but i think i need a documentary or something to find the right nodes xD
I've seen a world with a door that only allows specific user or specific avatar pass through ( also user specific pedestal )
Is this possible in VRCSDK3?
Does a GameObject's active state get synced in networking?
You have to sync it yourself. Nothing is synced inherently
lololol
ok, that I have no clue where to even begin.
Yeah
Networking is a mess.
There is multiple ways to sync a boolean. All of them have drawbacks.
please bestow upon me your knowledge
The easiest way is to have a synced variable
But then you need to "know" when it has changed. (Which is realistically only possible on using Update() or OnDeserialization() to check its current state against its previous state that you have to store in a seperate variable)
For GameObject.SetActive this actually wont work
because the variable will not be synced when its disabled/the events wont work properly
which is why method 2 is superior in my opinion
which is setting up your own sync system
does anyone know how to make an animation clip play on an object when interacted with?
Is there anyway to activate animations on objects? in unity they work but not ingame so i think its because UDON?
i just want that my fishes in the see swim xD
whats udon
"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 “noodles”) to connect flow, inputs, and outputs. You can build complex behaviors with Udon-- far more complex and easier to understand than unwieldy chains of Triggers and Actions.
Not only can you replicate the full behavior of Triggers and Actions with VRChat Udon, but you can create your own behaviors, sync variables with others, interact with scenes, interact with players, and more."
Does anyone know if this specific issue regarding pickups clipping through walls was resolved? I found it mentioned far earlier in this chat but I didn't see any solution... Is it possible to fix this yet or is it still bugged?
https://www.youtube.com/watch?v=vK5SqFBlV2Y&feature=youtu.be
Hey everyone. Im having an issue when try to publich a world. Any idea why this is popping up?
ignore that message, we all get it , should still work
When i click upload, nothing happens.
nope. Error pause is not on.
for clarification. The upload button appears. I can click it. It just does nothing.
Is it possible you have multiple pipeline managers that have gotten inside your scene?
Looking at that error that's one thing I can think of
"t:pipelinemanager" in the hierarchy search
Oh, so you did have multiple pipeline managers? That was a half guess looking at the sdk code 😅
well it worked so i thank you!
hello, Please help me.
How can I make sound when some people Joinned my world.
I tried this. but I failed.
I changed event from Start to OnPlayerJoined. but I can't heard anything.
You can just link the audio source right to the player for a start
You also haven't specified an audio source to play the clip.
Is there a way to tell if a custommessage came from the same script/object? What I want to happen is "if custom message came from THIS instance of an object, then ignore it. Otherwise obey it."
As far as I know there isn't, but you can probably devise a workaround by telling it where it came from (setprogramvariable)
CustomEvents are limited when it comes to telling where it came from
Any way to set Animator Controller Parameter floats and then have them apply so I can use that Controller in a station?
have the message itself say where it came from, when you receive a message, cut that part out, compare it to its own , and if it matches, ignore it
Thats not how Custom Events work.
CustomMessage
I assume they meant custom event. I dont know what else would be a "CustomMessage"
I was responding to Whadageek’s question
Same.
It would be nice if Udon had access to analog stick data while in a station that doesn’t allow standing up. If not analog least basic up down left right
I asked that many times, but never get an answer for that: I have animations for fishes but the animation doesnt work...what did i have to do to make them work as a loop?
Anyone know how to detect who is the master? I tried something like this that only sets a gameobject active for the master but no luck..
In the future off vrchat is the whole UI going to be changed?
Yes.
@torn shoal Not Udon related. But these were the early previews from the Dev stream: https://imgur.com/a/mwqrtn5 They put emphasis on that it is all still work-in-progress.
oh sorry and thank u
I know ive been asking a few questions here lately but i want to know how something would work. I have a contextual button that i want to make turn on another button which will then turn on another button and so forth. Is it possible to just put the contextual button on the same graph as the second button (the one being turn on) with the other udon code?
anyone know the max speed in vr players normally have?
nm, found it its 4 moving forward/back, and 2 moving left to right
:V How do I teleport people to another spot on a map
@frozen plover yes, you could put all the button logic in one graph, but it will be easier for you to update and manage if you keep them separate and just have each button reference the next one with a public variable
Ummm.... How event OnDeserialization() work?
Why is it when I try to make a pedestal, the image previewing the avatar is all squished after I try to resize the object?
Even tried to add the thing after, it just looks like it scales to the object automatically...it sucks.
Anyone know if there's a way to do a timeout?
define timeout
What do you mean? I meant something like a settimeout function. It would call a callback after a certain period of time
Please help me.
I want to know unique ID of VRChat user's.
How can I know this?
@digital orbit the term timeout or time-out has several meanings
That is usally called a delay
Ah. Yes, I'm wondering if there's a better way to do that. I could do something like count frames and such, or rely on time checking during the Update(), but that's really kludgy, not to mention probably slow
Checking something on Update is the best way afaik
there really isnt any other way to do that
and @sturdy ibex you cant.
Ah. I can't wait for Udon to mature more 😄
But for an alpha, it's pretty impressive already
The best approach would be coroutines, but those will probably not be supported for a long time if at all
I'm sad.😭
@digital orbit What you could do is an Update() timer...
So basically (if you're using UdonSharp), it's:
private bool triggered;
private float triggerTime;
public void DoSomethingAfter5Seconds() {
triggered = true;
triggerTime = Time.time + 5f;
}
public void Something() {
// Your 'something' goes here.
}
void Update() {
if (Time.time > triggerTime && triggered == true) {
triggered = false;
Something();
}
}
@fiery yoke No need for coroutines 😛. Remember when Unity 5 these were no such thing?
Coroutines are nice because they dont block nor take up any frametime
Doing something in update gets really expensive if you scale it up
Having 100 objects all checking if some timer has run off can slow you down significantly in combination with other systems
Yup, that's why I was hoping there was a more elegant method 😄
@zinc thicket Thank you for the sample code!
Yeah, but gotta make do 😦
And then when you try to take timing into your own hands... (Chaos)
That's what we call, kludgy code, cause we have no choice :3
More often than not, there is a clever way around "kludgy" code
Yeah, that's why I always like to ask in case I missed something. :3 I prefer beautiful code whenever possible
So uhh...does anyone have an idea how I can send a CNE to someone, and then tell from who it came from as the receiver?
does anyone has a ready Udon Script for Mirror Settings? (Low/High) i diddnt find any solution for that
@fiery yoke One specific event name per pooled object, then the caller checks the pool to find out which playerAPI is responsible for which event name at a given time, but this is not safe against ownership switches that occur between CNE emission and the ownership check.
Anyone have a script or graph UDON for master locks/controls?
is it possible to create lists in udon#?
i keep getting
Assets\Game\Code\Game.cs(10,16): System.ArgumentException: Cannot resolve generic arguments on non-method expression
No.
are there any alternatives?
since im working with a mess of variables being set to null and the list increasing in size
Arrays. Thats the best you get.
alright, thanks buddy
I'm pretty new to udon, but I know my way around software engineering. I just encountered (a bug?) in which half of the VRChat SDK dropdown options (I don't really know how to describe it any better) are missing (e.g. Show Control Panel, Help, Udon Graph). This is only true for one project, I created another one and everything worked just fine. I tried reimporting everything (via the reimport option) and reimporting it manually (via add package), but unity tells me that everything is already installed. Has anyone encountered this and if so, how do you solve it? I'm pretty frustrated rn because all my progress seems to be gone....
Anyone have a script or graph UDON for master locks/controls?
@glad oak What do you mean "master lock"?
@dull nova You mean the VRChat SDK menu item at the top? That's not Udon related, but you should check for any custom packages or scripts which are messing with it. Take them out one at a time until it works
Any problems with building (it never builds and shows the screen), or menu items missing, is almost invariably due to a custom package conflicting with the SDK. Specifically, look for any custom package that uses CS scripts. Solution, remove it
@digital orbit Some worlds have buttons that can only be used by the instance creator. I need an UDON version of them
@digital orbit thanks for the hint with the scripts, i just manually dragged the files from another projects into my current one (in the explorer) and now it's working. There were some missing, idk why.
Glad you got it solved
Does anyone know the best way to impliment picking up and interacting with an object with udon? Im trying to get a world together for an event and this is the last piece of the puzzle. I've tried to use the code within the SDK assets, but it doesnt seem to work. Mind you i havent added anything to it either. Any advice?
@frozen plover - the VRChat Examples should work when you run a Build & Test. Have you followed along with the Readme?
@dull nova Import SDK2, then SDK3, close Unity and delete the SDK2 dll from the plugins folder.
im trying to execute functions on other udonbehaviours, but this gives me an error. is there any way (besides putting everything in 1 file) to execute functions from other code?
dont mind the random range stuff, porting from javascript to c#
@fiery yoke where are you when i need you the most friend!
You have a null reference there, meaning that "game" is null.
i have a question. How can i have One button set off 3 events at the same time on one udon graph?
without using udon sharp because i don't know how to code
you are right once again helpfulhelper, i didnt read that message at the bottom of my error
though now i have another problem, the udon madness is real
this returns null... and im not sure why
spawnerprefab contains a udon script with the source script being Spawner
Udon needs a bit to initialise after being instantiated, so you cant access the UdonBehaviour right away.
ah ok thx, cant wait for udon to become something more... useable and easy to use lmao
we can multithread right
No?
Multithreading is pretty complicated in normal programs
Udon is very far away from being able to multithread
cant wait for udon to become useable 😢
it can do a lot, but not enough
alright well thanks again. this will make stuff a bit harder but that doesnt matter, i shall make this project a reality
Good luck with that ^^
thanks 😄
Hello o/, can peoples confirm "OnAnimatorIK" doesn't work with udon ?
thx @zinc thicket
For the most part, performance should be pretty good-- but there’s a bug currently affecting iteration across large arrays when running in the VRChat client. Try not to do that for now!
i was wondering if this is still the case.
Well yes and no. I think the particular bug was fixed. But iterating over arrays gets worse the longer it is. So after like size 100 it gets pretty slow. Especially if you do it in Update().
oh wow... so lets say... 50 enemies with like 15 variables, 4 functions wouldnt work out?
what if i were to limit array size by 40 elements each, and put those in an array to iterate over them
is it purely calling variables and doing calculations that creates lag?
Its accessing an element from the array, since it scans every element in the array when you access one. Which basically makes a O(n) into an O(n^2)
However one part is in native C# while the other is in Udon
so the effect is dampened, but still feelable
okay i have the worlds silliest idea
i will make 5000 variable names
no arrays, just purely initializing 5000 variables... and i will fill those whenever i have to
Yeah that isnt so silly
Ive seen a few people do that for some shorter "arrays"
however using that is ... not easy
it isnt... but i dont see another way lmao
i will try some stuff in another project
should i test my code in vrchat, or does the unity editor show the same performance?
float[] variables2;
float lastTime = 0;
int size = 0;
bool stop = false;
private void Update()
{
if (!stop)
{
if (Time.deltaTime >= 1)
{
stop = true;
Debug.Log(size + " big");
}
size += 10;
variables = new float[size];
variables2 = new float[size];
for(int i = 0; i < size; i++)
{
variables[i] = i;
}
for (int i = 0; i < size; i++)
{
variables2[i] = variables[i];
}
}
}```
because this doesnt seem to lag
Editor is usually a lot faster than in game. But with certain things it can be much slower. So just test it in game
alright
wow, performance issues to the max
yeah
well that is a problem
i can try making an array-less code thing machine of doom
lemme see
so.. i have made a test, it will calculate deltatime with 2 different ways of using arrays....... long story short, we can check performance with this :P
type isnt updating yet, but this is type 0... using standard arrays as you normally would
this just fills the array with data
now i had some problems with the second type.... but
well, you cant fix it by adding more... arrays
this will basically be the research place lmao
im going to check every possible way of iterating over a group of things
code 1:
{
T1_variables = new float[size];
T1_variables2 = new float[size];
for(int i = 0; i < size; i++)
{
T1_variables[i] = i;
}
if (putInOtherArray)
{
for (int i = 0; i < size; i++)
{
T1_variables2[i] = T1_variables[i];
}
}
}```
code 2:
{
int arraySize = Mathf.FloorToInt(size/ T2_arrayMax)+1;
T2_variables = new float[arraySize][];
T2_variables2 = new float[arraySize][];
int index = size;
while(index >= 31)
{
index -= 30;
T2_variables[Mathf.FloorToInt(index / 30)] = new float[30];
T2_variables2[Mathf.FloorToInt(index / 30)] = new float[30];
}
T2_variables[arraySize-1] = new float[index];
T2_variables2[arraySize-1] = new float[index];
for (int i = 0; i < arraySize - 1; i++)
{
for (int j = 0; j < T2_variables[i].Length - 1; j++)
{
T2_variables[i][j] = i;
if (putInOtherArray)
{
T2_variables2[i][j] = T2_variables[i][j];
}
}
}
}```
Ohh btw for primitives that scane doesnt apply
So an array of floats will not be the same (performance wise) as an array of GameObjects
that is true, for the sake of simplicity i used floats, which is i believe is 4 bytes...
now... i will try creating a system that doesnt use arrays, with about 1000 different variables and the biggest switch statement in reality
i will have to write code to write code
so... this is what my code created
now if this works better than arrays...
i wouldnt know what world we live in...
Is Quaternion.toAngleAxis() still broken in the current release of Udon? I saw that it was supposedly fixed back in April, but I'm still having trouble with it.
i cna confirm that that code... didnt do well...
lets just say that the 100 ms is not telling the truth...
and i think its because im calling functions
if everything is just in one function (update3())
it might work
i will try this out too
code 3:
{
for (int i = 0; i < size; i++)
{
setVariable(i, i);
}
if (putInOtherArray)
{
for (int i = 0; i < size; i++)
{
float a = getVariable(i);
}
}
}```
so i have calculated how many... things have to happen in 1 for loop to get a variable and set it to another variable without using functions
if i were to use my way of arrays (1000 different variables)
it would take 1000000 checks, to get a variable and set it to another
and that is for 1 check
60 million checks every second?
i dont think that udon likes that idea
so im not going to try
conclusion for now: udon cant support a tower defense game with more than 3 enemies on screen (synced with other players)
Has anyone tried to check if an object is destroyed? I'm not sure if we have a way as it errors for me before I can check if it is null. Asking here before making a canny
https://cdn.discordapp.com/attachments/677706656330678316/718895957353431131/unknown.png
[<color=yellow>UdonBehaviour</color>] An exception occurred during Udon execution, this UdonBehaviour will be halted.
VRC.Udon.VM.UdonVMException: The VM encountered an error!
Exception Message:
An exception occurred during EXTERN to 'UnityEngineObject.__op_Inequality__UnityEngineObject_UnityEngineObject__SystemBoolean'.
Parameter Addresses: 0x00000004, 0x00000005, 0x00000006
The object of type 'GameObject' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
isnt it just if(gameobject) { // do stuff if it exists }
gameobject being the GameObject you are checking for
Hmm, that generates op_implicit. Time to test if that works
Can I update text on a TextMesh component? Or should I use something else?
I'm getting exceptions when trying to run textObject.GetComponent<Text>().text = ""
TextMeshPro
alright
I'm not sure about changing text mesh pro, but it might not be exposed in udon.
thanks, I'll try UI.Text
@dusk lance thanks a lot. Its working
Awesome
May I ask why some prefabs I downloaded for an udon world will not function?
I have udon sharp downloaded and set but the kart prefab and vroomba prefab don't work as in I am unable to interact with them.
@shadow geyser Do you have any errors in your console? And have you pressed "compile all" on the udonsharp behaviour yet?
ill check real quick
that seemed to have worked
Is it possible for On Trigger Enter / Exit to fire off more then 1 audio source?
when i try connecting the triggers to more then 1 it only keeps the last one i connected to
i want to do something like this
Use Play One Shot instead
oh nvm
You can't do multiple flows from outputs
only inputs
k
So do Trigger -> Stop Audio -> Play Audio
would there be no way to play the splash sound then start the ambience?
If you just need the splash sound to play the moment you enter it, use Play One Shot
that will only play once then stop
ok got it working
thanks alot
the multiple outputs thing
would there be a way to tell when the main camera enters the trigger zone
vs the player collider
playerapi get display name is how I would get a player's name, correct?
Yes
hi can someone help me with this. i got it to show players names to show up on a wall but it only shows in one line. i wanted to show as a list and when people leave the world it shows but does not delete there name. can someone help fix this please.
are you using U# or normal Udon?
udon
try using \n (make sure it is a backslash)
use it as the separator when you join strings
hmm, this is set only to replace the singular instance of %display Name%
try adding names to a string array
then on leave, you can replace their name with nothing
to remove them from the list
so, I would recommend adding each new person to a string array, then join the array with a separator, which is then replaced with a '\n'
gimme a sec
ok
how do i reference the object itself that the bahaviour is attached to?
for say doing a branch check
here's how I did my linebreaking, atleast
Any self reference is done automatically
You can't get the players camera btw.
ah shit
The camera in the scene isn't attached to the player at all.
Nope, it only gets the values on the reference camera to use on the player camera
well now im just stumped
Make a gameobject and get the players head position and use that
ah
@hoary ocean
add the player's name to a string[] array, then at the playerleave event, find and remove that name
alternatively, you could put it all into one big string, then use a replace to replace their name with nothing
hmm, any reason this is not updating?
this is what i have so far
Am I doing CustomEvents right? This should be from a button to a controller that has multiple custom events incoming.
The Button sending the event;
The controller. The intent is the button will turn on its own mirror and tell all other mirrors in the world to turn themselves off.
What statement should i be writing here? I only want the on enter and exit to trigger the event if the object passing into the trigger or out is the game object tracking the players head bone
Thanks @cunning mist !
👍
Also my complements to your excellent tutorial videos on Udon.
Big thanks
Just out of curiosity, do I need to anything for-each-y with the array versions of variables, or will they iterate through naturally when tethered to something?
You'd have to do a foreach loop, though for loops computate more efficiently so I'd recommend doing those instead.
Cheers.
Oh, one other question; Is there a way to say "if the custom event came from the same object/udon behaviour, ignore it"?
I found out my problem and how to fix it. I was referring to the gameobject and not the udon component
dummy me
how would I do oninput commands?
Is this the right way to set a shape key and material via Udon?
The button in question
Vowgan, are you thinking of doing a tutorial on an Udon 3rd person camera?
I've always wanted to know how to make one
so are UdonBehaviours[] being broken a known bug?
@hushed gazelle Lots of things are unsupported in Udon. Likely not a bug, just not added.
You can't set arrays of many things, for example KeyCode[]
But what do you have in your script for that?
I was going to send a command to several objects with the same udon script to do something via a CustomEvent. I've actually worked out a better way to do want I want to achieve anyway.
I've noticed that unsupported values (e.g. an unsupported array type) usually aren't supported at the global level, but you can use them inside functions
Something to note
How do I kill a player via Udon? Not looking for health damage, but more "touch trigger area, die and respawn" behaviour.
How can I make a Leaderboard in Udon?
Syncing the parameters only updates them for the Master
And CustomEvents dont allow parameters
so basically my leaderboard only shows my own score
@fiery yoke I was looking around for ways of creating seamless portals in Udon and saw you managed to create the effect I wanted. How do you recommend I should go about recreating your solution?
Dont.
Im using a lot of weird tricks to achieve the portal effect. Plus its not perfect, dunno if thats just how it is, or if one could make it really seemless.
Its a combination of camera trickery, special shaders and lots of maths.
Hmm... Fair enough. Thanks for the quick reply!
The main problem is avatars, since you have no way to "manipulate" them
Plus VRChat being...VR. So using render textures gets much harder. Which is why Im not using them. However that means that you need to manipulate the depth buffer, and getting that right isnt easy.
Yeah, I first attempted to do it with render textures and quickly realized VRChat doesn't like that very much.
Well yeah because rendering in VR is a lot more complicated than non-VR.
Guess I'll do some more research then, I'll let you know if I manage to get something working.
I would tell you, but its quite a bit of stuff and Im not even sure what I exactly did myself...I just tried things until it worked 😅
Anyone know if there's a way to edit an animator controller (like changing a float paramater in it) and have the new properties carry over to all other instances of where it's used?
Can anyone tell me how the hell am i supposed to use Udon to anything without coding knowledge and without going out and putting so much of my time learning all of it to make simple things for my VRC world ?
You can still use SDK2 for your world which has the basic triggers and stuff that people used prior. I'm trying to mess with SDK3 for my world and I'm just using the node system + looking at peoples examples for basic stuff
Well, would be good if nodes would help with anything.
So another question. Is there any place where nodes and what they do is explained by creators ? Or do we need to take that knowledge from air ? Any resources ?
vrchat is wanting https://ask.vrchat.com to be that place.
Ah, so looks like basically it was released like that so knowledgeable people would do prefab work themselves. Cleaver.
Cleaver 😆 
I would at least propose changing https://ask.vrchat.com/ to https://ask.vrchat.community.com/
But anyway thanks for your answers people. Cheers.
@desert pike the nodes are explained here: https://docs.unity3d.com/2018.4/Documentation/ScriptReference/index.html
🙏
@mighty fjord animator.SetFloat / SetTrigger etc
@hushed gazelle what you can do is make an object[] to store all your udonbehaviours and the just cast the object to udonbehaviour :/
Clever
I mean I tried animator.SetFloat, but it only seems to affect the local Animator Controller, though I want to be able to save that info to a controller and use that for a seat instead
well you gotta give it a reference
if it's on the same gameObject it's
gameObject.getComponent<Animator>();
or just have a public Animator NAME;
then
afaik every animator is on their own and they vars aren't shared
public VRCStation station;
and to get the AnimaorController
RuntimeAnimatorController stationsAnimatorController = station.animatorController;
that gets what's in the stations animatorController field
and it seems to compile
I'm not having any compiling issues, just that I need to figure out a way to change the float on an Animator Controller that's in a Station basicly, either that or be able to edit an animation at runtime that I can use in a station
try
VRCStation.animatorController
and setting stuff in that
don't think vrchat will ever allow you to make changes directly to the players animator besides avatar 3.0
oh
RuntimeAnimatorController is..
weird
I can set the Animator Controller just fine, but it doesnt seem to want to use the floats if I've changed them, only has gets the default one that's set before I start up the scene
I think every animator has their own animator controller
so changing one doesn't affect the other
just as changing materials via scripting
well
meshRenderers materials
Yeah and I need to figure out a way to probably use a float instead, cause otherwise I'd have to do probably hundreds of animations individually
what
Okay so maybe I need to give you some more context
if you can't set one thing you won't be able to set a different thing either
I'm using a float to normalize the time in a linear animation to lerp between two states and I need to figure out a way to update the float in the station's controller
The only issue I'm having is that I cant figure out a way to change that float
seems like you are not able to change the animator instance used in that station
wait 🤔
I mean at first it's empty, and once the script runs it sets the animator, but it just uses the default float
Another alternative would be if I could edit animations, but as far as I can tell, that's just for legacy animations, which means it wouldnt work for stations/avatars
the float and things are stored in the animator
so good luck getting to the animator :)
What animation is it?
Stored in the animator component itself?
Just a simple animation I made that changes some transform from 0 to 2
I think all the variables from an animatorcontroller are part of the animator and the controller just stores all the things to do with the statemachine
the scripting reference only shows it used within the editor
you can addParameter
Maybe, I'll check it out
Yeah
else everything in vrchat would be moving at the same time
And that would be individual
if they were all linked
Is there a node to add a Parameter? Kindof struggling to find one
though luck getting a reference to the animator
it might not be exposed
didn't check
oh
it's part of the UnityEditor; library
This is proving alot harder than I'd hope for it to be
What does the animation do?
It changes the object scale transform from like 0 to 2 or something like that
It's nothing I can get around without using a station with an animator
how would i make a behavior that fires when a player touches it?
OnCollisionEnter maybe
How does one detect a VRC Pickup interaction with an UdonBeahviour? My Interact method gets called when I click on the thing when it's not being held, but it does not get called when someone is holding the thing and clicking it
OnPickupUseDown
but you gotta set that up in the pickup
pickups don't use interact
they use
OnPickup()
and OnDrop()
I don't see any events to hook up for VRC Pickup; do I need to turn on debug mode in the inspector for that or something?
public override void OnPickup(){}
oh, it's just implicit
hm, is "Auto Hold" supported in SDK3? it doesn't seem like it's working. if I let go of my grip, the object falls
I have "Exact Gun" set to a transform, "Orientation" set to "Gun", and "AutoHold" set to "Auto Detect" (also tried "Yes") and it's not working
Auto-Hold does work in Udon, I'm uncertain what you would be running into.
I'm making a video player that allows input of custom urls. Currently I am trying to send the url to the SyncVideoPlayer via the AddUrl method, and udon doesn't have a node for VRC_SyncVideoPlayer, and there's no way to set an event's text input to the input field's text value. In code terms, I need something that looks like this:
using UnityEngine;
using TMPro;
using VRCSDK2;
public class VideoURLSync : MonoBehaviour
{
public TMP_InputField inputField;
public VRC_SyncVideoPlayer videoPlayer;
/// <summary>
/// Adds the url currently inside the input field
/// </summary>
public void AddUrl() => videoPlayer.AddUrl(inputField.text);
}```
```json
{
"Button": {
"OnClick": {
"type": "runtime",
"target": "VideoPlayerGameObject.VideoURLSync",
"method": "AddUrl"
}
}
}```
Thanks!
@teal isle - this channel is for talking about SDK3 and Udon, you might try in #world-development or #development-advanced
Udon doesn't work with SDK2
How to I get verified?
@heavy adder I recommend you make a VRChat account and play it for a while. This channel is for talking about Udon development FYI.
Auto-Hold does work in Udon, I'm uncertain what you would be running into.
@cunning mist maybe it's a Valve Index thing? when I slightly let go of the controller grip, it definitely drops the object
either that or I'm just not setting up the pickup correctly
I've tried both "Auto Detect" and "Yes" for the AutoHold property on the pickup
@cunning mist maybe it's a Valve Index thing? when I slightly let go of the controller grip, it definitely drops the object
@silk marsh I heard that's a thing on the oculus rift controllers as well. I only have those, so I can't really test this option
It might only work on vive controllers then
damn 😦 you'd think if it worked on Vive it'd work on Index since they're so close
You can't get the players camera btw.
@flint urchin I believe there is a way to get the player's camera. Create a Canvas in the scene with the following properties. Run the scene. Set plane distance to 0.08 if you want a GUI. Set plane distance to 0.00 if you want the Canvas immediately on top of the player (the transform can be used by other game objects to determine where the camera is).
Sure, I know about that one. But you still cannot get the player camera itself.
Which was the case in this response
Besides, you can just get the head position and you don’t need the extra components or code to get it
Pros and cons for both
Using a screen space canvas you are only getting the camera position, but not the camera itself
Bone positions of the head on most custom avatars often have a different Vector3 than that of the main camera. If accuracy is important, then it's recommended to create a canvas with the following properties as a proxy of guaranteeing a frame-perfect lock on the player's Vector3 camera position. If not, then the Vector3 bone position of the head may be used.
TrackingData Head position is the center of your screen / vr
It’s not the bone position
It’s position data directly from the VR headset with a offset
Ah yeah, that method works. Forgot about tracking data.
debugCube.transform.SetPositionAndRotation(Networking.LocalPlayer.GetTrackingData(VRCPlayerApi.TrackingDataType.Head).position, new Quaternion(0, 0, 0, 0));
Like I said, pros and cons to both.
Do the solution that works for you.
Besides, screen space canvas you don’t need to update position on
Though, does require some extra api calls just to get the data
I don't suppose there's a way to lock out a player's WASD or other movement controls is there?
it's kinda infuriating trying to type in an input field and be moving all over the place or crouching down when you hit Z
Maybe: Networking.LocalPlayer.Immobilize(true);
hm, I'll try that tomorrow
hello.
I want to controll VideoPlayer with Udon. but I can't find solutions.
Does anyone know about this?
@silk marsh Immobiilize will only disable moving. It wont disable crouching/proning or jumping.
@sturdy ibex Video players are currently disabled.
How optimized is using Event Update for 20-odd players in a world? It's not gonna be doing much, just a simple regular check, I just want to make sure I'm not doing something an expensive way.
@silk marsh Immobiilize will only disable moving. It wont disable crouching/proning or jumping.
@fiery yoke ah, damn. wish giving focus to an input field would disable those automatically...kinda ridiculous
Well you can disable jumping as well
However you cant disable crouching/proning afaik
proning is the most annoying thing because when you type Z, you can't see the keyboard/input field anymore
gonna probably be easiest for people to use the actual in-world keyboard than to try and type in Desktop mode I guess
¯_(ツ)_/¯
they do!
Upvoted
What method gets called when you try to use an item you're holding?
Is there a way to use Animations through Udon?
I'm trying to play an animation after OnPickupUseUp (UdonSharp)
Animation itself isn't exposed, so...
@digital orbit sure - you can change a variable on an animator, which can transition based on the state of that variable
Ah, my question was kinda ambiguous. I mean, Is there a way I can cause a specific animation to play ?
yeah, you use RuntimeAnimatorController to set parameters
actually just Animator; it relays it automatically
if your UdonBehaviour is on the model with the mesh renderer, this.GetComponent<Animator>().SetBool(...), or SetInt, SetTrigger, etc.
you'll set up the actual animation stuff in the animator controller graph in Unity
i.e. you go from Entry to your normal state, and when the parameter/trigger changes, you can enter a state where the animation plays
My bad, I saw Animation isn't available, that isn't Animator
So in conclusion, does this look right?
(Minus the OnPickUpUseUp, I know the declaration is wrong)
@digital orbit - how are you calling OnStateExit?
I don't know, I was just following Unity docs
Maybe it's in the wrong place
Just trying to set it to disable after it's done playing
Probably this is quite rough as I don't fully understand how it all works
I guess you could have OnPickupUseDown set it to true and OnPickupUseUp set it to false if you want to manage it with a bool. But if you only care about triggering it, maybe Animator.SetTrigger is a better fit?
https://docs.unity3d.com/2018.4/Documentation/ScriptReference/Animator.SetTrigger.html
yeah, Unity Animators / Animations can be tricky to learn, there's a lot of parts.
Ok, so this looks right I think
And this should be good
But it's not triggering on use. I can tell by debug that both are being called.
So, an Udon exception is happening on animator.SetBool which is why nothing is triggering
what's the exception?
It wasn't specific
All it said was, UdoN exception
I could only test this in-game because I can't pickup an item in Unity itself
you can test in editor by adding OnMouseDown/OnMouseUp for easier debugging
Good idea
also, you'll want to set that bool to false at some point
or else I don't think it can transition back and forth
you could set it to true on down and false on up. Should work with both pickups and mousedown/mouseup
or just use a trigger
If I have a defined exit time, the whole thing will play regardless, even though an exit state condition is defined as it being set to false?
That would work fine
I'll see if I can debug this later
are you sure your animator isn't null?
rather than GetComponent, you could make it a public variable and connect it in the inspector. Or at the very least, do a null check after getting it and before you try to use it.
oh right
if you're declaring it as variable anyway, just add [SerializeField] and then you can tie it up in the inspector and skip the GetComponent
Yeah that looks right
Oh wow Discord
It didn't load new messages til I typed; that was in reply to an old message 😂
But yeah you can see that Studio is highlighting that declaration as unused; that's your clue that you shadowed the instance field
Also if you type the word "override" I think it should show you the correct declaration of OnPickupUseUp that you can auto-complete; I know ReSharper does but I think Studio does on its own as well
if you're declaring it as variable anyway, just add [SerializeField] and then you can tie it up in the inspector and skip the GetComponent
@floral dove what is "SerializeField" for? I've never used it on anything
SerializeField will show a private field in the inspector. I prefer it over public variables so I can make sure variables are only accessed where I expect.
Oh, interesting. Never knew that. I dropped all "proper C# programming paradigms" for Udon since it's so limited so I just make the ones I want in the inspector public :p
that's fine on solo projects, but for working with others I find a private variable will communicate intent more.
Is there a good way to figure out the ground height? Right now I'm cheating by grabbing the players Y coords, but..
what do you mean "ground" height? what defines ground?
by ground, I technically mean the closest collider directly underneath
oh, I think you'd have to use the player's position for that, yeah. I'm not sure that raycasting is fully supported in Udon yet
Yeah, that's what I'm figuring. The player pos y works fine, but if I'm in the air for example, then that's where it shows. It would be straight horizontal away at that point and not on the ground
But I can make do though 🙂
yeah. someone else may have figured out a way, but I think until they fix the raycasting method calls, it's unreliable (or impossible; haven't personally tried)
Probably have to wait for more support 😛
Isn't there a check on the player if it's grounded?
There's a isGrounded function on the player object
But this was more about knowing the Y coordinate of the nearest collider directly underneath you so it can be used to set the height of another object
man, I wish that SendCustomNetworkEvent worked in the Unity editor
so annoying having to have if (Networking.LocalPlayer == null) on every call with an alternate call to SendCustomEvent
What are you doing that you need the closest collider underneath?

There might be a way to phrase the problem differently not making use of raycasts and other things ...
Just need to set an object onto the ground directly underneath (and forward after that, but forward isn't difficult since getting those coords is easy)
Even if the persons in the air for example
Raycasts should be working

Just raycast directly down ignoring the player layer
Maybe add a little offset upwards to the player so it won't fail when the player collider is right up against the floor
oh, I had seen an issue on the bug reporting site that implied raycasting wasn't working correctly
must have been fixed
oh neat

Can Udon SetProgramVariable of a private member, or does it have to be public (probably does)?
@digital orbit if you're not sure, give it a try!
@digital orbit It completely ignores if a variable is private or not. The "private" is only synthetic sugar for the Inspector menu.
SetProgramVariable and GetProgramVariable doesn't actually check if the variable is exported
That's good 😄
Is it? 
Both good and downsides
It's basically a form of reflection, so depends on if you think reflection is good or not.
Sometimes during program communication, you want to communicate through some variables, but you don't want them publicly accessible in the inspector menu
One could argue, bad in the case that "private" means it should not be allowed to be changed through external means
I'm willing to accept the risk given I can keep some internal options out of the inspector
Any options in the inspector is like, "see me! Change me!"
@digital orbit you can use [HideInInspector] to hide away any public variables so they're not exposed in the inspector.
you can check them all out here under 'Attributes'. Not all are useful for Udon, but you may find some gems: https://docs.unity3d.com/2018.4/Documentation/ScriptReference/AddComponentMenu.html
All available attributes can be found on the U# wiki https://github.com/Merlin-san/UdonSharp/wiki/udonsharp
How can I communicate with vrchat to an external interface?
How can I communicate with vrchat to an external interface?
What do you mean?
@digital orbit I want to use internet protocol like udp and tcp, and so on.
This would be a HUGE security hole. It's not allowed
It would be abused for malicious purposes
If I remember right, video players were whitelisted, and people abused them in this way as well because they could call a URL
I understood. Thank you for your time.
@digital orbit You can also use [SerializeField] on private variables to make them show in the inspector.
In the end public/private doesnt really have any real value in Udon. Its mostly just for your IDE to cooperate. (And only really useful to convey purpose for other programmers that might look at your code)
@acoustic delta Well, seeing now as you can hide things from the inspector, it seems it's easy enough to make a public changeable variable that's not seen in inspector. 🙂 So I guess no need to make it private to hide it anymore. / My personal coding style /
So public UdonBehavior[] still doesn't work, but it's 75% supported. Hmm
<type> UdonBehaviour[] is still red
Good point
I missed that 😛
This is interesting though
Based off of this, there must be a way to do it
Yeah, that's been there since the beginning. But since type isn't supported, it will fail
Will come soon, priority at the moment is the new UI
Interesting thing, UdonSharpBehavior[] doesn't draw up any errors
Although I haven't tested whether it actually works though
my zone triggers for things like mirrors.. can be triggered by anyone leaving the area
how do i make sure they're just for each player locally?
or in this one to lower sound for a player entering house.. it changes everyones sound
heres what the sound one looks like in inspector
would changing mirror reflection to not hit player but only playerlocal break anything?
or is there a udon solution
or is there a way to make other layers not mess with vr ray casting like mirrorreflection
how do you guys manage to get a ui button to change a value on a variable on udon? Also, can i zoom out somehow?
Zoom will be added when the new UI update comes out
And only a UI component that can send variables can set variables in a behaviour.
@ashen sinew there are examples of changing values with a button in the VRChat Examples folder that comes with Udon, in the SyncUI scene. Take a look at the Readme in there, it will take you through all of the examples.
ooh, i hadnt notice that, thanks
I also have a tutorial on that if the examples are still not doing it for you, but having the actual files to look through yourself is what I consider the best way to learn, so check out the examples first!
Differences between NetworkEventTarget.Owner and NetworkEventTarget.All? Interestingly, I noticed that All triggers the network event on both the person who called the network event, and others
Might it thus be concluded that NetworkEventTarget.Owner skips the owner but does everyone else?
Nope, Owner is what it is, Owner. It will only be sent to the current owner of the Udon Behaviour
I see!
Now one just got to wish for that they add more targets.
is it possible to check who triggered something? yourself vs others?
If you do Interact, you can do Networking.SetOwner(), then on the Network triggered event, just check if you're the owner or not if(!Networking.IsOwner(_player, self.gameObject))
Or you could just set a local boolean and flip it on and off in the methods. As long as you keep your networked functions separate from the ones called from the local user interaction events, you're all good to go
k ill try to play with that
👍 oi sou novo
Will AudioSource Play OneShot loop if the audio source is already set to do so, or will it enforce a single playthrough of its mounted sound?
Realized looking at it that (removed) image one of the values reset and should probably re-test it first...
Is there any quick way to tell if someone respawns?
Or maybe exits a station by respawning from a station?
Okay, as far as I can tell this SHOULD enable an active particle's emission module and it isn't. I know the trigger to it is working, so have I missed anything obvious here?
@mighty fjord there is no other way to detect respawn other than having a trigger collider (the better option) at spawn and do stuff there.
Or use the player position and check if they are at spawn or not (bad option)
Other than that we just got to wait for them to add a respawn event node https://feedback.vrchat.com/vrchat-udon-closed-alpha-feedback/p/onplayerrespawn-node
Ah, yeah, I figured I'd probably just have to add some collider or something instead, thanks for the heads up! ^^
Also, how exactly do you set these events up?
Thanks again! :0
Does anyone know the layer where vrchat used the character controller?
tried both Player and PlayerLocal with no luck
need to check collision with player, this is why i kinda need it
@ashen sinew
You cannot check the player, as the player is a protected object and will always return null in Udon.
There is several ways around it tho:
https://ask.vrchat.com/t/player-collision-in-udon/428
https://ask.vrchat.com/t/phaxenors-examples-graph-u/273/27
Oh, that explains it, thanks!
Okay, just confirming, this above worked for me
don't do this, as it won't work (this was what i was trying to do before):
Spare youre efforts. Youre not the first to ask about Player Collision and you wont be the last xD
Oh, sorry haha, i asked cause there's not much documentation, and couldn't figure it out what was wrong
Yeah dont worry. Documentation will probably come at some point....maybe....hopefully
Yeah, its not like i enjoy having to ask for this kind of stuff or the obvious xD
Its not obvious at all
no, i didnt meant like that, its like, i developed stuff before, so this is the kind of questions that i would normally not do haha
Well everything is a little special in Udon
mhm, this is why i swapped to c# version of it already, the whole graphical thing was making it hard for me
anyways thanks
I'm having trouble with instantiating a pickup object. The prefab has an Empty UdonBehaviour for syncing, VRC_Pickup, collider, and rigidbody script on it, but when I spawn the object in game it doesn't let me pick it up.
Nevermind, I figured it out. Apparently having an animation on the item that modified scale caused it to not be pickupable.
hmmm, do you need that animation at all tho?
It was more to make the object not just pop into existence when instantiated, I could probably get away with using a particle system though to achieve a similar effect.
you can probably code your way through it too
maybe even add the animation after the spawn of the prefab
(just speculating, not sure if that would do the trick)
I'll try that.
Ok, I retract my former statement of the animation being the problem. When I remove the animator and place it in the scene normally, I can pick it up. When I instantiate the same object, I can't pick it up.
@old scaffold instantiation has some known issues at the moment, it's not recommended for use yet.
Gotcha
Does object respawning (like when it falls off of the edge) work properly?
Because I'm not seeing my objects respawn, and I have respawn selected in VRC SCene descriptor. Is it due to the instantiation issue you mentioned?
Sorry to ask as basic a question as this, but how would I go about copying the rotation from one object to another in terms of exactly duplicating the rotation angles? I figured it out using the animation method in SDK2 (that was painful) but I'm struggling just to figure out which nodes I need in UDON
- Get both GameObjects Transformation
object1trans.rotation = object2trans.rotation
yeah, that's what I'm trying to do but I think I'm just screwing up on the nodes I'm grabbing
On this, fatherRotation refences the object this is attached to, and LightToRotate refences the object that I want to copy rotate
DOH! I am the big stupid. Thanks Rexxx!
AO2W3W7TMBTHX6XydVzZ8UfsSruBDTQh8aFuvUFV5Y+TKZAmKHEGVbcn44JH4hVw2nWDtUJlDKkIlFwk9nHyP7/8z3G+fv6yRJem7ACN3i5R3pXlSzOPN2himsLYEmbnVREWJ9VFUcFZY6o2r5s5SlBX+BjFcuqpAI6Vcwpz4yW2SqeYKDBMEumkVDH4Q90WoagrNFqiT2iEU5EOSYIW/SUnQ3KdoKr2cH563EYdKK64O6cJysv6483cdB056SW3K81dr++VfQcuTNaJLFFRtcFUDk6P0ah/eBuaorq4mUboOnnIsvGiDTAfjleDyWDeuropC5sMJtC0MbkjPiT9kQyedmXoGjiqoAuNKZPB686WhXsBi7P6PVRHNsuMcEJSzTgQpa/qlQ76e8Ke1HUJpnpcZWdNfMXhyXpmyvahutD1tF/4y17XgmYeNGCqdPQ6cxprneWYCWuot154L37udcX/W31t9fQAPfVPWH2Xw4ezWQth1tTB9MadfV8GbzoToKlWw+ssJ3Wshk1NWE+EVUpjJdMUc8s0NimlWJAMqBBgiE63a4Ixedv+++q4VxMGslwJ77ChOcVcuBRbSQCnkhBmjRAy51ckPlYz5ijNGNaZ4ZgTMNiyKMZaooErq1jmY+DBlNX253geuW+6zy3UffLf0Wi42kClasee+vgU/mCX2Ou/Yj+a+5hkB807i2r5l8Pca+PagnlyCVWYjYNpwi1L8MJqb1JMPbOYZzKLGKXHqQGWOsGdNGSbJeV8w5KRLWf+iHK/jnIf+DSq/wY=
Copy and paste this
Small fix. anyways, you get the point
@cedar pawn
Thanks, yeah that makes a lot more sense than whatever the heck I was doing
If you know how to program, I suggest UdonSharp. It's more intuitive in my opinion since programming is clear and straight-forward (not that graphs aren't, but if you can, it's easier in the long run)
I've made lots of complicated programs that wouldn't stand a chance in the graph
I know a bit of C#, the only reason I not currently going to UdonSharp is the lack of documentation for UDON atm, so I'm pretty much just trying to use the search function on the nodes as the refence doc to find what I need.... clearly that isn't working for me thus far though lol
Udon Extern search
There's a lot of documentation here actually
And Vowgan's Youtube channel, excellent to get started

