#udon-general
59 messages ยท Page 96 of 1
Are people really laging the game by converting to vector3 then back?
I've swaped it out but I still don't understand why I can only convert to quaternian and not from.
toeulerangles on a regular quaternion is definitely exposed, what are you trying to do? that doesn't look like a regular quaternion
I feel like you're just getting syntax wrong or something. what's the larger context?
that's not how quaternions work, you can't just subtract them
you should multiply with the inverse instead
points[0].rotation * Quaternion.Inverse(MovingObj.rotation)
Im trying to get the change in positions tho
so I was subtracting the x,y,z,w values.
yes, but that's not a valid quaternion
DeltaX = NewX-OldX
how, its passing in 4 floats
Swaped it over to a quaternion and its working now anyways,
x= change in x, y = change in y, z = change in z.
because quaternions are not a simple vector. For one, they require adding up all 4 values to equal 1. you increase one, it decreases the others. if you just jam in whatever random values, it's not going to give you anything remotely that you want
thats why I needed that vector3 convert that errored then,
I don't see how multiplying by the inverce gives you a vector of the change.
where with a vector you would do a - b to get the difference, with quaternions you do a * inverse(b). it's effectively the same thing but for quaternions
at least position was simple.
quaternions are not simple ๐
yes, you need to know how to play by their rules. they are not just a vector
Its not giving me the exposed function error anymore
But my fixed update needs fixing.
This should work, fingers crossed
welp that didn't
I can work arround that
eluer is 3 floats not a vector3
bruh
Right, time to see if I can work arround it.
@grand temple are you 100% sure its exposed to udon#?
Becase this is giving me the error that it isn't exposed,
yes, I use it all the time
idk, maybe update your sdk and udonsharp? doesn't seem like an old version issue because it's always been exposed, but maybe your version is messed up
oh that must be an old deprecated thing
Bruh I'm dumb AF https://docs.unity3d.com/ScriptReference/Vector3.Lerp.html
WAY cleaner
you can also do MovingObj.eulerAngles = so you don't have to convert back to quaternion
or you can do Quaternion.Slerp to avoid the vector-based rotation altogether
nope
That Quaternion.Slerp seems smart tho.
ah, ok.
IG transform just has its own definition for that then.
cus that worked.
it's because quaternion.eulerangles is only an output, while transform.euleranges is both output and input
welp, turns out that rotation vector was useless anyways as thats not how my refrence material does it apprently.
bruhs really coded it to look at the next node.
You know what, nah, Im adding rotations to those points lol.
lets me do things like make a goomba front flip.
I have 0 Idea how this is making an OOB error
I am litraly modulusing it by its lenth, it should never go negative
bruh, C# messed up modulus.
That should be remander 1 for all of them, anoying.
horray for google
int mod(int x, int m) {
return (x%m + m)%m;
}```
how to work with synced variables
Hey all, is Unity's standard assets loaded into VRChat? I'm making an Udon script using NavMesh to control an AI in the world but I want to animate it.
^ if not, i might try convert the script into U#
My editor still isn't giving me typings for some things. I imported VRC.SDKBase and Utilities and Networking are showing that they're invalid references. This started to happen after moving to VCC
how i repeat function every second
SendCustomEventDelayedSeconds(eventName, timeout)
sounds very vrchat specific
I'm trying to make a pickup which has a trigger collider on it which triggers an event when a player enters the trigger collider, but I'm not having any luck.
The pickup is on the pickup layer, and has the pickup and object sync components, a rigidbody, and a mesh collider.
I have a box collider set to trigger which I want to be the thing that triggers the event.
I thought perhaps having this on the Pickup layer was the issue, so I created a child object, set that to the Default layer, and put the script on it instead, but when I create a remote player in the emulator and touch the object to them no collision is detected.
I can't set the main object to the Default layer because if a player picks it up, it then collides with their body and messes with their movement.
I'm not sure if the child object needs its own rigidbody for the trigger to work, but I'm trying to read its velocity, so I added one to it. I have not added an Object Sync component to it because the parent already has one and presumably the children will follow it remotely.
void Start()
{
SendCustomEventDelayedSeconds("test", 1);
}
void test()
{
Debug.Log("e");
}```
seem to not work is anything wrong
Start not start
you can also use nameof(test) instead of "test" so that it will highlight the error if you change the name
Use something like rider or resharper, it should tell you the namespace needed for that class
so what else wrong here
the spacing
Can I get a link? Also, the scripts compile okay, just my editor freaking out
Ah, in that case just close and open vsc
Are you on Linux?
Windows
I think I'd rather stick with my vscode for everything, but I can give it a try I suppose
Trust me, I thought that too
Then I switched to vs
then I switched to rider (it's paid but I have an open source license) and can never go back
i seem always have this error
@granite grove lmao
I really think it has to do with the VRC Creator Companion install
Possibly
yeah it builds fine in U#
Weird
Yeah I'll still need some help with this
I've just figured out why my trigger volume wasn't detecting collisions with the remote player I spawned in the emulator....
For some reason, in the ClientSim beta, when you spawn a remote player, instead of having the usual capsule collider, they have a small sphere collider down at their feet.
how to make a toggle for a object that change the material
the method test needs to be public, not sure about the error you're getting though
Is it just me or is local test very bugged with throwing you in seperate instances
Like it sometimes takes me 10 attempts to get 2 clients in the same instance
Do remote players in ClientSim execute their scripts? I'm trying to get a remote player to play a sound and fling themselves when they detect a trigger collider held by another player touching them, but nothing happens. Or rather, I get debug messages telling me what the local player is executing, but I get no debug messages for the remote player, and if I change the code slightly so the local player can hit themselves, the code seems to be working. The sounds play at least.
"remote" is a little weird in client sim because it's all in editor. Another editor isn't spawned so the only way to test remote players executing their own logic is to actually test in client
is it okay to hide an object with udon scripts in it on only one platform of a cross compatible world? or will that still result in ofsetting all of the udon things
ex: hiding the video player instead of deleting it on the quest version
happened to me too, in unity go to edit > preferences > external tools, then under "generate .csproj files for:" check "git packages" and then click regenerate project files
then restart visual studio
that fixed it for me
I don't have a "generate .csproj files" field anywhere
Is it required to have one of the version control things installed?
I don't
Oh. I still had it set to vscode not vs
Hello everyone, i'm new here. Like, super new to creating a world. I've downloaded Unity, done all the steps, but I can't access the vrc world prefab page on the documents, it gives me a 404 error. Any ideas?
are you looking for this?
Ah.
Thank you, yes, that's exactly what i was looking for!
@topaz jetty That ended up working. Thank you very much
Does anyone know how I'm supposed to build and test with multiple clients? I have an Index. I said I want two clients and clicked the button, but two windows hung. I shut down SteamVR and it reloaded it and launched the game, but there's only one client, and I can't move with the sticks.
check "force non-vr" so it doesn't launch steamvr with it
Hmm, yea, that works, though I was really hoping to be able to test offline in VR with multiple clients. But at least the remote players now execute their scripts so I can test that.
I don't think you can test offline with multiple clients in VR, but if you have friends or multiple headsets you can upload your world privately and test it there
How do i instantiate a global object?
like
have it instantiate for all clients
I have a button that is supposed to spawn a flashlight GameObject when you interact with it, but it only spawns for that 1 client
Trying to make a HQ/LQ Mirror toggle and i'm getting this when i make an Udon Behaviour. How do i fix this? Thanks!
is there any way of instantiating object and making it synced for everyone
^^^
You need to create a pool of flashlights and the take out one instead of instantiating them.
im supposed to create 100 bullet objects to ensure they will stay synced?
cant i just spawn them in some way?
Pooling is the name of the technique people use so they don't have to instantiate a lot of objects. The same applies to bullets, if you have that many, it's usually more efficient to pre-create them and reuse instead of constantly doing something costly like an instantiate.
I think there is a VRCObjectPool component in the SDK you could use.
You know how some worlds have movies and shows, how do you make one?
is this global?
The VRCObjectPool component is. It will enable/disable objects the same for every client.
And since you upload the networked objects inside the pool with the scene, everyone can see the same ones.
is there a way to add subtitles for sdk 3.0 ?
Not automatically. You can use a canvas, set it to world space and put it infront of people's faces.
That depends on what type of effect you want. The concept is more or less the same though, yes.
Canvas can display text and image too, if that's what you want.
I see, thanks
Does anyone know if it's possible to Sync an animation?
For example, I have a world that playes a big animation, with sounds, but if you lag in vrchat thanks to someone switching avatars, the animation gets desynced, and Lags behind the sound(Depending on how much you lagged).
So my question is, is there a way to force the Animation back to where it should be with the sound, so that it doesn't desync?
how do I download an avatar onto vrchat? I'm trying to figure it out and I've been sitting here for an hour
This video assumes you know the basics of how to build an action controller and audio sources.
A good prerequisite would be: https://www.youtube.com/watch?v=whv3WOKeBsc
something like this?
You could have the animator control the audio source
oh neat, thank you!
np
Oh, sadly no, that is for Avatars, and the process there wont translate to worlds. :c
My hope, is there is a way to force an animation to skip forward to the correct time, in the timeline, to keep in sync with the audio.
if you have the animator control the audio will it not be automatically synced?
all the animator would do, is turn ON the sound, not regulate it. to my knowledge at least.
that video was showing you how to toggle the sound on, and off. not skipping the sound to match with the animation/animator.
O
many videos show things like that, but i can't find anyone who takes it a step further, and manages the audio/animation sync. :c
interesting
Anyone know how to resolve this problem? Migrated and all udon sharp programs show this now
for ik followers, will I need to loop setting object transform through scripting or can I use something else
did u create a C# script of a UdonSharp script?
Ive always used create U# Script. Even does it with new ones.
Just spits out Compile validation failed, check console output for details.
I am debating whether my unity install is corrupted, the project itself is broken, or its just an issue with udonsharp when it comes to 0.23 udon sharp scripts being ran on 1.0.1
Ill give a new project a whack and see if the same or something else happens
weird. If the .cs file has a U# counterpart then idk why it would do that
tried with a new project with no issues soo far. it just seems it doesnt like legacy projects
damn
Been through 5.6.3p1 til now. guess it was to bust eventually
have you tried selecting the U# file and recompiling?
and does it have the correct source script?
yes with nothing happening
plus i rather just go ahead and start a new project and slowly import everything to see what causes it to bust
yea ig
probably will do it tomorrow since ive been at this for 12 hours haha
fs, good luck bro
Hi, I bought a ship that I really like and trying to modify it into my home world.
After fixing the collider toggle. I found out the collider will spin me around when I touch them.
This is a recording of what happened.
Searched around and didn't find similar mention of this problem. Does anyone know what causes this?
probably has a rigidbody, don't do that
Thanks, let me check
Fixed, thank you very much.
Do you want to sync both, animation to animation between players and animation to audio locally?
Animation to animation can be synced by sending the start time in a manually synced object and then fast forward the animation according to that. If you use an animator, you'd use animator.Play, it takes a value from 0 to 1 to jump forward in the animation.
Animation to audio I'm not 100% sure, but you if you use Timeline, I think you have to select DSP clock. This way lag won't have an effect for the animation.
is there way to sync instantiated object
Quick question, trying to convert my graph script to a udon# script; but how would I get the gameObject from the last object the pool spawned?
No, there is not.
The method returns a value, so you just have to do:
Gameobject spawnedGO = pool.TryToSpawn();
Make a reference for an AudioSource, then call "Play" on it.
ah, thanks ^^
codeee?
myAudioSource.Play()
is there way to play randomly one of many audios
or i have to generate random number and pick audio based on that
Yeah, you can use Random.Range to get a random value and then just use that as an index for an array of AudioClips.
So: myAudioClipArray[Random.Range(0, myAudioClipArray.Length)]
Then assign the clip to your audio source before you play it:
myAudioSource.clip = myNewClip;
okay i dont know how path to this should look like
What do you mean by "path"?
i need to specify audio path to make script play it isnt it
Again, what do you mean by path? You usually just make an AudioClip reference in your script.
nono i mostly use find
Find is to find stuff in the hierarchy. AudioClips can't be found there. You have to drag and drop them into your script in the inspector.
At least in Udon it's not possible to read assets directly from your folders. (afaik at least)
ok then how i reference
Do you use udonsharp?
yes
Just create a field variable.
how
Have you never created field variables before?
Like:
public int MyValue;
๐ฏ FREE Courses (100+ hours) - https://calcur.tech/all-in-ones
๐ Python Course - https://calcur.tech/python-courses
โ Data Structures & Algorithms - https://calcur.tech/dsa-youtube
โ๏ธ Newsletter - https://calcur.tech/newsletter
๐ธ Instagram - https://www.instagram.com/CalebCurry
๐ฆ Twitter - https://twitte...
Just do this but with AudioClip[]
public AudioClip bounce1;
void OnCollisionEnter(Collision collision)
{
bounce1.Play();
}```
whats wrong
AudioClip != AudioSource
It tells you that the object you are using has no reference to any instance.
So you are trying to call Play on a missing object => you don't have any audio source.
Go to the inspector and assign one to use.
i placed it it reset itself
actually i cant even put it in now
probably because its audio source now
why cant i insert it
mp3
Again, AudioSource != AudioClip
so i wanted play audio source directly
AudioSource is like your head phones and the clip is the actual audio you want to play. Try creating an audio source in the scene and you will see it has a clip that you can assign to it.
Learn how to add sound to your game!
โ Download Audio Manager: http://brackeys.com/wp-content/FilesForDownload/AudioManager.zip
โ Audio Import Settings: https://docs.unity3d.com/Manual/class-AudioClip.html
โฅ Support my videos on Patreon: http://patreon.com/brackeys/
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท...
You can assign clips in the code too. Look at the code I wrote before:
im having pain with ;
void OnCollisionEnter(Collision collision)
{
c = Random.Range(1, 2);
if (c == 1)
{
a.Clip = bounce1;
}
if (c == 2)
{
a.Clip = bounce2;
}
a.Play();
}```
how i fix
Use Visual Studio or something and set it up so it shows you intellisense.
Set it up so it does.
If you do, it will underline "Clip" with red. And it you type in "a" and then a dot, it will show you all possible things you can use.
It will show you "clip" is the right spelling.
hate unity
how i make sound from object direction
currently it plays like global
i turned mono to stereo just in case
can i change position of held object
Eyop, i'm having an interesting issue with the videoplayer at the moment.
Sometimes everything work fine and I have nothing to say, sometimes people come to me with a veryw very specific issue
As is:
2022.05.23 21:14:57 Error - [Video Playback] ERROR: [generic] Unable to download webpage: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)> (caused by URLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))
I understand that this is apparently an ssl error which is not surprising me since I use zerossl for it, but the way to fix it is very dumb and I honestly don't get it
If I have the person having the issue visit the website on a web browser, it simply suddently start working
I'm unsure if it's an issue with youtube-dl, avpro or my setup at this point tbh, or even windows cache system
well, w/e, I just ended up re-doing my entire ssl setup and it's fine now
was on my end ๐๏ธ
Shot in the dark, letsencrypt?
I forgot to merge the CA and the certificate together for nginx so it was missing parts of the chain
5am drunk SSL mistakes
yep
was just about to say it sounded like a CA cert chain issue
I just did an overhaul of the ssl setup at work and ran into SO much of this kinda thing on systems other coworkers setup
mixture of our proper ssl, out of date letsencrypt setups...
out of date cert root stores
can i change object shader with code
What are the Axis names for movement and looking? I can't use the Input Events since I need something to happen every frame, but have little idea on how to get the values without the Input Events. I know there's a GetAxis method, but requires a string.
Well, I figured out the movement Axis ("Vertical" for forwards and backwards, "Horizontal" for side to side) but I still haven't figured out the names of the right stick.
Figured out a workaround. Just have the Input Events write to a float, then use that float for the other things.
do ik followers in worlds require event loop scripting
You can swap the material, which could have a different shader on it
actually i wanted just to change material
Anything that can help me learn udon
udon# is nasty for beginners, with heaps of things that are unintuitive (Literally took me a year to learn how to do the equivalent of the 'on variable change' event node), but in return you get a more powerful and faster coding structure to use.
I would recommend learning udon graph, and then learning how to do the equivalent in udon#. Then you at least know what you should be able to do, and are able to ask questions about converting that are less convoluted and much easier to answer
How would y'all going about making a hand menu for your world? I have seen instances of this where when you hold your hand palm up it blinks in, and I have found a package that lets you attach things to various player bones... but I still really don't know how to go about it.
I found this unity tutorial, about making worldspace VR menus, and I have messed around with some of the followPlayer scripts.... here.
Is it possible to change player's scale in udon? I was looking through the Player API and it doesn't seem to be a thing, but I wanted to double check
Random.Range does not include the max value
so you wanna do Random.Range(1, 3);
also, make sure c is defined as an int
Second this, also looking to temporarily force or require a specific avatar in order to participate in a "session" of the game I am wanting to create. Hoping to know soon so my motivation can skyrocket to make a gamemode system for a very run VR arena experience.
If anything, I can sort of invoke a VRC Avatar pedestal equivalent to a player interacting with it, so I can get them into that avatar and then read for key data periodically to ensure the user is in the preferred avatar for the map and boot them out of the arena until they use the avatar to ensure no large/tiny or invisible avatars are there to ruin the experience
We need a Udon Unleashed that lets dev's go crazy
I keep trying to do extreme locomotion stuff and udon really hates it
The reason they made Udon unfortunately rather than expose the whole MonoBehavior which I can understand security risks, but also I know they're still trying to whiteliest and expose more methods and API's they deem safe... I started Unity with modding Empyrion and there is a lot of impressive features devs can crank out when you're not restricted.
Not an udon question.
#user-support-old
Also please don't use voice changers.
How do I get Horse Animset Pro hooked up in Udon, I wanted my first VRCHAT world to have rideable horses ever since I saw videos of Primal Valley (Skyrim like world)
That asset itself will not work in udon. You need to convert the logic from C# to Udon. Udon is very limited though, so it might not even be as straight forward and may require you to change many things.
Alright, itโs no wonder why I have trouble setting it up on VRChat, thanks for the advice.
Hello everyone,
I need some help with a Udon project I want to create
๐ต I'd be happy to pay anyone who wants to help me ๐ต
Please write me a message and I'll explain you the project in detail.
Thank you so much!
can i control position of held object
You could manipulate the child object position of the object being held.
i mean if not possible to manipualte directly then i just insert second invisible object and change position of this
is there a way to prevent a pickup being dropped
doubt
player controls what he holds
but you can make item position near player all the time
sad
i want to try and override the right click action and make dropping pickups a separate thing
you can always make world vr only
don't really want to do that lol
been some time working with ui. how make ui clickable again?
Iโll try UdonSharp out
I'm trying to get the tracking data of a random player in an instance, it works solo, but with 2 test clients it only grabs the instance owner, 3 test clients it only grabs the first 2 players (random works). Shouldn't it get # players (3), reduce by 1 for the array (2), then get #s [0, 1, 2].
Nevermind I was wrong.
Nope. actually I was right.
Random.Range with int argument is [inclusivemin, exclusivemax], you don't need to subtract 1.
hmm wouldn't it output 0-3 though? if I feed 3 into the vrcplayerapi[] with 3 players, that would be 0,1,2? I'll try without the subtraction
Exclusive max is it doesn't include the max number into the random.
Guys, is it possible to set HP to all players in instance? I saw CombatManager is depricated and now I am kinda confused how should I do it
I have an odd issue with the USharpVideo player. It all works fine and I can interact with all the buttons, but I don't seem to be able to click into the URL entry box. It's not locked but almost acts like it is.
Has anyone been able to implement runtime navmesh baking in udon?
https://gyazo.com/cbd69d49850e7785f77c61e868ee5232 Can anyone tell me why my video player is giving this error? Im not sure how to fix it.
Video player don't generally work in the editor as they don't have access to the url resolution portion of vrc
Ohh okay. So the only way to actually test it is in game/ test mode?
Generally yes. What video player are you using?
I found that, at least with the UdonSharp player you can use the quest url resolver to put videos in to test on editor.
Very handy for testing out audiolink stuff
Im using the Udon Sharp Video Player. I was watching a tutorial on how to set it up but he didnt tell us how to edit it.
I'd you put this url Infront of a YouTube url it'll work in the video player in the editor
https://t-ne.x0.to/?url=
Deadcrow - Xenon Blaster [Pilot Release] ๐โณ Download/Stream โ https://pilot.ffm.to/deadcrow-mainframe-ep ๐ตโณ More from Pilot โ https://pilot.lnk.to/Discogra...
Ill try that out :3
Thank you so much โค๏ธ
Np. Glad to help
you need a collider to use interact
Is it possible to access/assign custom data to players?
So I could make something like a inventory system or stat tracker
you can use playertags, but that's not synced. Typically if you need it synced you should use or create a playerpool that assigns a unique synced object to each player, then you can put whatever variables and behavior you want on it
an object with an udonbehaviour
just somewhere in the scene
How would i access the object
you would typically have a central udonbehaviour that manages the pool, and you could have helper functions that take a playerapi and return a reference to the corresponding behavior
cyan player object pool is one prefab that does all this https://github.com/CyanLaser/CyanPlayerObjectPool
https://gyazo.com/605742d8fd658e39a19556957a577ba2 So the video thats on the player is infinitely retrying
Im not sure why.
can anyone help?
USharpVideo actually has a built-in script that uses VRC's youtube-dl exe to resolve youtube URLs (https://github.com/MerlinVR/USharpVideo/blob/master/Assets/USharpVideo/Scripts/Editor/EditorURLResolverShim.cs), but the youtube-dl's exe name downloaded by vrchat changed from youtube-dl.exe to yt-dlp.exe about half a year ago, so older versions of usharpvideo don't really work with that, so you need an updated version (or just replace the old script with the new one, or just change the path inside the old script by replacing youtube-dl.exe with yt-dlp.exe)
For other video players you can just copy that script anywhere in your assets and it should work
Hey all, very new to Udon and world building, 2 quick questions, if I want an audio source to play when a player enters a trigger collider, should I place that audio source on the trigger? and I want to set it up to where the audio only plays when the player enters the trigger for the first time, not a second time, how does one go about doing that?
in udon create an audio source variable and a bool variable and set the default value to false, then add the event on trigger enter and use the branch node to check if the bool variable is false, if it is play the audio source and set the bool variable to true
Now when the audio has played the variable will be true so it won't play next time because it only plays when it's false
Again very new sorry lol im assuming if the bool variable checkbox is off its false or is that true?
Checkbox off is false
Last thing im confused about, have everything set up as described, now what node do I need to connect to the block node to switch the Played variable to true?
Nevermind, I forgot youre able to hold ctrl while dropping variables lol
Heya! How do I change the Pixels of a Texture via Udonsharp?
I already found SetPixel and texture.apply, but when I run my code to fill the texture with Color.White, it just does nothing.
Oop. Wait a sec. It appears my texture isn't readable.
Okay, yeah. Still nothing.
Just gives me
UnityEngine.Texture2D:SetPixel (int,int,UnityEngine.Color)```
The relevant code snippet
for (int y = 0; y < texture.height; y++)
{
for (int x = 0; x < texture.width; x++)
{
Color newColor = new Color(1.0f, 1.0f, 1.0f, 1.0f);
texture.SetPixel(x, y, newColor);
}
}
texture.Apply();```
wait is udonsharp avaiable for avatars
No. What made you think that way?
How did you create the texture object? The texture format should be RGBA32 if you want to use SetPixel method
I just have a PNG I use as a texture, then put that in via a public texture2d.
Can you show the settings for the png?
because avatars use udon graphs too
I think you confused with the Animator Controller
https://prnt.sc/O3WuJsW0TAOS I get these error messages when trying to build test or publish a world, I'm not familiar with publishing worlds but the package is an upload ready yet I don't know what to do after getting these errors! please help
If you can upload, that error doesn't matter
Gotcha somehow I think the publishing is working (maybe haven't tried) but the build test is asking me to use an application to open it with using microsoft app store owo?
It shouldn't be. Take a look in sdk panel Settings, and see if VRChat client path is correctly set.
I'll take a look, i'm a visual learner so it's a bit difficult to understand without seeing what exactly to do step by step
As in the screenshot
yes everything is the same
not sure exactly what it is
How is the Installed client path?
I've uploaded it, it looks fine also how do you mean sorry client path?
You need to set to your game exe
shall do!
The build and test will launch the game with this path. If empty, it just doesn't know what to do
Build and publish is still fine though
yea I'm familiar with it with avatars, usually with worlds I just turned into a 2 bit block-head when I try new things, update it works now!
thank you < 3
Also, make sure in the console tab, that you have "Error Pause" turned off.
Am I not able to set a rigidbody's velocity in U#?
Or do I have to do it differently than in a normal Unity project
Or do I have to network it somehow? I cant really find any documentation on this
How did you do?
private Rigidbody rb;
void Start()
{
rb = GetComponent<Rigidbody>();
rb.velocity = Vector3.forward * 10f;
}
it has a Rigidbody component on it
It didn't move?
not at all
I also have a VRC Sync component and a VRC Station script, but removing both of those didn't change anything
can some one help me ? i dont have any errors and idk what to do anymore
are you on the right unity version?
2019.4.31f1
Those shouldn't be an issue. Try FixUpdate and see if the velocity is constant
Does the console report any error?
Are there only those?
Probably those. Click on it and see the detail below
Object reference not set to an instance of an object
Can the script not access its own Gameobject
?
That one is from a different script, it's calling VRCPlayerAPI which doesn't exist in play mode.
btw how did you test?
wait thats for a different gameobject
Unity debug mode AND the SDK's build and test
is there a different way i should test
this is the error for the correct object
same thing basicaly
There's also cyanlayer's emulator you could try
So if that's the error from the correct object, that'd prevent the script from continuing to the rigidbody part
When using VRCPlayerAPI, player doesn't exist in unity test play, so it can't call any method related to player
You need to either test in game or using cyanemu
I do test in game
and it doesn't do anything different
Im not even accessing the player tho
It's probably having different issue too.
So you said Player.SetVelocity wasn't what you did?
Can you show the game object inspector panel?
And the script content?
Try "Reload SDK" from the SDK menu, I keep having the same issue for some reason and that fixes it (until it happens again...)
the Gameobject and Rigidbody are just referencing the object that the script is attached to
Try without private modifier
Yes. Just void FixedUpdate()
but doesnt that just imply that it's a private function
Empty access modifier has different access level from private
unless U# changed it, it should be the same
either way, no difference when I removed it
Let me test a bit
ok
Could you take a look in compiled assembly code?
.data_start
.export self
.export rb
__refl_const_intnl_udonTypeID: %SystemInt64, null
__refl_const_intnl_udonTypeName: %SystemString, null
self: %UnityEngineGameObject, null
rb: %UnityEngineRigidbody, null
__0_const_intnl_SystemSingle: %SystemSingle, null
__0_const_intnl_SystemUInt32: %SystemUInt32, null
__0_intnl_returnTarget_UInt32: %SystemUInt32, null
__1_intnl_UnityEngineVector3: %UnityEngineVector3, null
__0_intnl_UnityEngineVector3: %UnityEngineVector3, null
.data_end
# using UdonSharp;
# using UnityEngine;
# using VRC.SDKBase;
# using VRC.Udon;
# public class FlightTest : UdonSharpBehaviour
.code_start
# public GameObject self;
# public Rigidbody rb;
# void FixedUpdate()
.export _fixedUpdate
_fixedUpdate:
PUSH, __0_const_intnl_SystemUInt32
# {
# rb.velocity = Vector3.forward * 10f;
PUSH, __0_intnl_UnityEngineVector3
EXTERN, "UnityEngineVector3.__get_forward__UnityEngineVector3"
PUSH, __0_intnl_UnityEngineVector3
PUSH, __0_const_intnl_SystemSingle
PUSH, __1_intnl_UnityEngineVector3
EXTERN, "UnityEngineVector3.__op_Multiply__UnityEngineVector3_SystemSingle__UnityEngineVector3"
PUSH, rb
PUSH, __1_intnl_UnityEngineVector3
EXTERN, "UnityEngineRigidbody.__set_velocity__UnityEngineVector3__SystemVoid"
PUSH, __0_intnl_returnTarget_UInt32 # Function epilogue
COPY
JUMP_INDIRECT, __0_intnl_returnTarget_UInt32
.code_end
tbh i dont really know how to read this
Seems no problem but doesn't match with the error we saw before
wdym it doesnt match..?
Another one has a part that seat player onto the station, so that's probably from a different script
yea
Ok I see. IsKinematic stopped it from changing velocity
The kinematic rigidbody has to be moved with MovePosition
how is that possible. If it's kinematic it should be able to change its own velocity...?
is it just different in udon?
No. I read in unity documents
Kinematic doesn't go into any physic calculation. Velocity also not included.
Hi i saw Vowgan video on Object Spawning and i was wondering how i would go bout having it so when someone picks up a gun a new one spawns in right away
What would this look like in U#?
nvm got it
public override void Interact()
{
Networking.LocalPlayer.UseAttachedStation();
}
i didn't realize that UseAttachedStation was a method
i try it but its not working at all ๐ฆ
https://prnt.sc/pB5r3eTyeh5_ I was just about to upload the world, but the publish and the little green community lab thingy doesn't show and I can't click anything on the upload "game" bar, please help v.v
you have an option called error pause enabled. You should disable that, as you're bound to get some udon errors when there aren't any players and udon tries accessing players. You can safely ignore those errors
Where is that?
in the console tab
sorry i'm a visual learner can you show me?
Right thank you attempting it
That seemed to work!
I am trying to get the capsules in an object pool to follow players but I was only able to get it working locally, I tried this setup but it doesn't seem to work so I'm a bit lost. Anyone know how to go about this?
Here is a screenshot of what I'm going for.
Is it possible to take manual control of avatar hand positions/IK targets through udon? Like if I have a world with a weapon system and hold a two handed gun with both hands, and I pull my front hand away from the gun model, I'd like to see my virtual hand remain connected to the gun (assuming I am still holding the grab button). Anyone know if there are examples of this or if this can be achieved? Basically I want to get between the player's tracking data and avatar rig somehow and override it. I know a Station can override tracking data so I imagine that's the key somehow, however I don't want to use an animation I just want to override the IK. Hope this makes sense
My project seems to be getting stuck on an import in SerializedUdonPrograms and then goes into an infinite import loop. Any ideas how/why that happens?
you need to say when you want the transform, set position node to be called. In your case, create an event, update node, and plug it into the arrow slot of the transform, set position node.
Ohhh, that makes sense lol. Thank you! Now I just gotta get the tag part working.
Hi i saw Vowgan video on Object Spawning and i was wondering how i would go bout having it so when someone picks up a gun a new one spawns in right away
Many ways of doing this.
Do you want this to be networked? Optimized and limited? As simple as possible?
I think the easiest way, non-networked, would be to just have a script fire on pickup, reference a public gameobject (that weapon) and Vrc.Instantiate it.
The safest way, also easy for networking, would be spawning the max amount of weapons somewhere and just teleporting a gun that isn't being held to the spawn position when one at that position gets picked up (e.g. leaves a collider or, again, you check for the event)
Yee
Put all the guns somewhere
When someone picks up a gun, check if there's a gun in the space and if there isn't one there, put one there, the next one in the array.
Extra points if you instantiate them on demand if none are free and there's gun "slots" left, and keep track of their transforms in a single object somewhere that manages networking for them, but i think that's a little out of scope from what you wanted xd
I was playing vr chat and i didnt know if people could see me
Does anyone know anything about infinite Udon import loop issues?
I cannot find anything about this anywhere and cannot use my project anywhere.
More specifically...
i am getting this error and after about 3 hours of work, will i need to redo everything. System.IO.FileNotFoundException: C:/Users/NICHOL~1/AppData/Local/Temp/DefaultCompany/avatarworld/scene-StandaloneWindows64-SampleScene.vrcw does not exist
File name: 'C:/Users/NICHOL~1/AppData/Local/Temp/DefaultCompany/avatarworld/scene-StandaloneWindows64-SampleScene.vrcw
i am using 3.0 world build
So I am using this graph here to start an event when a player enters an area
The event it starts is a door opening when the player gets near it, then it closes when they are away from it (controlled by a box collider set as is trigger) now, while it does work there is an issue, if two players enter the zone at once, it completely messes it up, for example if i walk to the door and it opens then someone walks up to the door before i leave, it will close it and mess up the cycle
Is there a way I can make it so the Door will remain open until the player leaves the zone even if another player enters the zone?
for reference, this is the event this graph above starts ^
You need a counter (int variable) that gets incremented when a player enters the trigger, and decrements when a player leaves the trigger.
When that counter is 0 it means there is no player currently in the trigger. If its > 0 then there is.
do you have an example of how I can do that? or where do i plug that in?
I wont give the solution away more than I have. Ask more detailed questions of what is unclear to you.
I am not really sure how to set up a int variable counter to be exact
Hi hi! I have a quick question Im having this error and I cant seem to find a fix for it
its there in the vrc sdk udon script but its saying its missing in unity
any ideas?
For what reason your Udon is in the "Old" folder?
This is my 3rd iteration of my world, so to keep everything tidy I set all of the old assets and scripts in the old folder
would that create issues?
Very likely if you updated the sdk or changed unity version.
I did update the sdk, I'll move it to the main asset folder and check back with results
found out that doing the old folder and not deleting the Udon or sdk in the old folder created a new udon folder in the newer folders so it looks like it created a redundancy
deleted all the udon folders and the related sdk folders
re-importing the sdk back in now
Should never move imported folder, for updatability, and in case of some asset has scripts that expects some specific path.
I will keep this in mind for future updates ty
Iv been following a tutorial for making a door that opens and closes, I just changed it so instead of a button, its a zone. i dont really have much idea on how to do things like a counter or how to set that up. My knowledge is basically just limited to things iv learned from tutorials. If there is a tutorial out there somewhere, I'd happily take the time to learn it but I dont really know where to start
How was your attempt at making a counter?
Failed. I have no idea how to do it
I got as far as making an int variable but I have no idea what to do with it
That's the start at least.
I hardly understand udon. I only understand somethings because of tutorials
So if someone tells me what needs to change to make something work but not how to change it then I'm pretty much screwed xD
I have only been able to learn through people showing me
You can do trial-and-error learning. Do some experiment with things and observe its behavior
The overlay is "when something happens, do some action". So for now, reduce your scope to just making the counter work: increasing and decreasing the counter when player enters and exits the area.
Yeah that seems to be my route for now
Just wish there was more tutorials out there for the little things you know what I mean?
All the little things is what makes the whole system work so each one is important to learn
Have you take a look in the sdk example. There could be something useful
Anyone know about this?
How dose one create tank control boat. meaning how dose one find input, then tell object to move/turn.
also is there a nicly organized thing so that i can see what each udon function dose
Is there a simple way to sync video players to all rooms? so they all play the same video, i'm struggling to figure out what it is :<
Living room, upstairs room, main room there are video players, main room syncs to a "Youtube Playlist" on the jukebox, and syncs up fine. The rest of the video players in the other rooms don't sync to the youtube playlist from the juke box as the one in the main does if that makes sense
making a door that toggles and syncs with late joiners
can someone review please
How can I get the tag of a player that enters a trigger?
I tried this but it doesn't seen to work. Every player has a bubble and I want it to turn red when the person who is "it" enters the bubble.
what's the grid spacing of the udon graph?
Does anyone know if it's possible to get someone's ping and use it as a variable with udon?
Does anyone know how to dynamically bake nav meshes with Udon?
Iโve tried using these nav mesh components, but NavMeshSurface isnโt whitelisted by Udon https://github.com/Unity-Technologies/NavMeshComponents
How to get player camera ? or how to set visual layers on camera ?
How do I set a gameobject's transform? I can't find a relevant Udon node for it. I can get the transform, but not set it.
... that would imply you can't move objects...
Set the position, rotation or scale of the Transform rather than the Transform itself. Get the transform, then set the property on it. If the target GameObject is affected by Physics, then get its Rigidbody and set the position, scale, rotation, velocity, etc on that instead.
Huh, I always thought of the transform as a component on the object and not what you'd control. I'll try that, thanks.
A "Transform" is a component. Every GameObject in Unity is forced to have one. The GameObject itself is more or less just a container for components.
However you dont change the component itself, but the data it contains, like its position.
Right, it's just in my head you'd reposition the gameobject, as opposed to pushing new data into the transform component, which does make sense now that I think about it.
is there any open source udon sharp game projects we can learn? Just read the documentation is not enough. and tutorial videos are usually quite simple, just something like "switching mirrors"๐คฃ .
There's prefabs you can try to learn from I guess.
https://vrcprefabs.com/
this page also has some nice guides.
https://vrclibrary.com/wiki/
(mainly Unity general stuff)
vrcprefabs is great! but i can't find any udonsharp reference on vrclibrary?
Is there a way to delay an udon script's execution process, or should you exclusively use sendcustomeventdelayed for that sort of thing?
Hello there, real quick question, I am spawning gameobjects (simple cubes) unsing instantiate and want to despawn them after a delay, but cant find the nodes for despawning or how to set a delay.
Hah, we both have delay questions it seems.
Yup, I have seen the delay on custom events, but I dont even know how I would need to set custom events for individually spawning objects.
You use Destroy to get rid of GameObjects. The second argument is a float for the amount of seconds to wait, which is what you seem to want.
You could also create your own timer and decrease it each frame and check if it's done. That gives you a bit more control than SendCustomeEventDelayed. I don't know if there are other ways. I guess you could use the animator, but probably not what you want.
I see, but I only seem to find the Event OnDestroy, can you elaborate ?
I assume you use udon graph? I'm not sure how to search for that on there.
This is what you are looking for: https://docs.unity3d.com/ScriptReference/Object.Destroy.html
Maybe try searching for Object and then Destroy?
I think you can press Tab to get a more indepth search for udon graph. I don't remember the actual hotkey though.
I'd definitely recommend checking out any examples in the SDK and any example projects in the documentation.
They had this one: https://docs.vrchat.com/docs/obstacle-course
Overview This project was created for our second World Jam, and serves as a fun starter kit for a Time Trial game world! Visit the example world here: VRChat Obstacle Course Jam World.Download a ready-to-use project here: VRChat Obstacle Course Project.For advanced users, you can fork the GitHub pro...
And this one more recently with the new udon sharp version: https://github.com/vrchat-community/VRChat-Joke-Jam
Hmm .. I dont seem to have access to Destroy in the node system, have you ever tried using it in C#?
Yeah, it works in U#.
You have to use Tab for the bigger search
I just tested it and it appears there
Alternatively it's located under this:
Oh! I see it too. Didn't know there was different types of searches (for performance I guess).
@wind atlas One suggestion form your side please (as you seem experienced). I know how to code, but I am just starting to learn about all the methods available and thought by starting with the Udon graph it would be easier learning everything or should I stick to U# from the start?
Honestly, I have no idea what's better. It's probably fine to just start with U# if you know how to code. The actual calls are pretty much the same, as you can see from the Destroy example.
SendCustomEvent doesn't work here so I assume I'm doing it wrong... as this was my original attempt at a delay.
I think using U# is probably also more interesting because you can go through the code a bit easier and see what's available. For example, which methods can be overwritten etc.
Can you describe what is not working?
Are you getting any errors?
No errors, the Custom Event part doesn't fire.
Check that the string is exactly the same. Also, I think the send event node should show you the event strings in a drop down.
So you don't have to assign it manually.
Oh, I think I see the issue. I've named the variable with the correct string and not actually given that variable a string. I'll correct and try again.
Ayyy, that was it.
Imo it's easier to just use U# if you know basic coding.
Once you have it in visual studio you have code completion which makes it easy to figure out what sort of methods everything has.
I'm on like day 1 of using Udon so it's all a bit magic still at this point, despite being familiar with code outside of this.
You can also skip the assigning a value part by using a Const string input. (I think)
Oh... Yeah that's why that part looked a bit sus to me. Stuff like that is also an argument to just jump into U# if you know coding. Some things are not as convenient and you have to learn how to do it in graph. I know for loops look super weird in graph but are very easy in code.
Yeah, loops are always a pain in visual blueprint systems.
Good point, is there a documentation on how to properly setup your VSCode?
I'm not sure about for with vscode, I use Visual studio.
Idk if this is an udon question if not pls tell me where to ask this question but is audio link gonna be able to work with quest soon?
For visual studio there is a project project created in the root of the project directory you can open that had all your scripts in it
Pretty much you need C# extension by Microsoft and it's good to go
Audio link is quiet a heavy system, I doubt that's going to work well in quest
I heard from a friend that audio on avis is gonna be available for quest users but Idk if that's true or not
There isn't any official statement about this. So probably not true
Damn I been wanting that to come to quest
There is no way audiolink would work for quest Avis, as it requires a shader that supports audiolink and you only get the vrc mobile shaders on quest Avis.
So, I'm setting up an event for an RP server, and Im trying to add guns you can pick up and fire. Has anyone done this before and can that same anyone send me a screenshot of what your udon graph looks like?
Edit: NVM figured it out im just dumb
Is there a way to tween object positions with Udon rather than having to use animations? e.g. being able to lerp between <currentposition> and <newposition> etc.
Hello is there any tutorials show me how to make projector effect like this in vrchat?
It look so cool
I've not found any tutorials, but i have found this asset that folks have been using, may be able to look at its code to figure out how its done
https://booth.pm/en/items/3244355
VRChatใฎใฏใผใซใไฝๆใงๅฉ็จใใใใจใๆณๅฎใใใใญใธใงใฏใฟใผใงใใ v1.0.5ใซใฆใLightShaftใฎๆ็ปๅ่ณชใๅไธใใพใใใ v1.0.2ใซใฆๆๅฝฑ่งๅบฆ่ฃๆญฃๆฉ่ฝใ่ฟฝๅ ใใพใใ! ่จญ็ฝฎใฎ่ช็ฑๅบฆใๅคงใใๅไธใใพใใ ใตใณใใซใฏใผใซใ(v1.0.5)๏ผ https://vrchat.com/home/world/wrld_845135e5-3e62-4f81-a9cb-4786cc5e3dfd Unity2019ๅฏพๅฟใ iwaSync3ใฎในใฏใชใผใณใจใใฆใ็จใใใใจใใงใใพใใ https://hoshinolabs.booth.pm/items/2666275 ๅ ๅฎน็ฉ๏ผ
tysm๐
whats the bit of code that will bring objects a player is holding through the tp
or how would i do it
This may be confusing to ask, but is it possible to make a automatic timed toggle?
An example of what i mean is like this
Imagine 3 game objects in 3 different locations, Object A is the only one active while the other 2 are inactive, After a set amount of time (say 30 seconds) Object A Becomes Inactive But Object B becomes active, and then 30 seconds after that Object B goes inactive while Object C becomes active, This cycle keeps going in 30 second intervals
I know it might have something to do with timer delays, but is there a way to have them trigger automatically
Thank you so much! This is currently for a makeshift subway system for my next map, where if the subway car is at a station, you can hop in and when time is up it "Moves" to the next station
However what really happens is when the subway "moves", it actually just dissapears having a collision teleport replacing it, teleporting the players to the next subways location
I already had the collision teleports figured out, it was all about how to get it to function automatically at a fixed amount of time
does owner can be set to null ? owner is automatically set to the first player, but i want the object has null owner at initialling.
Every networked object must have an owner at all times. And this is by design. I dont know what youre trying to do, but you should probably reconsider how youre approaching it.
@fiery yoke could u help me? in #world-development did vrchat change the VRCPlayerApi
No I cant, I have never used CyanEmu. Usually this just means that something is on the wrong version, either Unity itself, the SDK or any other external things you have in the project.
this has nothing to do with cyanemu i'm on the right sdk and unity idk what it would be
I have 2 questions about this,
-
Is there extra steps to make this synced for everyone in the world? Or do you just need to press that sync button on the left?
-
Is it possible to do this type of function in reverse? (When the game starts, Object A is the only one inactive and the other 2 are active)
is there any way to debug breakpoint in udonsharp?
Odd. I have everything loaded in VS2022 and most of the audiocomplete and lookup works, but random things like PlayOneShot seem to be missing. Any ideas why?
I get PlayClipAtPoint, but not PlayOneShot?
Is this the correct way of changing an objects position with udon? i dont have any compiler errors. when i build and test and try clicking the button i have linked with it, nothing happens
why not use an array ๐
idk, this is just the way i thought of. im still beginner coder. ive used arrays before but its been a while
ive been finding prefabs for most the stuff i need for my world, but not for horse racing, so im trying to code my own'
it's a single frame loop, glad you didn't cause a dead loop, you need to separate each loop into different time,like Update() . not in the same function .
but if i put it in update, wouldnt they just start moving without me pressing the button to start the game
set a variable like "pressed", set true when event trigger. if(pressed) do things . set false at last of Update()
Well as I don't normally code in C#...
It only gives me classes and not any objects though?
Ahh, ok.
it's still painful to code even as a unity programmer like me.. Because I cannot coding freely, limitation is very painful.
How would I reference "this" as in the gameobject this is running on?
I don't understand what you're saying
This script is going to be attached to a gameobject. How do I get/reference that gameobject?
Oh, so that will be this gameobject by default?
yes, as well as "transform"
sometimes I do think Udon system is above most of people's knowledge level. and they even never mentioned about to learning C#+Unity game coding
I do full stack dev work, but not in C/# so it's still mostly alien in how it's supposed to work, even if the basic principals of coding are still the same.
Hey, I am trying to reset a Pickup Gameobject to reset to its original position OnDrop, how would I do that (would I use VRCObjectSync's Respawn, if so how)?
whats the problem
You're missing a semicolon
You could just store the initial transform in start and move it back when you're done, but checking the docs respawn does just move it back the original location
Line 9 no semicolon
I think I ll make it more adjustable and add another public transform for the reset location (Start/OnDrop), thanks for the help
You misspelled player in trigger enter
i saw it but thanks anyways!!
it want work
Can anyone explain this behavior? The bubbles don't work properly in the beginning, but fix themselves after a few attempts. The colors don't always sync up for other players as well.
The red and green buttons just set the player's tag to "it" and "not it."
im not sure if its different for udon, but can parent objects handle collisions of the children in the parent script?
dont know that language
normally, when it only works after a while, it's usually because something isn't getting setup right on start but redundancies in your code correct the mistake after a few interactions. I would look into how your defining who is 'it'.
Another thing to watch out for, is that onPlayerTriggerEnter gets called whenever a player enters a collider, regardless of if it's the local player or not. I would grab it's playerApi, and put it through a playerApi, get islocal check, otherwise everyone will be playing the event and sending networked events
that might work for the first, but it's better to check if they are the owner
1:
2:
You were totally right, I managed to get it working thanks to your suggestion. Thank you!!
is there anything specific i need to do to be able to use objects from other class files? I am trying to make horse racing and i tried just having one script and i couldnt, so its going to have to be multiple scripts. When i tried earlier to access a external script using namespace, i couldnt
public OtherType variable . or get target gameobject and gameobject.GetComponent<OtherType>()
So I'm not much of a computer guy I know how to retexture and upload avatars but the scripts for the sdk have completely have errors and I idk how to fix it
On unity
Is there any Type that similar to List<>? because List<> or ArrayList are not available in Udon
I'll see
Whatโs udon
Assembly assets/VRCSDK/Plug-ins dynamics.PHYSBones.dil will not load unity mathematics
Dynamics. Contact
Unity burst
Vrc collections unity burst
dynamics.PHYSBones.editor.dil
Dynamic Contact editor will not load
Oh and c sharp. Editor
That was after
i don't understand whats wrong
You'd use a regular array, custom data types like that are not available.
Try reimporting the correct SDK.
I've seen some people implement them into an udon behavior, but not sure how efficient they are.
that makes me struggled with dynamic length array. see if there is any way to do that
You can create a new array with one more space and then Array.Copy or whatever the method was from one to the other.
i did and it still errors and this started happening after may 31 update
of course I can make custom array functions , but that not efficient
Well yeah, you pretty much always trade off convenience for performance. I'd honestly just use Array.Copy into a new array and not think about it as much unless I really have to.
I have not tried the new update then
Your path is also weird. Usually there is no "SDK3A" folder when you import the world SDK.
Might be the new update, but I'd really make sure you are importing the right one.
i have that problem too when i imported both world and avatar. turns out to fully delete avatar sdk
can we launch 2 test client with different player name ? because I can't tell players who is master or client
let me see because i downlaoded the new sdk from the vrchat website on downloads from the profile stuff
and its not the world sdk its the avatar sdk
im trying to upload avatars
and thats what i downloaded was the 6/03/2022 avatar sdk
this is the right sdk right?
its the one im using
This is the udon channel, which is based on the world sdk. You could try the avatar channels, maybe someone will recognize what's happening instantly.
Either way, to me it looks like there are either missing files or some kind of issue when compiling.
I'd recommend creation a new project entirely and doing everything step by step according to the documentation. Make sure you have the right unity version and stuff like that.
how do i do an udon behavior it slows the player till they get off the collider of the object
um where do i go for avatar sdks
It would help if you could post what you are expecting to happen vs what happens.
Like the avatars-3-help channel?
thank u
so when a player mesh collides with the ground i want it to slow them down
Do you want to just decrease the movement speed? Then you can use one of these:
wym sorry
Those methods allow you to control the player speed. Is that not what you want?
yeah just when i am on a certain mesh
like if a player runs in mud it slows them down
Well, that depends on how your "mud" looks like. For example, if you want to define trigger zones on the floor, then you could use OnPlayerTriggerEnter to set the speed and OnPlayerTriggerExit to reset it back. Maybe this will be helpful: https://docs.vrchat.com/docs/player-collisions
Udon has three ways to detect when a Player and an Object Collide - Triggers, Physics, and Particles. Triggers If you want to detect when a player has entered or exited an area, your best bet will be to use the OnPlayerTrigger events. There are three of these: OnPlayerTriggerEnter is called when a p...
@wind atlas so something like this?
Close but not quiet. The left part with the trigger is wrong. What this does is: it only trigger when your "Quad" enters the object this script is on.
You need the specific player trigger events I posted in the link before.
You could also go to the VRChat Examples and open the scene there. It has some examples, including some scripts to detect when a player enters an area.
I got it working thanks
Is there a way to grab a player's account creation date through Udon?
Now I'm having a really strange issue, has anyone else had a bug where a pickup spins in the player's hand when it's held by someone that isn't the instance owner?
edit: of course i just restarted all the instances of vrchat i had running and the issue went away
There isn't a way to identify player data from udon other than player display name.
When I change my skybox ingame, the reflections don't update with it (the night screenshot on the left still has the reflection colors from the day screenshot on the right). Is there a RenderSettings node that can update this?
hello! I'm new to using Udon, and I found something called UdonSharp. I made an AI script designed for a horror game I'm working on for VRChat. I'm not all that familiar with the way Udon does things, and I have this compile error that I don't quite understand. I'm hoping someone here could help me out. Udon doesn't seem to like this specific line of code
ookay, well the error slightly changed after using the official version of UdonSharp. It's more specific, but doesn't tell me what I should use instead "Method is not exposed to Udon: 'GameObject.FindGameObjectWithTag("Player")'"
Tags in general are not exposed to udon because tags cannot be uploaded with worlds. if you really need to find an arbitrary gameobject you can use Gameobject.Find, to find by name.
However, that's not really the answer that you need. The real answer is that
A) if you want some arbitrary gameobject, you should keep a reference to it from the beginning and store it as a variable somewhere. Maybe use Gameobject.Find once on start if you really need to. It's a huge waste of time to go searching for objects every frame
B) You probably don't want a reference to a gameobject at all anyway, since you're looking for a player. Players in VRChat are not referenced as gameobjects, they are referenced as a VRCPlayerAPI. If all you need is the local player you can simply do Networking.LocalPlayer and then once you have that you can do various things like GetPosition or GetTrackingData.
that just gave me more errors :/
I should probably mention that I'm not that smart when it comes to C#, but unfortunately it's the only way I can think of that'll give me what I need for the AI
I tried deleting the entire code for the AI to chase the player upon spotting them, and that got rid of the errors. But I kinda need the AI to chase the player, since it's supposed to be a horror game heh
I know I'm definitely doing something very wrong, since C# is extremely picky on where certain lines should go. But like I said, I'm not smart when it comes to C# scripting
I learned how to make this AI script from youtube, and doing some testing it's exactly what I'm looking for. The AI will wander between set nodes, and will only chase the player if it spots them in plain sight. if the player is behind walls it will not chase, but only if it sees the player will it start chasing
I've tried searching for similar Udon scripts, and even tried seeing if anyone else has some kind of tutorial for this kind of AI. But it seems like not many people makes this kind of advanced AI for vrchat
Particularly the EnemyController and state scripts (i.e. ChaseState)
Np, please save the links though cause Iโm gonna delete them
alright, done it
I think the biggest thing that you're doing wrong is not using Visual Studio code. C# is one of the best languages for autocomplete and code assistance, so it's very important for the learning process to make sure that your editor is properly connected to unity so that it can point out errors visually before you ever get to compiling
there are other ones like jetbrains rider or visual studio community and they have minor differences, but code is the "most free" and easiest to get your hands on. It's important to at least get something
once you get that set up, you should be able to see much more clear errors, like the fact that playerapi's don't have a transform, should just be highlighted red the moment you try to type it. And instead when you start typing position it will present you with the correct thing instead of having to just hope that you've typed it correctly
are destroy and instantiate calls bad for vrchat? im working on a world that requires dynamic spawning and destroying
Use VRCInstantiate
Is there a way to send an event to all udon behaviors that are using the same udon graph?
is there something similar to "goto Label" cuz i need to jump to a different spot in code and labels arent supported
technically JUMP exists in assembly but I really hope you're not writing raw assembly. If you're using udongraph then you can make a custom event and sendcustomevent, and if you're using udonsharp then you can make a function and call that function like any regular C#
no im using UdonSharp
that kind of question does confuse me though because it could either be coming from someone who has no idea what they're talking about or someone who really really knows what they're talking about, so apologies if that's not helpful. Would appreciate some context of where you're at
{
mover = Random.Range(1, 4);
distance = Random.Range(-0.1f, -0.4f);
if(horseYCollide == true && horseRCollide && true && horseGCollide == true && horseBCollide == true){
end = true;
}else {
if (mover == 1)
{
if(horseYCollide == false){
targetY = new Vector3(horseY.transform.localPosition.x + distance, horseY.transform.localPosition.y, horseY.transform.localPosition.z);
} else if(horseYCollide == true && end == false){
goto Finished;
}else{
}
}
else{
}
so for context, i have a working horse racing game. 4 horses (so code continues in similar fashion for results 2,3,4) right now im trying to make it so that when 1 horse crosses the line, it jumps back to beginning of MoveHorse
reason i cant just let it finish is because this is at the end of MoveHorse SendCustomEventDelayedSeconds(nameof(MoveHorses), 4f);
if you're just looking for more control over flow in C#, then I would recommend learning about things like return, continue, and break. They're generally designed to be safer than a raw goto. In that situation you'd probably want to do
return;``` if you want nothing else to happen
@scarlet lake you forgot to add the mirror it say self so the button.btw i dont mean on the udon graph i mean on the button where the script is the field where the mirror should be is empty
Why when I download USharpvideo player and use it. It show me that the script is missing
do you have udonsharp and the vrcsdk installed?
I use it another project and yes I already install both
I forgot in this project
but nvm I just doing the videoplayer by myself and it work now
I will try to tysm
Just need to drag and drop:
what is "sendChange" compares in Udon Sharp? how to do it?
The equivalent in udonsharp is to always work with the property, not the backing variable
do you mean the property and variable combo that used for FieldChangeCallback?
yeah
local multiple clients that launched by Unity can be synced properly. But online world with real players sync is different. I'm getting huge struggled with it. ๐ญ
it seems solved ! thanks
Heyo, I'm trying to get a change_material_on_event scritpt to change the material on multiple objects, how would I go about that? i've figured out the whole material index, but how would I go about making it change the material on multiple?
it's just the default example script, but it works for what I need, I think
you would want to make an array of all your meshrenderer's and whenever you go to change the material, you just need to cycle through each object in the array: https://youtu.be/s3mZ7SLfmzI
Here's a tutorial that goes over calling all game objects inside a game object array. This same method would work for any arrays, be it colliders, pickups or audio sources arrays.
I made this tutorial, as it's a little confusing not being able to directly plug a game object array into a set active node, and going from a simple toggle script, to ...
.
Quick question, is there a way to cancel delayed events? turning on and off the object doesn't seem to do it...
Hey guys, does anyone know if it is possible to allow players to adjust the far clipping plane locally with a Udon setup? I can see there are nodes for it, but I can't quite figure out how to get it to reference the camera of the player.
Has anyone used the Feature AttachToMe ? Its causing me errors but was working earlier so idk whats going on
well that helped! But not completely. I managed to get the compile errors to stop, but now I'm facing a new issue
happens every time I get near the AI
can I invoke any method with out knowing target class? just like reflection. Because usharp could do that any way. but how?
with params and return value
is there an ingame debug tool
RShift + ` + 3
tjanks
guys, i need people that can help me with a youtube video im making in VR, what would be the correct channel to use to find them?
Seems like you're trying to get the actual player Transform, is that right?
yes, thats right
It's not supposed to be possible to get behaviours which are not part of your world, so udon will return null if you're trying to meddle with something outside of its scope, e.g. player objects
thats gonna be a problem. the script needs to detect if the player is nearby
PhysicsOverlaps will populate an areay, but the elements in it will be null if they're protected
What you want to get instead is probably VRCPlayerApis, which have the location of the player exposed
You could probably have a trigger collider on the same object and use the OnPlayerTriggerEnter event to get all VRCPlayerApis at a given location
I'd have to re-write things that I don't quite understand. I swear this would be way more simple if I could just commission someone to write me the script I'm looking for...
only problem is, I have no clue who I could even pay. So I'm just having to figure it out myself
stressful stuff
it appears you have an error with 4 or more udon scripts
im a little confused. Getting error NullReferenceException: Object reference not set to an instance of an object HorseSpace.horseRace.Reset () on line resultsArray[0] = "";
and then this has just had a few different issues so im thinking im not even going about this the right way
{
GameObject firstPlace;
GameObject secondPlace;
GameObject thirdPlace;
GameObject fourthPlace;
public horseRace race;
void Start(){
firstPlace = GameObject.Find("FirstPlace");
secondPlace = GameObject.Find("SecondPlace");
thirdPlace = GameObject.Find("ThirdPlace");
fourthPlace = GameObject.Find("FourthPlace");
}
void Update(){
firstPlace.GetComponent<TextMeshPro>().text = race.resultsArray[0].ToString();
secondPlace.GetComponent<TextMeshPro>().text = race.resultsArray[1].ToString();
thirdPlace.GetComponent<TextMeshPro>().text = race.resultsArray[2].ToString();
fourthPlace.GetComponent<TextMeshPro>().text = race.resultsArray[3].ToString();
}
}```
basically my goal is to update a canvas with TMPro's on it for 1st, 2nd, 3rd, and 4th as they cross the finish line
i get this error on the resultsHorse class ```VRChat client runtime Udon exception detected!
An exception occurred during EXTERN to 'SystemStringArray.__Get__SystemInt32__SystemString'.
Hey good rule of thumb may be to null check some of these references to narrow it down
First of all, don't use GetComponent in the Update loop if you care about FPS.
The first error is a bit confusing. If I take it at face value, then you haven't set "horseRace", which doesn't have much to do with the line you posted.
For the second error, I'd be curious what type "resultsArray" even is.
Posting the full error log would be helpful.
Also, the second error could also be, because you don't initialize the array at all, but I'd need to see more about the error and your code.
And since you are asking about what kind of approach to take: I'd create a method "FinishRace(result)" and do something like this:
index += 1;
resultTextArray[index].text = result.ToString();
"resultTextArray" basically holds all of your TMPro references and you just go from the first to the last one and assign whatever result you want to them with each "FinishRace" call.
This way, you also avoid the Update loop.
Anyone use the attachtome system? In USharp 1.0 beta, its not wanting to work for me. It keeps breaking when I hit play.
can we start 2 Unity Editor to join together? or one VRChat client + 1 Unity Editor.
Well so i have to do an update loop anyway for the MoveForwards i have to move the horses because that was the only way to get smooth movement that i could get working. I did get the TMPs working through the update, so will it really be that much of an fps killer?
If so then ill try to make a method for it then. Last time i tried though i couldnt get the tmps to update at the right time, they were always late to updating the text
nope
The issue is mainly the get component calls inside the update loop. You should at the very least cache it at Start. So instead of just saving the gamaobject, save it as a TMPro object directly.
Oh ok i think i get what you mean. Im not home so i cant look and im a very beginner coder (only have taken a beginner java and beginner C++ class so far). Thank you for explaining it all though. So just to make sure i understand, i should create a TMPro object, cache it in the start, then in update, just update the text?
Yep, you got that right. This is more of a unity than a language thing. GetComponent calls are not free, especially since udon is slow. Your script by itself is probably fine, but if you keep doing things like that, it will become noticeable.
Ok ill try it out later then, again thank you for your help
currently having an issue with a null reference exception, and i have no idea how to solve it this time
based on the log, i believe the issue is coming from the eventName being passed to sendCustomEvent
Parameter Addresses: 0x00000026, 0x00000027
Object reference not set to an instance of an object```
what i've done is named this game object's name, custom event and UdonBehavior all the same, that way my code can just pull the game object out of an array, get its attached udon behavior, and then look at its name to know what customEvent it should call
but, for whatever reason, Udon is not liking that Get name node
i already set up some logs to spit out what Get name "gets," and it isn't null
any and all ideas would be appreciated
That error means that whatever object you are calling "SendCustomEvent" on is null. So whatever you are getting with GetComponent returns nothing.
i see
GetComponent always confuses me in udon graph so I'm not sure what's wrong with it.
But it seems like using whatever string you are using doesn't get the correct udon behavior.
well this was part of a workaround due to UdonBehavior[] being broken
nothing better than having to workaround your workaround
thank you though
holy shit
found out why it was pulling null (probably)
it's because i spelled the type as "UdonBehavior" and not "UdonBehaviour"
all because i don't adhere to the STUPID British spelling conventions
that fixed it
I tried importing the OSC prefab into my world and I got this any ideas on fixes?
iโm getting this error. can anybody help me fix?
open up the console and have a look at what error messages there are (btw, windows key + shift + s is an easy way to screenshot only part of a screen)
any idea how to have an instance directly face the player? this doesn't seem to be working just right, it does move though ~
it's like it takes the center of the world instead of the head pivot position
Anyone know what would cause this error?
Everything was working fine and then it just randomly started when i changed scene and back.
Ive tried everything from deleting the vrcsdk and reimporting, all the other dependant packages, reimport all.
Everything short of just recreating the project.
there is nothing like this
how to do conditions in udon behavior script?
yes
okay and how do i check if an Animation is toggled or not? for example if i want to make an door that can only be opened manually but it closes automatically
that sounds like something animation conditions would handle
(Sorry, accidentally recorded this one in 1080p, whoops)
Two of my oldest videos, Contextual Buttons and and Door Animations, have both grown rather outdated, so I've combined the two into a brand new video to go over them!
Full Tutorial Playlist:
https://youtube.com/playlist?list=PLwEtUGCdQX7HMkFCVxiNvO4DS2CmHWbe6
00:00 - Intro
00:42 - Animat...
can I Instantiate unlimited amount of pickupable+synced gameobject? rather than using pool because that's limited amount
Pretty sure you cannot instantiate synced objects
If you need more, just create a larger pool. If you need close to Infinity, then you might be doing something wrong
ok
VRC_Pickup.currentlyHeldBy is defined as a component, but what is it actually?
just try to Log that 
๐ Since it's defined as a generic value by which a lot is extended from, one can assume that it can be multiple things, so knowing the possibilities is helpful and can eliminate unexpected behavior during runtime
most developers are lazy and don't test everything
Oh yeah, that one field is weird. I don't feel like it should be a component, as the only thing we actually get from a player is VRCPlayerAPI, everything else is blocked.
So what even is that? Can you try printing the name of it or something?
Is it possible for scripts to share variables? e.g. for there to be "global" variables within your scene that any script can just access at any time?
yes. If you're using the udon graph, there's a method on UdonBehaviour that allows you to get public variables. I forget the name. If you're using Udon#, then it's just like any regular script
Ah cool, thanks.
nvm. currentlyHeldBy is not exposed to Udon
Hmm, setting default values is easy for UdonSharp scripts, but how do you do it on the node graph?
is it posible to make a "wait for seconds" with udon (no code)
yes, sendcustomeventdelayed
thanks
Do anyone know if it's possible to change the camera lense type in udon?
anyone got a foostep script I can use?
Is there a way to stop a player from pushing a rigidbody? But still able to stand on it?
is it a matter of making it kinematic?
Ideally I'd avoid that
this is exactly what the kinematic checkmark is for afaik
Strangely I can't seem to find any information on how to simply check if a player is currently pulling their controller's trigger or pushing a button on it ๐, does anyone know how to do this?
Found it, see message being replied to for an example. For anyone trying to check if the player is currently pulling their controller's trigger (or left clicking their mouse), here is how you do it:
public override void InputUse(bool on, VRC.Udon.Common.UdonInputEventArgs args)
{
if (args.eventType == VRC.Udon.Common.UdonInputEventType.AXIS)
{
return;
}
if (on)
{
// Do the thing
}
else
{
// Stop the thing
}
}
You can have an area trigger and have a list of pickups that should stay in that trigger and OnTriggerExit if a gameObject is in that list, then Drop it and teleport it back
Or be even cheekier: if the player is holding the pickup, force teleport them back into the area relative to the position of the object such that the object is retained within the area. Result is that it feels like the object cannot be physically taken out of the area. I've seen a couple worlds do this. (This is a bit more complex though)
or have an invisible pickup, that tells the visual (non interactable) pickup to move to the same location, but checks to make sure it's still in the collider. Then you can stop it from leaving, while also the player can keep walking around outside the barrier, and you don't drop the object (also a bit more complex)
Hey , im using udon graph
Im trying to convert a float value to a "mm : ss" format
Does anyone know how to do this ?
Please ping or dm me if you know
FindObjectOfType does not work and I don't want to use a name-based function or parent base function. Any alternatives to this function?
what would be the best way to keep a player from rapidly interacting with a button? I have a button for a game with the normal Interact() method, but i want to avoid accidental double clicks, so what is the best way to have like a small delay after the button is pressed before they can press it again
Wonder if anyone can help me? I have a gun system in place but when people use the second grip (Like a forward grip), it isn't synced on the other players end. Meaning on your end, you are aiming at them, but visually on the other person end, they are not. It doesn't effect damage or anything, just makes the visuals look wonky.
You can use basic math to get that format. For seconds, you can divide it by 60 to get the minutes etc
Can't you just use getcomponent or create a reference that you can assign in the inspector?
A delay between one player spamming or a delay between multiple players spamming it? If it's just one player, then create a bool isBlocked and set it to true on Interact. Also do a SendCustomEventDelayed to a method that sets isBlocked to false.
Here is a 1 second cool down script
float TimerTemp = 0;
float TimerMax = 1;
void Update()
{
if(TimerTemp >= 0)TimerTemp -= Time.deltaTime;
}
void Interact()
{
if(TimerTemp < 0)
{
DoThing();
TimerTemp = TimerMax ;
}
}
public void DoThing()
{
Debug.Log("Boop");
}
I want it to not need a ref to a gameobject or use an inspector drag n drop. That is the easy way, I want to know the actual way without needing to do everything manually
You can reference your MusicBox type directly in the editor though, not just the game object. Otherwise the only solution I know of is to use GameObject.Find.
The problem beeing is that , lets say i have a float of 100
and then divide by 60 , it would display 1,6
Which is obviously not 1 minute 40 seconds
use modular oporator? % and then floor the output?
Thats what I did for my library world with time stamps
Yeah, you only get the minute from that, which you can use to calculate the seconds.
Yeah, there are different ways to do it. For example, you can do:
var timeText = (time / 60) + ":" + (time % 60).ToString("00");
time is an int btw, that's why it works. So you could cast it yourself if it's a float: (int)(time / 60f)
That heavily depends on the gun system that you are using btw I'm guessing it just doesn't support that?
I guess so? Its just acting wack with the for grip
trying to make the for grip also synced, if I put vrc Sync on it, it makes the gun jitter
Try setting the owner of the grip on picking up the gun.
It really depends on the actual code of the gun though.
It needs to first the on the default layer
Are there existing implementations of coherent noise? (Simplex, Perlin, etc)
Does anybody know how I might go about toggling colliders with an interact script instead of a UI script?
Does OnPlayerTriggerEnter not trigger for child colliders like OnTriggerEnter normally would?
It'd depend on how you're specifically using it, but realistically you should be able to just change the input from a btn press to on interact, assuming you'd be putting the script on the object you want to interact with.
I'm pretty sure onplayertriggerenter should trigger in all the same conditions. Are you sure you have a rigidbody on the parent object, and is on the same object as the udonbehaviour?
Currently have a rbody on each collider. Think that may be the issue now that you mention it. ๐คฆโโ๏ธ
hmm. nope, that didnt fix it
that was extremely fast.... how are you testing?
I'm running this in editor right now too. Is that maybe it? I know its finicky
Client Sim
did you go out of and back into play mode?
yup yup
Well it is possible for clientsim to differ, you should try in client at least once
do you still have a rigidbody on the child objects?
i moved the rigidbody to the parent thats supposed to recieve the events
and just to rule out the obvious stuff, these colliders are set to trigger?
np, correct
and they're on a layer that collides with playerlocal?
I tried both Default and MirrorReflection layers yup
idk, could you share some pics of how it's set up?
Sure thing
parent
child ^
I've got debug logs in the scripts OnPlayerTriggerEnter overrides
I am using U# if that matters, not graph
try adding ontriggerenter debug log and throw something at it, see if it detects that
it triggered the log for OnTriggerEnter. Object didnt have a name though
whaaat
onplayertriggerenter literally comes from ontriggerenter
That's what I figured
are you sure that the script isn't crashing or something?
no errors in the console. no errors on the script
the debug log for OnPlayerTriggerEnter is the very first thing
and all I'm doing is incrementing and decrementing an int if the player is valid and is local
I'm currently on U# 1.0.1
ok what happens if you put a collider on the same object as the udonbehaviour
wait was there not a concrete answer and now y'all are doing testing?
lol, the OnTriggerEnter still fires, but no dice with the OnPlayerTriggerEntered
ill try building
๐ nope
do you have another rigidbody that is a parent of this?