#udon-general

59 messages ยท Page 101 of 1

scarlet lake
#

trying some ways but or everyone get teleported (the one that lefted too)

#

or no one at all

mossy thunder
#

i don't know how to read udon yet. where in your code is it checking if the player being checked is the player who left the collider?

scarlet lake
#

it is the method, OnPlayerTriggerExit(player)

#

it comes with the player that left the box collider

mossy thunder
#

i could be misreading what it's doing but it seems to me you would want an if else with the triggering player in the if side doing nothing and the other players in the else side doing the teleporting?

scarlet lake
#

the problem is more like this one

#

if (players[i] != null && players[i] == Networking.LocalPlayer) SendCustomEventDelayedFrames("OnGameFinishTeleport", 1);

#

since I remove the player from the array when they left

#

it seems like that it doesn't enter in that state

#

at all

coarse parrot
#

You could just teleport LocalPlayer to the player who exited the trigger. Do you need extra condition?

mossy thunder
#

i'm wondering are you trying to get the pool down to 1 or detect the first one to leave? on thinking about it i assume the latter otherwise it seems pointless to manipulate the array.

scarlet lake
#

the pool in the end will have only 1 player, and I want it to teleport him away

#

if (players[i] != null) player.TeleportTo(respawnPoint.position, respawnPoint.rotation);

#

I think this should work maybe

coarse parrot
#

Teleporting works only on LocalPlayer btw

mossy thunder
#

ahh so a last man standing kind of situation. yeah gonna want to shrink the array then...can you output the contents of the variable to some kind of dev console to confirm the array slot and the variable match?

#

that's the only reason i could think that it's not properly nulling it out.

scarlet lake
#

I think i get the array empty before it happen since

coarse parrot
#

Ok I see. If you have an array of player who is in the trigger, you can use System.Array.IndexOf method to get an index of player containing in the array. If player doesn't exists in the array, the index will be -1

scarlet lake
#

ye and I think the array is like empty in that moment

#

An exception occurred during EXTERN to 'VRCSDKBaseVRCPlayerApi.__TeleportTo__UnityEngineVector3_UnityEngineQuaternion__SystemVoid'.

#

mhm

coarse parrot
#

Should see detail on another line too

scarlet lake
#

Runtime error detected, but the client has not been launched with '--enable-udon-debug-logging' so the error cannot be traced. Add the argument to your client startup and try again.
[UdonBehaviour] An exception occurred during Udon execution, this UdonBehaviour will be halted.
VRC.Udon.VM.UdonVMException: An exception occurred in an UdonVM, execution will be halted. ---> VRC.Udon.VM.UdonVMException: An exception occurred during EXTERN to 'VRCSDKBaseVRCPlayerApi.__TeleportTo__UnityEngineVector3_UnityEngineQuaternion__SystemVoid'. ---> System.NullReferenceException: Object reference not set to an instance of an object.

#

this is the ful

#

full*

coarse parrot
#

Whatever calling TeleportTo doesn't have value assigned

mossy thunder
#

oo i'm prolly gonna wanna figure out where to add that command to.

#

question. in udon are arrays' .length value or whatever it is in udon dependant on FILLED slots or LAST filled slot? like if i have an array Fu[] where I've put "Bar" in slot 55 but haven't put anything else in it would it be listed as a size of 55 or of 1?

scarlet lake
#

ok that error

#

was something else, a little mistake that I did while I was changing something

coarse parrot
scarlet lake
#

it doesn't matter with the teleport at the end

mossy thunder
coarse parrot
#

Yes

mossy thunder
#

damn...so then for my use case i think i'll hafta itterate through the array's 10 possible slots checking if they are null while incrementing a variable then use that in place of the length...

scarlet lake
#

it would be nice to use Lists and LinQ but I guess we can't

mossy thunder
#

i seem to recall some methodology in c where you could check the length of an array both ways...don't recall how that worked but it'd be cool if every language had it. ๐Ÿ˜›

#

hrm maybe that was sizeof vs length? i can't remember what either does honestly...gah 10 years without using a language is seriously detrimental...

mossy thunder
# coarse parrot That's the same as .Length

erm? i'm either super confused or i think you misread what i said since from what you said before .Length has one type of output and i was describing remembering c having 2 types of output.

coarse parrot
#

What could be the second type? Like counting member that isn't null?

mossy thunder
#

yeah

#

coulda sworn i already said as much.

coarse parrot
mossy thunder
#

hrm musta had a lib that i always used that had that functionality then...

coarse parrot
#

Could be that

mossy thunder
#

i remember using that functionality for a card game simulator i made. i could remove cards from teh deck by nulling them out and then the deck count just knew without any loops(at least not in my main code) how big the deck still was...

#

i'm guessing the library basically just used a loop to check all the slots though.

coarse parrot
#

Internally it is. It's just easier just calling one function.

scarlet lake
#

test 2, the last person that goes out of the box collider

#

get teleported

#

๐Ÿ˜ฉ

mossy thunder
#

what's the purpose of the teleporting? is it like moving on tot he next round?

scarlet lake
#

it's like returning to the lobby after the game

#

or he would be like alone there

mossy thunder
#

i'm confused then why it's bad that everyone gets teleported...

scarlet lake
#

no it's bad that who is still in

wind atlas
scarlet lake
#

doesn't get teleported

wind atlas
#

Maybe your count just start at 0?

scarlet lake
#

ye it start at 0

wind atlas
#

So you have to do count < 1

scarlet lake
#

mhm

#

let's tr

#

try

#

it didn't work

#

the last person is still in and the game didn't got

#

resetted either this time

wind atlas
mossy thunder
#

ok these variables and arrays are confusing me...so when you interact with an object it controls variable data in that script...then to access that variable data you peak at it from another script...which makes it seem SUPER complicated how i'm supposed to have a bunch of "join game" buttons around my table that store the player id of the person sitting at that spot on the table...

scarlet lake
#

how can I make him leave when the game end?

#

it's like the solution is close but maybe i'm just tired XD

scarlet lake
wind atlas
scarlet lake
#

maybe is because i'm trying it in testing so

#

I have 2 times my account as player?

mossy thunder
#

i guess that each join game button stores to a variable not an array, then the "start game" button peaks at all those scripts to build an array for it's own usage then all the other scripts peak at that button's script in turn?

wind atlas
wind atlas
scarlet lake
mossy thunder
scarlet lake
#

there is something wrong in that way of saving the players in the array?๐Ÿค”

wind atlas
# scarlet lake

That should work. Are you displaying the counter? If not, you could try doing that in the canvas, maybe you see the issue this way.

mossy thunder
#

well like the way i'd do it anywhere else there would be an array that just exists that i could put data into from anywhere else int he program. so to me it's very weird that i have to constantly be cross referencing scripts...

mossy thunder
wind atlas
#

Yeah, debug.log it.

scarlet lake
#

tried to use Debug.LogError("Messages")

#

but I can't see them on unity

wind atlas
mossy thunder
#

i usually prefer runtime debugging. instead of having a log somewhere instead my code is displaying all the debug info real time alongside what it's supposed to show. that way i can track every variable at every step to make sure things are changing and getting set the way i expect.

scarlet lake
#

how can I turn it on?

wind atlas
scarlet lake
#

it seem it was already on, time to test again then

wind atlas
#

Or make the canvas, I assume you want to have some kind of display for players anyway.

scarlet lake
#

guess so i'll make the canvas

trail palm
#

i guess its somewhat udon related. how can i make pickup objects 2 handed? i want that if you first pick it up, its one handed but then you can grab it again to make it 2 handed

wind atlas
#

It shouldn't be too awfully difficult though, just requires some rotation math.

mossy thunder
#

i imagine there's code to help figure it out int eh pool prefab.

trail palm
#

oh well, ill try but im a bit dumb

wind atlas
wind atlas
wind atlas
mossy thunder
#

it def does. though the way the pool tables work is a bit unique. once you are holding the que stick there's a glowing bit that you can grab and that's the second handhold. it then pivots around that handhold while the other hand controls distance and is where you derive that pivot from.

mossy thunder
#

ok i must be dumb...how do i store what player pressed the "join game" button?

wind atlas
mossy thunder
#

i guess? it's an interactive object like used for toggles and the like.

#

i hit space and searched for local and nothign came up.

#

oh found it hidden under networking. would be nice if the search could search inside submenus...

floral dove
#

it's slower, which is why we default to filtering by class first with space

mossy thunder
#

what's the datatype of LocalPlayer? i thought it'd be an int but trying to store that in an int didn't work.

floral dove
#

It's a "VRCPlayerApi" object

mossy thunder
#

i see...

floral dove
#

that object does have an int, I think it's playerId

#

here's more on that class: https://docs.vrchat.com/docs/players

mossy thunder
#

k so in the button's script i'll store that to a variable. then in the "start game" button i'll have an array that looks at all the buttons to get the players that pressed each and get them tied to the right part of the table?

#

and i'm guessing i'll wanna do a network event so all the data can be colated onto one user...

mossy thunder
#

just realized...this is just going to make it look like the local player is sitting at all of the active table spots...i need to grab it before sending the network event then figure out how to transmit the playerapi right?

thorn jewel
#

As stated it's being moved by its translate function (Transform. Translate (Vector3)). The object itself i tried as part of both the environment layer and interactive layer.

The collider is also very large on the object so it spends a good time intersecting erroneously before fully breaching the wall, due to the slow movement speed.

I'm thinking that translate might not account for physics, but I'm not sure what else to move it with by a set amount.

floral dove
# mossy thunder just realized...this is just going to make it look like the local player is sitt...

I'll translate your graph as best I can:

  1. When the local player "Interacts" with this UdonBehaviour, send a NetworkEvent to everyone currently in the world to run the event "ToggleTarget"
  2. Every player currently in the world will run "ToggleTarget" locally, which will set their 'PlayerAPI' variable to their own PlayerApi object.
  3. Then each player currently in the world will toggle the target GameObject's active state to the opposite of whatever it currently is.

If that's not what you want to do, could you explain what you would like to have happen?

wind atlas
wind atlas
thorn jewel
wind atlas
#

What specifically are you moving with Translate?

thorn jewel
# wind atlas What specifically are you moving with Translate?

Wheelchair. Was grabbing user input and applying it to "velocity" & "rotation" values, then on Late Update I would multiply those values by Delta Time to move & rotate the chair. Works great if you don't consider the whole clipping through geometry thing.

wind atlas
thorn jewel
#

I'm still new to some of this, so I'm worried this may be incorrect. (It does look similar to an example program though.)

floral dove
scarlet lake
#

someone can help me with this? I want the player to drop items if he is using some

#

but ofcourse they can be null

#

it goes on error on line 76 saying it is null

#

how can I avoid that error?

thorn jewel
# floral dove how does this compare to the example program that shows how to use a station in ...

I'd have to open up the example scene to be sure, but I looked back over the UdonProgramSources directory under Examples, and found a Station related program (I overlooked) which is nearly identical to depicted; the only difference is its using UseAttachedStation and I'm using UseStation and a station variable.

Though the docs don't really make it clear that station interaction is disabled with Udon Behaviors, which is why I am confused.

floral dove
wind atlas
#

Yeah, the example is what I used to see how to do it. I don't remember how the station exactly work of the top of my head.

thorn jewel
floral dove
#

You could have the interact change the value of a text field instead of writing a log. The main things is to ensure that the "Interact" event is running. How do you develop without a PC?

thorn jewel
#

I have a Mac.

#

The docs for VRC_Station make no mention of Udon Behavior requiring additional setup, so I was confused as to why the station was disabled with an Udon Behavior attached. But looking over the example, that seems to be by design.

floral dove
#

Ah, ok. You could use ClientSim to test in the Editor for faster iteration in the future: https://clientsim.docs.vrchat.com/ But to solve this particular issue, you can have the Interact do anything else which will be visible for you - like changing a text field, or toggling another object on/off.

thorn jewel
wind atlas
#

I have a question about VRCObjectSync. It doesn't seem to sync between players when I disable the object during Start.

#

What could the reason be for that? I could swear it didn't do it before.

floral dove
floral dove
thorn jewel
#

Thank you for pointing me to client sim though; had no idea that was a thing. Will definitely give that a go.

floral dove
wind atlas
scarlet lake
#

like the teleport one

#

write something a bit ugly but I don't have really other idea for making people drop things

#

and this one work

#

๐Ÿ˜ฉ

grand temple
scarlet lake
#

tried, it goes in exception if that hand is not holding anything

grand temple
#

then check it with utilities.isvalid

scarlet lake
#

even taking the object?

#

i'll look into it anyway

grand temple
#

yeah, only do anything with it if it's valid

#
        if (Utilities.IsValid(RightPickup))
        {
            RightPickup.Drop();
        }```
scarlet lake
#

wait a moment

#

oh god

#

it is the local player that make it fail?

#

in my case i mean ofcourse

#

since I was not using the local one

grand temple
#

well it's a function you call on the player

#

so yeah if the player is not valid that would break too

#

I don't know if getpickupinhand works on remote players but it at least shouldn't crash as long as the player is valid

scarlet lake
#

something like this then

grand temple
#

yep

scarlet lake
grand temple
#

I would not recommend using player.isvalid

#

use utilities.isvalid(player)

#

player.isvalid will only catch a very unique situation where the player used to be valid but has now left the instance. if the player was simply never valid, like if it was straight up null, then player.isvalid will crash the behaviour

scarlet lake
#

oh didn't know that

#

i'll change it then

thorn jewel
floral dove
thorn jewel
#

Woops.

#

Too late. ๐Ÿ˜…

floral dove
#

Haha no problem. There's just a new migration method in the new version, but it's even simpler so shouldn't be a big deal.

thorn jewel
#

I winged it and treated it like the Avatar SDK during the betas:

  • Put under source control
  • Make a GIT commit
  • Fire Sale: All SDKs must go
  • Import the new SDKs and hope Unity doesn't crash
  • Crash? Revert to commit.
floral dove
thorn jewel
#

It's big brain, it's messy, but I know nothing will be lost.

floral dove
#

if you're doing a git commit first, then you can use the in-place migration rather than having an extra copy. We warn against doing that for people who don't have backups

thorn jewel
#

In-place migration? If you mean importing the new SDK over the old SDK, that's exactly why I use GIT now.

#

It might be Mac related, but there's a 50/50 shot migration goes south for the winter.

#

Causing a bunch of errors related to math, causing the SDK control panel to break, etc.

#

That's why I started deleting the old SDK first.

#

And then Unity crashed and removed all SDK related properties from my project.

#

So now I use GIT to ensure that isn't permanent.

floral dove
thorn jewel
#

OOOoh I get you.

#

Is the creator companion out? I'm sorry if I'm out of the loop on things. I just look at the docs, which tend to fall behind.

floral dove
#

It's currently in an Open Beta

thorn jewel
#

I may hold off trying it for now. Unity did not like the package form of the SDK base.

#

(Complaints about lack of various types in System namespaces, such as "immutable")
Restarting it seems to be doing something.

scarlet lake
#

after i drop a object with VRCPickup.Drop

#

there is a way to respawn it?

#

i mean how can I take the VRCSyncObject for respawning it?

floral dove
floral dove
thorn jewel
#

It looks to be doing something now though.

#

I think it just had cached parts of the old SDK that hadn't yet refreshed.

#

It gave me some new prompts on relaunch.

#

Though my console is still filled with errors.

scarlet lake
floral dove
# thorn jewel I did the proper GIT URLs

Ok - I'd still recommend using the CreatorCompanion instead since that will actually remove the existing SDKs and add the new ones. But like I said, new version coming soon that switches from git to embedded packages so best to wait a few hours to a day at least.

thorn jewel
floral dove
floral dove
thorn jewel
#

Oh so it is. Don't recall seeing that last I looked.

#

Thanks.

scarlet lake
#

now that I think about it, the object is thowable so, doing a box collider for the player

#

feels useless

thorn jewel
#

I use Mac

floral dove
thorn jewel
#

I think I'll stick to the unitypackage version of the SDK for now and forgo the client sim.

#

I don't mind having to publish and test.

#

Beats headaches caused by upgrading SDKs.

floral dove
#

Alrighty, I understand. Good luck with your project!

thorn jewel
#

(I had 400+ errors with the GIT packages)

scarlet lake
#

if I do a box collider, there is a way to write if the object goes outside of the box collider, respawn

#

?

topaz jetty
#

create a backup of your project and then remove all unity package sdk folders and then add the git urls

#

or just use the migrate button in the creator companion which does it for you

topaz jetty
#

did you try to migrate in the creator companion too?

thorn jewel
#

We just established that the creator companion isn't readily available for Mac.

#

There's a CLI version, but that's a bit of a headache to go through the trouble for just to test my world in unity.

topaz jetty
#

ooh yeah sorry didn't see it

#

I mean cli shouldn't be that hard right? You only have to add and then migrate

#

would probably just be like 2 commands

#

though I haven't used it yet

thorn jewel
#

I'd have to install the .NET 6 SDK, and I've already spent a considerable amount of time already futzing with this. I also have limited drive space, and a lot of SDKs like .NET insist on being on the system drive as opposed to external.

topaz jetty
#

ah ok understandable

thorn jewel
#

So I'd rather just wait for now, maybe try it down the road.

topaz jetty
valid oar
# scarlet lake if I do a box collider, there is a way to write *if the object goes outside of t...

Yeah, OnTriggerExit, teleport to the location of the spawn object. https://www.youtube.com/watch?v=BheVIHD3Vrg

My old video for teleporting players in Udon is crap and outdated, so here we are with a brand new demo on teleporting players in VRChat.
I've had some technical problems with my avatar program, but I've swapped to VSeeFace for now and am using my new avatar.
Hope everyone enjoys!

----------------------------------------------------------------...

โ–ถ Play video
thorn jewel
# topaz jetty that happens when you have both the unity package and the git installed

BTW there were errors when I messed up the first time and this happened, but not 400+ of them, and they were conflicting namespace errors.

When I deleted the old SDK first and then installed the GIT versions (after a git restore), it was complaining about basic classes and namespaces not being found in system classes.

I'm thinking the package versions might not be fully tested on Mac? Either that or something about my project structure and Unity's weird caching is causing me yet another issue.

scarlet lake
#

?

topaz jetty
#

did you install the base package aswell? The git packages are split into base, world and avatar and for worlds you need base and worlds and for avatars you need base and avatars

floral dove
# topaz jetty just curious, why isn't the normal creator companion not for mac/linux? Isn't it...
  1. The CreatorCompanion does a number of Windows-specific things like finding Unity Windows and bringing them to the foreground, etc.
  2. Windows is currently the preferred development platform for VRChat and the only platform that receives full support. We'll do our best not to break our SDK for Mac and Linux users, but we're concentrating our efforts on the vast majority of our creators who are using Windows.
valid oar
# scarlet lake that work for objects too? not just players'

Sorry for the trigger, OnTriggerExit should work, this video is what you need for object respawn https://www.youtube.com/watch?v=p6vtL_BRMEo

Here's a simple button script that respawns a sync object in the world. Use this to get back an object that someone has run off with or lost! This doesn't work for objects that don't have an object sync component on them, but if it does, it's super easy!

Hopefully this helps, and if you have an questions feel free to leave a comment! ^^

โ–ถ Play video
floral dove
topaz jetty
#

if it's just that shouldn't it just be a few if statements to add mac & linux support? I understand that vrc only supports windows though but some people only own a quest & a mac I guess

thorn jewel
scarlet lake
#

i'm a bit confused about OnTriggerExit

#

there isn't any override of that one

topaz jetty
scarlet lake
#

it should be something like this?

valid oar
#

Maybe? It should just be like the video has it but OnTriggerExit instead of Interact but I haven't done that sort of thing myself.

scarlet lake
#

well just tried it

#

and it work

#

so it was that one

simple heron
scarlet lake
#

udonscript is failing to compile somewhere?

simple heron
#

i dont know

#

i get 1 red thingy

#

from my chess board

valid oar
#

You might want to try removing that and see if you have any issues, at least it would narrow it down.

simple heron
#

ok its def my chessboard

#

literally says

#

failed to compile after that error

#

now i have no chess

#

:C

valid oar
# simple heron now i have no chess

I'm not familiar with that particular asset, but making sure Udon Sharp is installed would be the first thing and then just consult the documentation if there is any.

simple heron
#

Ok

white fractal
#

how do u split a vector into 3 floats

#

like UE BP lets u split a vector 3 to have 3 seprate pins for each value in a vector 3

#

how do u do that in udon

grand temple
#

vector3 get x

#

vector3 get y

#

vector3 get z

white fractal
#

whats the setter called for it

grand temple
#

vector3 set x

white fractal
#

is it set

mossy thunder
simple heron
#

vrc pedestal isnโ€™t click able

floral dove
simple heron
#

momo help :<

floral dove
simple heron
#

Im trying the prefab one

mossy thunder
floral dove
simple heron
#

no im uploading my world

#

I just cant click it

mossy thunder
#

i imagine if i could even figure out how to transmit the id in the object then i could then look it up in the array function i create later.

floral dove
simple heron
#

In my world the pedestal isnโ€™t intractable

mossy thunder
simple heron
#

:0

#

Wait the udon scene one works

#

Why doesnโ€™t the prefab one?

floral dove
# mossy thunder ...momo it's much appreciated that you are helping, however you are misunderstan...

your options for networking are Events or Synced Variables. Maybe this information will help: https://docs.vrchat.com/docs/udon-networking

floral dove
simple heron
#

Im an idiot but iโ€™ll try

#

โ€ฆ

#

Everything seems the exact same

mossy thunder
#

... ok i'm so friggen dumb... i read that last night and couldn't figure out how to sync varaibles but you don't ever transmit it you just check synced...no idea how i overlooked that...must have been WAY to tired.

#

ok now the issue i've realized is if i'm going to be syncing an int instead...i need to find the graph entity that lets me grab that data out of the PlayerAPI entity.

#

basically the equive of varID = PlayerApi.ID i'm guessing.

#

hrm do they not have ids?

#

oh duh they probably do but not as a data piece but as their index in the array...so...i'm going to need to itterate through the array?

rocky lantern
#

is there a way to get the direction a player is looking?

mossy thunder
floral dove
mossy thunder
#

... and i just found get player ID... JFC..i swear i did a space, playerapi, id and nothing came up...

floral dove
#

Yeah, it can be helpful to just lay down the object first so you can see its fields and their types

mossy thunder
#

oh wait... is what i found...is that not right? cause i didn't find a dedicated VRCPlayerApi object.

floral dove
#

That's correct, you'll need to feed a VRCPlayerApi instance into it to get the player id out

mossy thunder
#

having this before the network event will do that though, no?

#

ok. so i have the join/leave button configured to store the user that clicks it. i'll need to also set it to have a way to null it out if the player leaves. then i need to create a similar button for taking hosting privileges, then i can use the host buttons to agregate all this data into something useable in the game...

mossy thunder
#

ok something i'm confused about for the toggles it looks like using one script for the whole group works fine but it looks like when you go to peek at variables inside a script you can only do it from the overall script not from a specific instance of it...so should i be having a different script for every button in my script?

thorn jewel
wind atlas
thorn jewel
thorn jewel
thorn jewel
thorn jewel
#

Is there a way to trigger the VRC input window and in-game client's on screen keyboard (on Quest, particularly). I've seen some video players do this, but the built in example does not. I didn't change anything about the input window, functionally, yet click and nothing happens. It registers the selection, visually, but no input window appears.

I've seen worlds trigger the input window on video players, so surely I'm doing something wrong?

mossy thunder
#

can someone verify if each button should have it's own script file instead of just using the same script file when i want to be able to use the variables for each button separately? I'd rather fix that before i get too deep in this.

dawn forge
mossy thunder
#

i'm not sure how i'd derive this with my graphs as they are set now. right now i just have the graph dragged onto 10 buttons and it does it's toggle stuff just fine but that's because i set the target toggle in the button's inspector not anywhere in the script...

dawn forge
#

I'm on the go but i reference my master script and call _ApplyDigit(int n) or if isReset, _OnReset(). And it goes on from there. My 1-9 and reset/enter is the same script behavior, just each button object has a instance of the script

mossy thunder
#

i'm guessing if i am having the script get variables (like who pressed which button) then this instanced aproach might get trickier than just having separate script files?

#

my final usecase is that there will be 10 buttons to join the game, each of the up to 10 players will click a different join button and then the button will disapear from everyone preventing anyone else form joining the same number (until the player who already has it clicks the leave button or the host will probably have a force clear option for if someone d/cs) then i need to have an array of which players hit which join button so the right info shows to the spys vs the resistance.

dawn forge
#

Ok so a single script can achieve this. On interact, grab the vrc player's display name and store it in a variable so that button remembers the player.

Then you can .setactive the button behavior to false to hide it.

#

Oh and vrc object pool will help a lot since you're wanting to manage these buttons as a collection

mossy thunder
#
  1. wouldn't player id be better than display name? 2) won't the second button pressed overwrite the stored value in the variable?
dawn forge
#

Player ID is fine, either or display names have to be unique.

#

And no. When you have a button hold an iantance of a script, it only affects itself. They don't share a same instance at all.

mossy thunder
#

one question this gives me, is player id comperable with the index of the player in the world's players array?

mossy thunder
dawn forge
#

Worlds player arrays? You have to build that yourself. You ultimately rely on the vrcplayerapi https://docs.vrchat.com/docs/getting-players

mossy thunder
#

ahh i assumed somewhere the world was keeping an array with all the logged in players and their 3d location indexed most likely by order of join. and that you could then refference this array(actually assumed that's what vrcplayerapi was doing.

dawn forge
dawn forge
#

This. Sorry I can't express it in graph but I am using an object pool to hold objects that runs my player scripts that holds data about the player. Typically a copied object of vrcplayerapi.

#

You can do the same for a button, but you'd do it for interact and pull Networking.localowner vrcplayerapi object to your button.

I'm mobile right now so my example is approxinate. For your button graph, create a vrcplayerapi variable and player name. You can't sync vrcplayerapi object itself, so we will depend on the player name to be your key index.

On the button graph, on interact, take ownership of the object, set the vrcplayerapi with networking.localplayer and set your playername with .displayname from your vrcplayerapi object.

Now your button will remember the person who interacted with it, and you'll need to sync playername so others will see this reflection.

Now you're ready to call each button and enumerate its values.

winter gazelle
#

I'm having an issue with Raycasting

#

I have my origin and direction determined by the head rotation of the player

#

but when using the debug draw rays I cant see them

#

i set the color and opacity

wicked forum
#

What's the state of struct support in U#? It seems to have let me create one but I can't do anything with it

indigo finch
#

You can't play videos in the inspector. you'll need to 'build and test' to test this

#

what error messages is it giving in game? (Rshift + ` + 3)

scarlet lake
#

there is a way to change TextMeshPro Text in code? since I can't find TextMeshPro reference

#

nvm solved

shy osprey
#

how do I set a public UdonBehavior variable to another script? i cant drag anything into it unlike other public variables

scarlet lake
#

I did it like that

#

for putting another script inside another one

shy osprey
#

do you know if theres a way to do that in the graph?

scarlet lake
#

I'm sorry I don't know, I'm quite new so I didn't used a graph yet

shy osprey
#

ah alright, thanks for the help anyways!

indigo finch
#

yea, it should bring up a debug console. make sure you are using the Right Shift + BackTick + 3, and not any other keys

arctic scarab
#

how i detect analog button pressss

mossy thunder
#

is there a way to open multiple graphs?

dawn forge
dawn forge
arctic scarab
#

of course not

mossy thunder
winter gazelle
#

I need a way to take a Euler rotation value and turn it into Direction value

grand temple
winter gazelle
#

so take the quaternion x, y, and z values and multiply each of them then construct a vector 3 to get the directions for all 3 in one vector?

#

or just multiply the WHOLE quatenion with a Vector3.forward

grand temple
#

the whole thing

#

never split apart a quaternion into it's individual xyzw, it's going to be nonsense

winter gazelle
#

oki

#

Thank you

winter gazelle
#

I think my VRCPlayerAPI isnt working

#

Cause I have a Start event that checks a bool thats updated based on the IsinVR node

#

then it gives a message in the Debug log

#

i got no message

#

works in unity but not in game

grand temple
# winter gazelle

Udon breaks when you have multiple execution lines flowing into one node like this

winter gazelle
#

I'll remove that but I added that after i noticed my stuff not showing up in the ingame debug

#

This debug is supposed to give me my head position, rotation on keypress of Keypad 0

#

along with another message sayingit was pressed

#

this does not show up ingame

#

nor does my debug ray draw

dawn forge
#

Setprogramvariable

shy osprey
#

do i put that in the script thats calling the behavior or the behavior itself?

grand temple
grand temple
winter gazelle
#

nope

winter gazelle
scarlet lake
#

I do not know why but this does not work I wanted the player to teleport when I click door.

winter gazelle
#

VRCPlayerAPI.TeleportTo is what youre looking for

scarlet lake
#

Ah I see. Thanks!

shy osprey
#

getting this error when trying to get an object from an array, the array has 9 objects and im trying to call object 0

dawn forge
#

You're calling an index that is not defined, is the element defined in the array?

That or you're calling an index outside of 0-8

winter gazelle
#

None of my dbug logs are showing up in the ingame logs

#

so i cant tell whats broken

#

it works in unity

#

not ingame

shy osprey
winter gazelle
#

@grand temple I got the exception from the log this time

dawn forge
# winter gazelle

Looks like it's trying to get the game object of a collider, and is failing to do so. Is collidervariable setup with a value or instantiated?

winter gazelle
#

I ended up removing that whole gameobject stuff

#

Now it takes the collider and gets the coponent i need

#

So when the ray fails to get a collider its empty

#

And when it find one without the coponent it doesnt do anything

grand temple
# winter gazelle

You need to check if the collider is valid before trying to do something with it

winter gazelle
#

did that earlier after being suggested

#

thank you so much for the help

vapid badger
#

Hello, if I'm using UdonSharp instead of the graph, are my questions suited for this channel or should I go to #world-development ?

valid oar
#

You're good, all Udon is allowed here.

vapid badger
#

Thank you. I have sliders that I can adjust in-world to change parameters of game object components... When I tested it a few weeks ago, a guest was also able to use the sliders, but they only affected his perspective locally. Is there a way to have sliders that only I can control? (I guess "I" would be the Game Master, ie. the person who first made the instance, or the next in-line after that one leaves - if my understanding is correct)

#

ie. I'd want it so guests can't even change the parameters locally.

indigo finch
vapid badger
#

@indigo finch Yes, is that possible?

indigo finch
# vapid badger <@228024927054331904> Yes, is that possible?

certainly. you would need to make a synced float variable, then whenever your slider value changes, make it update this sync variable. A synced variable can only be changed by the owner of the object, which will default to the instance owner. Then you just need to make it so that when that float variable changes, it updates the value for the slider, which can be easily done with a property.
Also, add a little bit of logic so that when the slider changes, but the person isn't the owner, it corrects itself to the synced float value

vapid badger
#

@indigo finch Thank you! Is this the correct syntax for a "synced float variable"?

[UdonSynced] public float poo;

indigo finch
vapid badger
#

right

#

@indigo finch What's the c# syntax for checking if someone's the owner?

indigo finch
vapid badger
#

@indigo finch I'll try that out, thank you. So I'd put the slider's gameObject as the argument.

indigo finch
#

Might be kinda basic, but I'm a little lost as to what you mean

vapid badger
#

Oh, you sounded like you knew what you were doing til now! ๐Ÿ˜„

indigo finch
#

I know what I'm doing, just not how it's normally said ๐Ÿ˜…

vapid badger
#

@indigo finch for the (gameObject), you'd put the slider in those parantheses, is what I meant.

indigo finch
vapid badger
#

ohhh, I see. Got it!

indigo finch
# vapid badger ohhh, I see. Got it!

btw, slight correction to what I said before, but you only need Networking.IsOwner(gameObject) instead of Networking.LocalPlayer.IsOwner(gameObject)

vapid badger
#

oh, I can move that first line outside of the foreach loop

indigo finch
#

also made it for graph XD

vapid badger
#

ah, so FieldChangeCallback is an Udon-specific property?

#

and wow, you're going all out. xD

#

oh, my bad. the property's at the bottom

indigo finch
vapid badger
#

actually, maybe there already is one? You answered me before I watched it ^^; https://www.youtube.com/watch?v=ecu9oaUxClI&ab_channel=VRChat

Learn how to use Udon to make a slider that shows its value and syncs to everyone else in the world.

0:00 Building a Slider
2:54 Adding a Text Field to the Slider
5:04 Showing Slider Value in Text Field Using Udon
9:52 Syncing the Slider Value over the Network
13:42 Restricting Variable Updates to Owner
14:46 Switching to Manual Sync
16:26 Rest...

โ–ถ Play video
#

though he shows how to do it with the graph, not c#/u#

indigo finch
vapid badger
#

@indigo finch What happens if I leave out the line "mySlider.value = sliderValue"?

Wouldn't it be fine, since the SliderValue property is set from mySlider.value to begin with, and only when the owner is accessing it?

#

and what does the FieldChangeCallback do here? It sounds like it'd be an auto-generated property.

indigo finch
vapid badger
#

ahh, I see!

indigo finch
#

if you look it up, would love to hear what you find ^^

vapid badger
#

there's no obvious definition page when you Google "udon FieldChangeCallback"

dawn forge
#

When do you think we will see support for lambda expressions and predicates? I use those a ton at my work and I feel like doing my enumerations to search my arrays is pretty punishing to the game.

Disappointingly, Array.Exists, .Contains is not exposed.

vapid badger
#

@dawn forge Ah, thank you! So it looks like it shouldn't be a necessary attribute if you never try to set the field directly, right?

#

@indigo finch And your code worked, thank you!

dawn forge
scarlet lake
#

there is a command line that tells me if the localplayer

#

is on quest or pc?