#udon-general

59 messages · Page 17 of 1

south badger
#

Thanks again so much for answering this, it clarifies a lot already

fiery yoke
#

There is almost no one explaining stuff for VRChat specifically on forums

#

A normal developer has all the freedom

south badger
#

Yeah it’s been tough lol

fiery yoke
#

Im not too sure on one aspect of it though

south badger
#

Oh, the effect in VR is terrific btw, as good as Elite: Dangerous. Just not as good looking lol

fiery yoke
#

Well what if you stick your head outside of the windows? :P

south badger
#

Sounds refreshing haha

fiery yoke
#

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

south badger
#

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

fiery yoke
#

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

south badger
#

Ooh interesting

fiery yoke
#

I have done a lot with shaders and custom rendering

south badger
#

So a render area? A large plane?

fiery yoke
#

No a cube

#

inverted cube that is

south badger
#

Oh I see

fiery yoke
#

or just frontface culling

south badger
#

False skybox

fiery yoke
#

Yeah essentially

south badger
#

That’s cool. Writing this down..

fiery yoke
#

I assume your space setup is scaled down

#

i.e. its not 1:1 in your scale

south badger
#

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

fiery yoke
#

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

south badger
#

Ah, is that pretty intensive?

fiery yoke
#

And I kinda like that idea

#

No you just have to scale the planes down as well

south badger
#

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?

fiery yoke
#

You should just need one

#

It has the same field of view as your camera

south badger
#

Interesting

fiery yoke
#

This is why I said you need a lot of knowledge about rendering ;P

#

and/or experience

south badger
#

Haha I see

fiery yoke
#

I kinda want to make this as well now

#

Source Skyboxes are pretty fun

south badger
#

It’s a ton of fun to fly around, set cruise control, and then walk around.

fiery yoke
#

Im not much for flying around in VR. I get motion sick really quick. But making Source Skyboxes sounds like a nice challenge

south badger
#

If you do could you maybe send me a link to the world?

fiery yoke
#

Well I have to work on it first 😅

south badger
#

Hah true. So the key phrase I have to research is source skybox?

fiery yoke
#

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

south badger
#

True

fiery yoke
#

Essentially the Camera there is fixed in place. What youre doing is making it move around

south badger
#

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?

fiery yoke
#

I have no idea what youre trying to say there

south badger
#

If a large plane basically childed itself to your camera, like a UI behind everything else

fiery yoke
#

Its only geometrically a cube. The shader would make it appear as if it has no edges

#

since youre not even rendering anything

south badger
#

Ah that’s fascinating

fiery yoke
#

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

south badger
#

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?

fiery yoke
#

No

#

At least not that Im aware of

#

thats just how I would approach that problem. Someone else might have a completely different idea

wide gyro
#

Question about namespace "UdonSharp" is this an old namespace?

fiery yoke
#

UdonSharp is a custom compiler interpreting C# code into UdonAssembly. Written by the community member Merlin

south badger
#

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?

fiery yoke
#

I suppose. But thats definitely not the "clean" way

south badger
#

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!

fiery yoke
#

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

south badger
#

It is exciting making things on such a new platform though! And the community is terrific. Thanks so much

wide gyro
#

yeah thanks helper... i still can't open the door, but at least i can make it squeak...

worthy beacon
#

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

errant pilot
#

Dont know? All i know is pickup objects work funky and its local only

worthy beacon
#

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

worthy beacon
#

found the issue, didnt have anything to do with that, nm then XD

shrewd mural
#

How do I set the variable of one gameobject's udon program from another?

floral dove
#

@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
shrewd mural
#

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?

lusty glade
#

Create an UdonBehaviour Variable, make it public, and point it to the object that contains the UdonBehaviour.

shrewd mural
#

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

lusty glade
#

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.

shrewd mural
#

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.

floral dove
#

@shrewd mural ooh, I see. That's a known issue - the workaround is:

  1. Connect the Game Object Get Component to instance using the 'T' mode in the dropdown
  2. Switch it back to Type mode
shrewd mural
#

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

errant pilot
#

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.

shrewd mural
#

owait udonsharp

errant pilot
#

Yes

tawdry surge
#

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.

flint urchin
#

TextAssets are text files, so yes

spring brook
#

What do I put in Udon graph for getting a gameobject to toggle on onenter and off onexit?

plain plaza
sturdy ibex
#

Hello.
I think , I want to make world members counter.
but this code doesn't work.
Please help me.

fiery yoke
#

Youre setting the text, but youre never setting the variable itself.

sturdy ibex
#

Oh! I'm stupid.

scarlet lake
#

so i made a button in udon graph which toggles a box 'locally', how does one not make it local?

fiery yoke
#

Well. There is two ways I can think of. Both of them have advantages and disadvantages

scarlet lake
#

so there is no good way to do a global trigger? @fiery yoke

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.

shrewd mural
#

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).

worn kestrel
#

You need to delay setting variables on instaniated udon behaviours until the next frame

fiery yoke
#

You cannot immediately after instantiating "use"...yeah what he says

shrewd mural
#

ah, i see

fiery yoke
#

They need a few (maybe just one) frames to intialize properly

worn kestrel
#

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

fiery yoke
#

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

shrewd mural
#

I only have one spawner, so that would work :)

#

well wait

fiery yoke
#

Ofcourse that might break if players join too quickly

#

so yeah

#

Networking is fun

shrewd mural
#

lol

worn kestrel
#

You may also need to handle multiple players joining before you can set your behaviours variables

#

Yeah what helpful said

shrewd mural
#

Too bad there isn't an "Initialize"

#

that would make things a whole lot easier

fiery yoke
#

Life would be too borring if things were easy :^)

shrewd mural
#

So I had an idea for handling multiple people joining at the same time, but it looks like I can't do it

fiery yoke
#

What exactly are you even trying to do?

shrewd mural
#

I want some stats to show up above each player

fiery yoke
#

I have a premade system for giving each player a dedicated object.

shrewd mural
#

ofrick

fiery yoke
#

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

worn kestrel
#

Does your system use an object pool?

fiery yoke
#

Yeah

#

thats the only way to do that currently

shrewd mural
#

object pool?

worn kestrel
#

that allows you to deal with synced behaviours aswell, is that something your player stats system needs?

fiery yoke
#

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

worn kestrel
#

Sync makes everything harder

fiery yoke
#

Definitely makes me harder ( ͡° ͜ʖ ͡°)

worn kestrel
#

OwO

fiery yoke
#

xD

shrewd mural
#

btw thank yall for helping me :)

fiery yoke
#

So do you need synchronization/communication between players?

shrewd mural
#

yea

fiery yoke
#

Are you sure?

shrewd mural
#

absolutely

#

what this is supposed to do is display a list of flags for each language the player speaks

fiery yoke
#

Ahh well yeah that would be difficult to do otherwise

shrewd mural
#

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?

fiery yoke
#

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

errant pilot
#

Does anyone know the correct syntax for using the event OnTriggerEnter in Udon Sharp? Itll help me greatly

fiery yoke
#

public override void OnTriggerEnter(Collider other)
However that wont help you much with Player collisions

#

as players will always be null

shrewd mural
#

@fiery yoke Sorry for keeping you on this, but it doesn't seem to work.

#

Does the position/rotation of the root object matter?

fiery yoke
#

It generally shouldnt

#

I havent fully tested it in its current state

#

but it should work

shrewd mural
#

wait hold on

#

are you able to test things in the Unity editor?

fiery yoke
#

No I tested it in game

shrewd mural
#

Then what's with the Debug.Log stuff?

fiery yoke
#

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.

shrewd mural
#

Ah, gotcha

#

Is there a tutorial for getting that set up?

fiery yoke
#

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

shrewd mural
#

lol ok

#

RShift + ` + 3? That's an odd combo lol

shrewd mural
#

@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?

fiery yoke
#

Well yeah ofcourse

#

My system just gives each player an object they own. The rest you have to do yourself

shrewd mural
#

Mkay

primal umbra
#

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.

scarlet lake
#

what is udon

fiery yoke
#

We need a bot for this...

scarlet lake
#

ooo

#

nice

#

wait what thats not a bot??

fiery yoke
#

No Im not a bot. Thanks.

scarlet lake
#

oh

fiery yoke
#

Or am I? :^)

primal umbra
#

they are one of the most helpful people on this server.

scarlet lake
#

dayum this place is rly confusing

errant pilot
#

HelpfulHelper is quite helpful, yes

shrewd mural
#

Hmm, this floor is made out of floor

#

omg yes it finally works.

#

aaaAA

scarlet lake
#

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

fiery yoke
#

Audio is especially difficult

#

like do you want late joiners to sync up as well

scarlet lake
#

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

fiery yoke
#

Hmm welp that aint too easy.

#

But I have other stuff to do rn. Maybe someone else can help you

scarlet lake
#

all good thanks

cloud kindle
#

does anyone know how to detect if a player is touching the ground or not?

errant pilot
#

Maybe if you check if localplayer's position y is at 0.

cloud kindle
#

hmmm

dreamy tangle
#

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.

glad oak
#

@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

dreamy tangle
#

@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

glad oak
#

Alright, I'm asking because there's no tutorial and whenever I add the pickup script in UDON, it doesn't work.

dreamy tangle
#

...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

errant pilot
#

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?

silk marsh
#

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

worthy beacon
#

@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();

fair bough
#

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)

flint urchin
#

@fair bough you can’t update sync variables directly after setting the new owner. Got to wait a few frames first.

fair bough
#

oh I must wait few frames after set ownner?

sturdy ibex
errant pilot
#

@sturdy ibex when do you want your text to update? Its currently setting your text to that set string every frame

sturdy ibex
#

I want to use like Debug.Log. when I Interact some Object.

errant pilot
#

You would want to change update to interact. Since it will change once you interact the object instead of 90 times a second

sturdy ibex
#

OK. I try it.

shrewd mural
#

Does editing the main camera change the player camera as well?

fiery yoke
#

Only certain settings, and only if you set it as the reference camera

shrewd mural
#

In particular I want to disable Occlusion Culling

#

Is that one of the settings?

fiery yoke
#

Uhhhh...no idea about that

#

I would guess not

shrewd mural
#

Or even better, post processing effects

worthy beacon
#

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

fiery yoke
#

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

worthy beacon
#

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

fiery yoke
#

Hmm maybe it is immediate locally. But yeah then it will still take a lot of time to update on other clients.

worthy beacon
#

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

fiery yoke
#

Even just 100ms is an eternity in Frames.

worthy beacon
#

It is

fiery yoke
#

Thats about 10 frames at 60fps

worthy beacon
#

That's why the system only collects the players after u hit a button and a 10 second timer finishes

visual surge
#

is there a way to acess the localplayer camera component with udon?

fiery yoke
#

No.

visual surge
#

oof

errant pilot
#

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?

fiery yoke
#

You loop through the array and get everyones position, then evaluate them.

errant pilot
#

Ok so like, how does udon know which player is which and not just the local player?

fiery yoke
#

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

errant pilot
#

Oh. So like everyplayer has a unique id that you can grab from VRCPlayerApi right? And assign them to the array

fiery yoke
#

No thats not how that works.

#

You have an array of PlayerApis

errant pilot
#

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

fiery yoke
#

No thats not how that works either.
Trying to get into programming (again) with VRChat Udon might not be the easiest/smartest move.

worthy beacon
#

I hope they change the method within vrcplayerapi that gets all players to return an array or support lists at some point >.<

errant pilot
#

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.

grizzled thistle
#

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?

errant pilot
#

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

grizzled thistle
#

so add a node with another gameobject and set a variable to that gameobject with = false?

errant pilot
#

Correct

grizzled thistle
#

now i get it but i think i need a documentary or something to find the right nodes xD

earnest harbor
#

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?

cloud kindle
#

does anyone know how to make an interactable item in udon?

#

nvm

shrewd mural
#

Does a GameObject's active state get synced in networking?

fiery yoke
#

You have to sync it yourself. Nothing is synced inherently

gilded dome
#

lololol

shrewd mural
#

ok, that I have no clue where to even begin.

fiery yoke
#

Yeah

#

Networking is a mess.

#

There is multiple ways to sync a boolean. All of them have drawbacks.

shrewd mural
#

please bestow upon me your knowledge

fiery yoke
#

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

cloud kindle
#

does anyone know how to make an animation clip play on an object when interacted with?

grizzled thistle
#

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

digital orbit
#

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."

old sky
frozen plover
#

Hey everyone. Im having an issue when try to publich a world. Any idea why this is popping up?

upper geyser
#

ignore that message, we all get it , should still work

frozen plover
#

When i click upload, nothing happens.

native estuary
#

Do you have error pause on?

#

At top of the console

frozen plover
#

nope. Error pause is not on.

#

for clarification. The upload button appears. I can click it. It just does nothing.

native estuary
#

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

frozen plover
#

THANK YOU

#

that fixed it right up. I cannot thank you enough.

native estuary
#

Oh, so you did have multiple pipeline managers? That was a half guess looking at the sdk code 😅

frozen plover
#

well it worked so i thank you!

sturdy ibex
#

hello, Please help me.
How can I make sound when some people Joinned my world.

mortal star
#

Shouldn’t there be OnPlayerJoined event?

#

Instead of start?

sturdy ibex
#

I changed event from Start to OnPlayerJoined. but I can't heard anything.

hushed gazelle
#

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."

digital orbit
#

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

mighty fjord
#

Any way to set Animator Controller Parameter floats and then have them apply so I can use that Controller in a station?

pallid mango
#

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

fiery yoke
#

Thats not how Custom Events work.

pallid mango
#

CustomMessage

fiery yoke
#

I assume they meant custom event. I dont know what else would be a "CustomMessage"

pallid mango
#

I was responding to Whadageek’s question

fiery yoke
#

Same.

pallid mango
#

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

grizzled thistle
#

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?

iron fractal
#

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..

torn shoal
#

In the future off vrchat is the whole UI going to be changed?

long rune
#

Yes.

acoustic delta
#

@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.

torn shoal
#

oh sorry and thank u

frozen plover
#

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?

worthy beacon
#

anyone know the max speed in vr players normally have?

worthy beacon
#

nm, found it its 4 moving forward/back, and 2 moving left to right

topaz flower
#

:V How do I teleport people to another spot on a map

floral dove
#

@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

fair bough
#

Ummm.... How event OnDeserialization() work?

topaz flower
#

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?

topaz flower
#

Even tried to add the thing after, it just looks like it scales to the object automatically...it sucks.

digital orbit
#

Anyone know if there's a way to do a timeout?

fiery yoke
#

define timeout

digital orbit
#

What do you mean? I meant something like a settimeout function. It would call a callback after a certain period of time

sturdy ibex
#

Please help me.
I want to know unique ID of VRChat user's.
How can I know this?

fiery yoke
#

@digital orbit the term timeout or time-out has several meanings

#

That is usally called a delay

digital orbit
#

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

fiery yoke
#

Checking something on Update is the best way afaik

#

there really isnt any other way to do that

#

and @sturdy ibex you cant.

digital orbit
#

Ah. I can't wait for Udon to mature more 😄

#

But for an alpha, it's pretty impressive already

fiery yoke
#

The best approach would be coroutines, but those will probably not be supported for a long time if at all

sturdy ibex
#

I'm sad.😭

zinc thicket
#

@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?

fiery yoke
#

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

digital orbit
#

Yup, that's why I was hoping there was a more elegant method 😄

#

@zinc thicket Thank you for the sample code!

zinc thicket
#

Yeah, but gotta make do 😦

#

And then when you try to take timing into your own hands... (Chaos)

digital orbit
#

That's what we call, kludgy code, cause we have no choice :3

fiery yoke
#

More often than not, there is a clever way around "kludgy" code

digital orbit
#

Yeah, that's why I always like to ask in case I missed something. :3 I prefer beautiful code whenever possible

fiery yoke
#

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?

grizzled thistle
#

does anyone has a ready Udon Script for Mirror Settings? (Low/High) i diddnt find any solution for that

west plover
#

@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.

fiery yoke
#

I want to avoid a pool

#

Minimum network load.

#

Only one synced var.

glad oak
#

Anyone have a script or graph UDON for master locks/controls?

shrewd bluff
#

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

fiery yoke
#

No.

shrewd bluff
#

are there any alternatives?

#

since im working with a mess of variables being set to null and the list increasing in size

fiery yoke
#

Arrays. Thats the best you get.

shrewd bluff
#

alright, thanks buddy

dull nova
#

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....

digital orbit
#

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

glad oak
#

@digital orbit Some worlds have buttons that can only be used by the instance creator. I need an UDON version of them

digital orbit
#

You mean a keypad?

#

Or something else?

glad oak
#

something else

#

like a master reset to all pens/pencil

#

etc

dull nova
#

@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.

digital orbit
#

Glad you got it solved

frozen plover
#

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?

floral dove
#

@frozen plover - the VRChat Examples should work when you run a Build & Test. Have you followed along with the Readme?

zinc thicket
#

@dull nova Import SDK2, then SDK3, close Unity and delete the SDK2 dll from the plugins folder.

shrewd bluff
#

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!

fiery yoke
#

You have a null reference there, meaning that "game" is null.

shadow geyser
#

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

digital orbit
#

@shadow geyser

#

I think this should work

shrewd bluff
#

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

fiery yoke
#

Udon needs a bit to initialise after being instantiated, so you cant access the UdonBehaviour right away.

shrewd bluff
#

ah ok thx, cant wait for udon to become something more... useable and easy to use lmao

#

we can multithread right

fiery yoke
#

No?

#

Multithreading is pretty complicated in normal programs

#

Udon is very far away from being able to multithread

shrewd bluff
#

cant wait for udon to become useable 😢

fiery yoke
#

It is useable. Just not very user-friendly

#

and highly limited in functionality

shrewd bluff
#

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

fiery yoke
#

Good luck with that ^^

shrewd bluff
#

thanks 😄

peak mason
#

Hello o/, can peoples confirm "OnAnimatorIK" doesn't work with udon ?

dull nova
#

thx @zinc thicket

shrewd bluff
#

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.

fiery yoke
#

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().

shrewd bluff
#

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?

fiery yoke
#

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

shrewd bluff
#

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

fiery yoke
#

Yeah that isnt so silly

#

Ive seen a few people do that for some shorter "arrays"

#

however using that is ... not easy

shrewd bluff
#

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

fiery yoke
#

Editor is usually a lot faster than in game. But with certain things it can be much slower. So just test it in game

shrewd bluff
#

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

shrewd bluff
#

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];
                }
            }
        }
    }```
fiery yoke
#

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

shrewd bluff
#

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

#

now if this works better than arrays...

#

i wouldnt know what world we live in...

old scaffold
#

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.

shrewd bluff
#

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)

dusk lance
#
[<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.
shrewd bluff
#

isnt it just if(gameobject) { // do stuff if it exists }

#

gameobject being the GameObject you are checking for

dusk lance
#

Hmm, that generates op_implicit. Time to test if that works

haughty jay
#

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 = ""

dusk lance
#

TextMesh is different than Text.

#

Are you using UI Text or TextMeshPro?

haughty jay
#

TextMeshPro

dusk lance
#

That is why

#

Text is UI.Text

haughty jay
#

alright

dusk lance
#

I'm not sure about changing text mesh pro, but it might not be exposed in udon.

haughty jay
#

thanks, I'll try UI.Text

haughty jay
#

@dusk lance thanks a lot. Its working

dusk lance
#

Awesome

shadow geyser
#

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.

cunning mist
#

@shadow geyser Do you have any errors in your console? And have you pressed "compile all" on the udonsharp behaviour yet?

shadow geyser
#

ill check real quick

shadow geyser
#

sorry unity is taking forever

#

i have just done that and no errors

shadow geyser
#

that seemed to have worked

rancid ruin
#

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

flint urchin
#

Use Play One Shot instead

#

oh nvm

#

You can't do multiple flows from outputs

#

only inputs

rancid ruin
#

k

flint urchin
#

So do Trigger -> Stop Audio -> Play Audio

rancid ruin
#

would there be no way to play the splash sound then start the ambience?

flint urchin
#

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

rancid ruin
#

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

hoary ocean
#

playerapi get display name is how I would get a player's name, correct?

tropic canyon
#

Yes

sick dawn
#

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.

hoary ocean
#

are you using U# or normal Udon?

sick dawn
#

udon

hoary ocean
#

try using \n (make sure it is a backslash)

#

use it as the separator when you join strings

sick dawn
hoary ocean
#

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

sick dawn
#

so remove the string from the on instance?

#

for the leave one

hoary ocean
#

oh, you want to track who has left?

#

or just remove them from the joined?

sick dawn
#

to remove them from the list

hoary ocean
#

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

sick dawn
#

ok

rancid ruin
#

how do i reference the object itself that the bahaviour is attached to?

#

for say doing a branch check

hoary ocean
flint urchin
#

Any self reference is done automatically

rancid ruin
flint urchin
#

You can't get the players camera btw.

rancid ruin
#

ah shit

flint urchin
#

The camera in the scene isn't attached to the player at all.

rancid ruin
#

i thought that was the reference camera

#

if you set it to it

flint urchin
#

Nope, it only gets the values on the reference camera to use on the player camera

rancid ruin
#

well now im just stumped

flint urchin
#

Make a gameobject and get the players head position and use that

rancid ruin
#

ah

sick dawn
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

sick dawn
hushed gazelle
#

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.

cunning mist
#

Instead of UnityObject, use UdonBehaviour.

#

Otherwise you should be good

rancid ruin
#

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

hushed gazelle
#

Thanks @cunning mist !

cunning mist
#

👍

hushed gazelle
#

Also my complements to your excellent tutorial videos on Udon.

cunning mist
#

Big thanks

hushed gazelle
#

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?

cunning mist
#

You'd have to do a foreach loop, though for loops computate more efficiently so I'd recommend doing those instead.

hushed gazelle
#

Cheers.

#

Oh, one other question; Is there a way to say "if the custom event came from the same object/udon behaviour, ignore it"?

hoary ocean
#

I found out my problem and how to fix it. I was referring to the gameobject and not the udon component

#

dummy me

hoary ocean
#

how would I do oninput commands?

hushed gazelle
digital orbit
#

Vowgan, are you thinking of doing a tutorial on an Udon 3rd person camera?

#

I've always wanted to know how to make one

hushed gazelle
#

so are UdonBehaviours[] being broken a known bug?

digital orbit
#

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?

hushed gazelle
#

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.

digital orbit
#

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

hushed gazelle
#

How do I kill a player via Udon? Not looking for health damage, but more "touch trigger area, die and respawn" behaviour.

haughty jay
#

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

old scaffold
#

@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?

fiery yoke
#

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.

old scaffold
#

Hmm... Fair enough. Thanks for the quick reply!

fiery yoke
#

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.

old scaffold
#

Yeah, I first attempted to do it with render textures and quickly realized VRChat doesn't like that very much.

fiery yoke
#

Well yeah because rendering in VR is a lot more complicated than non-VR.

old scaffold
#

Guess I'll do some more research then, I'll let you know if I manage to get something working.

fiery yoke
#

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 😅

mighty fjord
#

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?

desert pike
#

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 ?

kind stag
#

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

desert pike
#

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 ?

raven peak
desert pike
#

Ah, so looks like basically it was released like that so knowledgeable people would do prefab work themselves. Cleaver.

digital orbit
#

Cleaver 😆 vrcLike

desert pike
#

But anyway thanks for your answers people. Cheers.

tropic canyon
#

🙏

#

@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 :/

digital orbit
#

Clever

mighty fjord
#

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

tropic canyon
#

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

mighty fjord
#

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

tropic canyon
#

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

mighty fjord
#

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

tropic canyon
#

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

mighty fjord
#

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

tropic canyon
#

what

mighty fjord
#

Okay so maybe I need to give you some more context

tropic canyon
#

if you can't set one thing you won't be able to set a different thing either

mighty fjord
#

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

tropic canyon
#

seems like you are not able to change the animator instance used in that station

#

wait 🤔

mighty fjord
#

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

tropic canyon
#

the float and things are stored in the animator

#

so good luck getting to the animator :)

#

What animation is it?

mighty fjord
#

Stored in the animator component itself?

#

Just a simple animation I made that changes some transform from 0 to 2

tropic canyon
#

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

mighty fjord
#

Maybe, I'll check it out

tropic canyon
#

no setBool etc cause those are part of the Animator

mighty fjord
#

Yeah

tropic canyon
#

else everything in vrchat would be moving at the same time

mighty fjord
#

And that would be individual

tropic canyon
#

if they were all linked

mighty fjord
#

Is there a node to add a Parameter? Kindof struggling to find one

tropic canyon
#

though luck getting a reference to the animator

#

it might not be exposed

#

didn't check

#

oh

#

it's part of the UnityEditor; library

mighty fjord
#

This is proving alot harder than I'd hope for it to be

tropic canyon
#

What does the animation do?

mighty fjord
#

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

shadow geyser
#

how would i make a behavior that fires when a player touches it?

tropic canyon
#

OnCollisionEnter maybe

silk marsh
#

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

tropic canyon
#

OnPickupUseDown

#

but you gotta set that up in the pickup

#

pickups don't use interact

#

they use

#

OnPickup()

#

and OnDrop()

silk marsh
#

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?

tropic canyon
#

public override void OnPickup(){}

silk marsh
#

oh, it's just implicit

silk marsh
#

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

cunning mist
#

Auto-Hold does work in Udon, I'm uncertain what you would be running into.

teal isle
#

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!
floral dove
#

Udon doesn't work with SDK2

heavy adder
#

How to I get verified?

floral dove
#

@heavy adder I recommend you make a VRChat account and play it for a while. This channel is for talking about Udon development FYI.

heavy adder
#

I did

#

But ty

silk marsh
#

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

haughty jay
#

@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

silk marsh
#

damn 😦 you'd think if it worked on Vive it'd work on Index since they're so close

chilly aspen
#

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).

flint urchin
#

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

chilly aspen
#

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.

flint urchin
#

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

chilly aspen
#

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));

flint urchin
#

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

silk marsh
#

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

chilly aspen
#

Maybe: Networking.LocalPlayer.Immobilize(true);

silk marsh
#

hm, I'll try that tomorrow

sturdy ibex
#

hello.
I want to controll VideoPlayer with Udon. but I can't find solutions.
Does anyone know about this?

fiery yoke
#

@silk marsh Immobiilize will only disable moving. It wont disable crouching/proning or jumping.

hushed gazelle
#

@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
#

@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

fiery yoke
#

Well you can disable jumping as well

#

However you cant disable crouching/proning afaik

silk marsh
#

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

silk marsh
#

oh perfect, time to upvote

#

(assuming any of those actually get looked at)

fiery yoke
#

¯_(ツ)_/¯

floral dove
#

they do!

digital orbit
#

Upvoted

digital orbit
#

What method gets called when you try to use an item you're holding?

silk marsh
#

OnPickupUseDown and OnPickupUseUp I think

#

they're overridable in UdonSharpBehaviour

digital orbit
#

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...

floral dove
#

@digital orbit sure - you can change a variable on an animator, which can transition based on the state of that variable

digital orbit
#

Ah, my question was kinda ambiguous. I mean, Is there a way I can cause a specific animation to play ?

silk marsh
#

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

digital orbit
#

My bad, I saw Animation isn't available, that isn't Animator

digital orbit
#

So in conclusion, does this look right?

#

(Minus the OnPickUpUseUp, I know the declaration is wrong)

floral dove
#

@digital orbit - how are you calling OnStateExit?

digital orbit
#

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

floral dove
#

yeah, Unity Animators / Animations can be tricky to learn, there's a lot of parts.

digital orbit
#

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

floral dove
#

what's the exception?

digital orbit
#

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

floral dove
#

you can test in editor by adding OnMouseDown/OnMouseUp for easier debugging

digital orbit
#

Good idea

floral dove
#

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

digital orbit
#

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

digital orbit
#

Here we are

floral dove
#

are you sure your animator isn't null?

digital orbit
floral dove
#

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.

digital orbit
#

I see the problem

#

The type turned it into local

#

No wonder

floral dove
#

oh right

digital orbit
#

Subtle

#

Thanks for the help 😉

floral dove
#

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

silk marsh
#

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

floral dove
#

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.

silk marsh
#

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

floral dove
#

that's fine on solo projects, but for working with others I find a private variable will communicate intent more.

digital orbit
#

Is there a good way to figure out the ground height? Right now I'm cheating by grabbing the players Y coords, but..

silk marsh
#

what do you mean "ground" height? what defines ground?

digital orbit
#

by ground, I technically mean the closest collider directly underneath

silk marsh
#

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

digital orbit
#

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 🙂

silk marsh
#

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)

digital orbit
#

Probably have to wait for more support 😛

tropic canyon
#

Raycasting is broken?

#

Isn't there a check on the player if it's grounded?

digital orbit
#

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

silk marsh
#

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

tropic canyon
#

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 ...

digital orbit
#

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

tropic canyon
#

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

silk marsh
#

oh, I had seen an issue on the bug reporting site that implied raycasting wasn't working correctly

#

must have been fixed

tropic canyon
#

Merlin says it's working

#

Like with the out raycasthit

silk marsh
#

oh neat

tropic canyon
digital orbit
#

Oh nice, that's good to know

digital orbit
#

Can Udon SetProgramVariable of a private member, or does it have to be public (probably does)?

floral dove
#

@digital orbit if you're not sure, give it a try!

acoustic delta
#

@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

digital orbit
#

That's good 😄

acoustic delta
#

Is it? vrcThinking

digital orbit
#

Both good and downsides

acoustic delta
#

It's basically a form of reflection, so depends on if you think reflection is good or not.

digital orbit
#

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!"

floral dove
#

@digital orbit you can use [HideInInspector] to hide away any public variables so they're not exposed in the inspector.

digital orbit
#

THAT is a good thing to know!

#

Thanks for that tidbit!

floral dove
flint urchin
sturdy ibex
#

How can I communicate with vrchat to an external interface?

digital orbit
#

How can I communicate with vrchat to an external interface?
What do you mean?

sturdy ibex
#

@digital orbit I want to use internet protocol like udp and tcp, and so on.

digital orbit
#

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

sturdy ibex
#

I understood. Thank you for your time.

fiery yoke
#

@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)

digital orbit
#

@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

flint urchin
#

<type> UdonBehaviour[] is still red

digital orbit
#

Good point

#

I missed that 😛

#

This is interesting though

#

Based off of this, there must be a way to do it

flint urchin
#

Yeah, that's been there since the beginning. But since type isn't supported, it will fail

digital orbit
#

Ahhhh, ok , I see 😮

#

Just have to wait for more updates then 😛

flint urchin
#

Will come soon, priority at the moment is the new UI

digital orbit
#

Interesting thing, UdonSharpBehavior[] doesn't draw up any errors

#

Although I haven't tested whether it actually works though

rancid ruin
#

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?

#

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

ashen sinew
#

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?

flint urchin
#

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.

floral dove
#

@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.

ashen sinew
#

ooh, i hadnt notice that, thanks

cunning mist
#

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!

digital orbit
#

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?

flint urchin
#

Nope, Owner is what it is, Owner. It will only be sent to the current owner of the Udon Behaviour

digital orbit
#

I see!

flint urchin
#

Now one just got to wish for that they add more targets.

rancid ruin
#

is it possible to check who triggered something? yourself vs others?

digital orbit
#

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

rancid ruin
#

k ill try to play with that

silk halo
#

👍 oi sou novo

hushed gazelle
#

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...

mighty fjord
#

Is there any quick way to tell if someone respawns?

#

Or maybe exits a station by respawning from a station?

hushed gazelle
#

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?

flint urchin
mighty fjord
#

Ah, yeah, I figured I'd probably just have to add some collider or something instead, thanks for the heads up! ^^

mighty fjord
flint urchin
mighty fjord
#

Thanks again! :0

ashen sinew
#

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

fiery yoke
ashen sinew
#

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):

fiery yoke
#

Spare youre efforts. Youre not the first to ask about Player Collision and you wont be the last xD

ashen sinew
#

Oh, sorry haha, i asked cause there's not much documentation, and couldn't figure it out what was wrong

fiery yoke
#

Yeah dont worry. Documentation will probably come at some point....maybe....hopefully

ashen sinew
#

Yeah, its not like i enjoy having to ask for this kind of stuff or the obvious xD

fiery yoke
#

Its not obvious at all

ashen sinew
#

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

fiery yoke
#

Well everything is a little special in Udon

ashen sinew
#

mhm, this is why i swapped to c# version of it already, the whole graphical thing was making it hard for me

#

anyways thanks

old scaffold
#

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.

ashen sinew
#

hmmm, do you need that animation at all tho?

old scaffold
#

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.

ashen sinew
#

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)

old scaffold
#

I'll try that.

old scaffold
#

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.

floral dove
#

@old scaffold instantiation has some known issues at the moment, it's not recommended for use yet.

old scaffold
#

Gotcha

digital orbit
#

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?

cedar pawn
#

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

digital orbit
#
  1. Get both GameObjects Transformation
  2. object1trans.rotation = object2trans.rotation
cedar pawn
#

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

digital orbit
cedar pawn
#

DOH! I am the big stupid. Thanks Rexxx!

digital orbit
#

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

cedar pawn
#

Thanks, yeah that makes a lot more sense than whatever the heck I was doing

digital orbit
#

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

cedar pawn
#

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

digital orbit
#

Udon Extern search

#

There's a lot of documentation here actually

#

And Vowgan's Youtube channel, excellent to get started

cedar pawn
#

By sharing that link, you probably just saved me hours of frustration lol thanks!

#

I've watched a handful of his vids, but I didn't realize these other websites existed too

digital orbit
#

For the rest that's not covered here, make a blank graph, search the node editor, and you can usually figure out what code it'll be

#

At least this should give you a fighting chance