#udon-general
59 messages · Page 37 of 1
Drag tha variable name onto the graph for the get node
Indeed
thanks!
I'm having a really weird problem
An exception occurred during EXTERN to 'SystemInt32.__op_LessThan__SystemInt32_SystemInt32__SystemBoolean'.
Parameter Addresses: 0x00000036, 0x0000001D, 0x0000001B
Cannot retrieve heap variable of type 'String' as type 'Int32'
I have no idea why the heck this would possibly cause an error
Are you trying to store a string of an int into slice somewhere?
Is there any kind of drawback to using Udon Sharp rather than using the graph?
@livid beacon Have you tried adding a constant integer and connecting it to the 'Set slice_counter' node instead of having the '0' be directly in it?
Udon bugs work in mysterious ways
After a while, you start getting used to a lot of them
Are there any other bugs I should know about?
Yes.
so uh question
are uh
are while loops broken too?
It's getting in an infinite loop somehow
and I've made sure to actually confirm that the condition does eventually become false
through the power of debug,log
You using U#?
no
(udon is a type of noodle)
How about the part that, presumably, increments slice_counter? There any conditionals for it or anything?
like I said, noodles is a fitting name
the purpose is to set exactly 3 random items in a boolean array to true
I've tried adding a debug.log at the end and confirmed that the slice_counter does in fact go up to 8
Been having issues with while loops aswell, so I decided to pass on them for now
Those aren't noodles. That is spaghetti
It goes all the way up to 8 even though it's supposed to end after 3...? Yeah, that's weird.
exactly
alright time to write some real shitcode
well
noodle
welp
so my solution was a for loop that loops a billion times with an if statement to only run the body if the number is less than 3
is it shitcode?
yes
Try checking ever loop to see if the int is less than 3, then assigning a boolean if it isnt, and then also use that bool for the while loop.
Yeah, what Nestor suggested may work better.
Alternatively you could set what ever the for loop is reading from/incrementing to the end value when the check fails as well
Uh question. How would I go about making interactions trigger a specific animation in udon?
This kinda doesn't want to work actually.
The animator for that object is set up like this. Transitions are actually empty, but I have no idea how to properly work with those from code..
(also the top Set isOpen is obviously on false. No idea why it set itself back to true..)
actually I guess I can do that
You would need a transition going the other way from idle and have a animation trigger that you tell UDON to make happen.
Mhm. What function is that actually? I guess I can access the animator's variables through code somehow..
And then just have it natively react to that as by transition rules
I think it’s SetAnimationTrigger
Mhm. I'll look into that! Thanks c:
You have to select animatior first
Animator.SetTrigger(string name)
Well there is no good notation for Nodes
True
Na. The other way it probably how I’m going to do it from now on.
But all of that information is bascially in
Animator.SetTrigger(string name)
as well
The this -> that way sucks
Yea
Is there a working Panorama script for UDON yet?
Kinda wanted to add some Event posters in my world.
aaaa why is udon so goddamn buggy
its is a new technology
I'm gonna try this u# stuff
That’s the best idea XD
good plan
when a user joins an instance will they be sent all the synced variables?
or do I need to code that in manually
You have no control over synced variables being...synced. I believe they'll get them all the next time they're synced normally (which should usually be shortly after they join)
Synced variables are transferred automatically.
no way to trigger a sync "early"?
Nope.
mk, that simplifies things I guess
You can detect or read synced variables changes (the 5-10 times/second) using the OnDeserialization event.
That runs for every non-owner of an object each time they receive a "sync update"
And anytime an owner is sending a "sync update", the OnPreSerialization event runs.
Is there a working Panorama script for UDON yet?
Only if you want to make it!
When will TextMeshProUGUI be added this should have come with the introduction of TextMeshPro there is no reason for it to not be there its identical
Anyone happen to know how that among us game routes the voice chat to the lobby?
Ask Jar
👍🏼
Can i make it so when the animation is done it sets the bool back to false?
So in SDK3 has udon replaced stuff like "VRC_Trigger"? Im following a simple tutorial and got to the step about making a toggle mirror and am missing components that he uses
follow this tutorial, sdk3 don't have VRC_Trigger so yeah
https://youtu.be/ibDu0dCeUE8
With the recent Udon updates, some of the basics have changed, so here's my most basic tutorial redone with the new editor, and not recorded at 2am! If I get enough requests, I'll redo my "Contextual Buttons" video as well, which will give me an excuse to just rename them "Event Buttons" which actually makes sense.
00:00 - Intro
00:20 - Udon Gr...
okay cool
I made a button that plays a animation in my world but it keeps looping the animation, can someone please help me
You can turn off animation looping on the animation clip itself through your assets
I know that but i want the bool to go false when the animation is done
I wonder if it's possible and viable to do animation events in Udon...
So Udon seem pretty straight forward coming from UE4, but I'm having an issue where my public variables look like this and i can't assign anything to them
Have you put that script on a game object PottedFox?
I've not messed with animations enough Ocublox, ill be interested in what the fix is though
Could possibly set up a small timer that keeps the bool parameter on for a bit, and then the animator state goes to the animation and then goes back when it's done
Whats a good number of batches to have in a world?
do the player audio mute/unmute cubes not work in the UdonExampleScene?
spun it up in a local build instance with 2 clients, and nothing happens with the voice audio when I try to click them
Looks correct
sorry for tagging but any update on this? im packing data in my program into synced strings currently, and sometimes it produces invalid utf16 sequence which causes the utf8 encoder to restore incorrect values once its gets synced (replaces chars with 0xFFFD). im at a loss to try and prevent this on my own
It is
Give me a few min and I can send the script I use for animations
k
is there a node to set the position of a game object? struggling to find what it might be called
yeah totally lost on this one, cant really find much info
It's under 'Transform'
@pliant spade Have you figured out the looping yet? The animation file itself has a bool you can check in the Inspector that toggles it's ability to loop.
I highly recommend using Snipping Tool in order to get clear screenshots 👍
Unfortunate haha
Is there anything obviously wrong with this? Apparently an object isn't set to an instance of an object
both variables are set to public
But have you also populated the variables with objects in the Inspector? :P
no because it won't compile and give me the fields to fill lol
do you have to set them before you continue with the graph?
The graph compiling and udon running are two completely different things
You should be able to compile any graph at all times without any errors
Well that's the issue im having, hitting compile on the graph throws an error
well thats no good
sure ill take a gif because the error icon is strobing now lol
So here's what you do
Delete your graph and remake if from this screenshot
🤷
dab
As well, you can just use public Transform variables instead of gameobjects, then you don't need to be grabbing the transform variable everytime
alright ill try to remake it lol
remaking the graph and just using transforms worked
who knows lol
Curious if the get transform from gameobject is bugged. Would be something to write a canny about.
Hey, is it possible to make custom Udon nodes, like functions I might use somewhat often?
Custom event node.
As in setting up an object with said custom function on it and then sending a custom event and information to it whenever I want to use it?
no udon doesn’t natively support that yet. If you use udonsharp there are some work arounds to do that though. You can also use nonpublic variables to set the values before you call the event.
Then use those values during the event.
Yeah, but my main point is to clean up my graph a bit.
Does anyone happen to know if sub-graphs are still supported?
https://ask.vrchat.com/t/subgraphs-nested-graphs/214
SubGraphs let you abstract out nodes from your node graph and makes your graphs more simpler, modular and reusable. How to use SubGraphs Start by creating an SubGraph asset in your project folder: Create > VRChat > Udon > Udon Sub Graph Asset Create a UdonBehavior and create a normal Udon Graph Asset for it and then add a Sub Graph node a...
They dropped it a while back while redoing things, it will be coming back just not at present.
Ah, thank you for letting me know. ^^
I just want the udon network update 🥺. It looks so nice so far.
Same, is big nice, though Dan's entirely redoing ownership, so it may be a couple more months...
Personal estimations would be first quarter 2021.
No @cunning mist
Oh hey, that sounds intriguing, where could one find information regarding it?
Why
Did unchecking loop work?
No
Unfortunate
You should be safe just using a trigger instead
JUST LEAVE
@ripe musk Again, #vrchat-general-2 is where you probably want to try
...
That was fun.
NO
Dammit Helper
Not helpful
Sorry but this is just toxic. Slightly amusing yes. But mostly just toxic.
Thanks. I guess
Like a collider trigger? Or different trigger.
I just want a button that plays a animation in my world
Use a Trigger variable instead of a Bool, than instead of SetBool use SetTrigger. Have an idle state you go out if using the trigger, than a transition out when the animation ends.
|: |
What are you running?
Nah for linux, recent build or just something you're used to?
Aww
omg
Hmm.
The world may never know
Anyway yeah do the trigger thing
I wanted him to be kicked instead. Rip.
so win-win
Darn
Figuring out teleporting players around. Seems like the essential node is Vrcplayer Api Teleport To, but I can't create that in my graph. Where did I go wrong?
Is it not under PlayerApi > Teleport To?
Hmm ok, that found it. I typed "api" to find that. But typing "tele" found nothing 🤔 I guess the search feature is more fiddly than I thought. Will have to get used to it. Thank you
Hello, Im trying to make a large video screen but even when using the prefab the video quality is really bad. How do I fix this??
also tried @cunning mist 's video but still the quality is quite bad even when set to 2160 or 4K
I haven't been able to make anything above 1080p work personally, I have no idea how to enforce a higher resolution. It seems to be dependent on your internet connection.
I have quite a solid internet connection, but small plane or big plane, 1080p or 2160p its al quite bad 😦
YTDL maxes out at 720 usually, you can't really get around that if you're using YouTube since YouTube doesn't serve formats compatible with VRC that go above that most of the time. If you host your own 4K video it might work, though you might start lagging people out if the decoder needs to work for it.
hmmm, Im trying to make a screen like in the VOLT club, how would I do that then if only 720 works
VOLT uses YouTube so it has the same resolution limitations
try using off shore links such as streamable or vimeo to go over the youtube plugin limitations ( assuming thats what you mean) @fierce verge
I will try, thanks!
@pliant spade I believe found a solution to your problem. Though I still firmly believe the best alternative would be to use an animation event.
(Had to use LateUpdate since I was already using Update for a thing)
Animator setup is just Entry to an Idle state, then if the PlayAnim bool is true, it proceeds to the animation, and then if that bool is false, it just goes back
What in the
Can anyone tell me why this trigger doesn't seem to be respawning the player?
The trigger is in the sky and is huge and thick enough that any player hitting it ought to trigger it.
And the respawn point is VRCWorld's transform, which is right here:
But the script doesn't seem to work at all.
You have the target Transform set to 'self'
You've got to double check your variables when dragging and dropping to create them.
What is Self then? I just assumed Self meant Self.Transform of the VRCWorld object.
Yes, but I meant, what is that Self object? What's it referencing? I click it but it doesn't highlight anything in the heirarchy.
"Self" in this context is your SkyTrigger object, if I understand correctly
@jaunty schooner - you want to set that to be the VRC World transform.
Right now, your graph will teleport the player to the position and rotation of the Trigger Collider
By default transform properties in udon will reference the gameobject transform the udonbehaviour is attached to.
So the skytrigger was teleporting players to the skytrigger? Hmm well, I suppose that location would be hard to tell if it was actually doing anything...
@floral dove How about their velocity? This trigger is because the world has the player yeet script. They will be moving fast. Should I instead teleport them below the ground or will the teleport zero their velocity? Or is there a way for me to zero the velocity myself?
That depends on the player yeet script. If it stops when the player touches the floor it should be ok.
I have no idea what it does, but I would have just assumed it adds velocity to them and then lets the wind take them where it will.
So you're saying a teleport will not zero the velocity for me. So I should probably zero that.
The script can continuously set the players velocity. If it doesn’t that then setting it to zero will do nothing. Teleporting should set velocity to zero.
Yeah but I see no reason for it to function that way. If they did that they'd have to like simulate gravity and such, and it would just be so much easier to set their velocity on release.
But just in case, since I don't wanna re-upload the world again cause it takes forever, I set it to zero anyway:
nothin' wrong with a little redundant code once in a while 😛
But it sounds to me like this still misses jetdog's point. If you're setting velocity to 0 on that event, the velocity might still get updated (on the next frame?) if the script is still running
The only way to be sure what will happen is to know what the script is doing. However, it does sound like a pretty fair guess that it wouldn't be updating velocity continually
Sure, and I understand that. If the players behave weirdly, I'll check that in that case.
I had a discussion with someone about that when working on my tv prefab... can confirm ytdl doesn't return good res links, but vimeo and a couple others seems to be able to provide high res videos. I tried with an 8k nature video from vimeo and it seemed to be at much higher quality in general.
Yes other services work for that, but they also cost money to be reliable or store more than a few GB of video.
YouTube splits the streams into two different ones for audio and video when you get above 720 and you need to mux them together to have it work, which the video players can't do easily
There are some youtube videos that send below 720p videos. Not sure what dictates those situations.
With avpro you can grab the texture resolution to make sure what it is.
It just occurred to me that the player velocity couldn't be being reset when I use teleportto, because if it were, then I would not have seen the players hit the collider above the trigger (failsafe) and then continue to slide along it and off into oblivion for a minute or two. So either Jetdog is correct about the yeet script controlling the velocity, or he's incorrect about it resetting the velocity when you teleport a player. I'm kinda inclined to think it's the latter cause it doesn't make a lot of sense for the yeet script to bother simulating movement when setting one variable would do, and it would sort of make sense for VRChat not to reset a player's velocity when they're teleported because there's many cases where you would want that velocity to be retained, like if you were emulating Portal.
Anyway I just uploaded a new version of Big City which is the world I have this stuff in, so I guess I'll find out if the teleporter works later this evening when I hop on!
Im sadly currently away from my pc so i cant check at the moment.
What is udon?
are the mute player cubes working in the UdonExampleScene? testing with multiple clients and the voice falloff doesn't change, fresh scene.
Can the master of a world teleport another player if they have that player's id? Or does a player have to teleport themselves?
A player has to teleport themselves
Thanks
but you can always send a custom network event to tell them to teleport themselves
I only know how to send custom network events to all or master
Yeah that is pretty much the problem
But how do you locally determine the "right" person? :P
well mixing synced vars and network events is usually a pretty bad idea...but good luck
I ended up sorting a player list from low player id to high, then using the fact that all clients will have the same players at the same indexes of their versions of that list to send players. I generate a random number from 0 to the number of players in lobby, then teleport the host if the host is the client, and the one we're sending. If we are sending the one who is clicking the even I have them teleport themselves. If we are sending a player who is not the client, we broadcast a message to all called send+index of target player in playerList which means we have 12 functions with only a different number at the end of their names. Each function checks if this client's localplayer id is the player id opf the corresponding player in that index of playerlist, then if ithat is true they teleport themselves.
The first part is true until you realize that while sending an event another player could join. An edge case, but it might happen, depending on the frequency.
If another player joined while the event was sent, I think it would just add them to the end of the array, and not change the order of the other players
Yeah there is no way to make anything perfect currently. And generally in Networking you have to accept certain uncertainties
We could put a counter, and if it is unresolved after trying twelve players, have it generate a new random player
Because would it break if they left? I guess it would try to send a message to have them teleport.
But they wouldn't get it
No if a player leaves then your ordering gets messed up
I'm only calling a function on a player if they hear an event
So if they are missing, they just don't hear it
Thats not what Im talking about
Players A B and C are number 1 2 and 3
You want to send a message to player B
So you send message to player 2
Player A disconnects
Now player B is 1 and C is 2
C receives the message because they are player two.
And suddenly you teleported the wrong player.
Well
My check is based on the playerId, not their index in the array
So they wouldn't have a match with the player we were trying to teleport
Then you need an event for every single id that might ever exist :P
That could potentially go into the hundreds
Well no
at least if you want your stuff to not break
Because I reference it through the index of the array
so I cut it back down to only 12
But thats exactly the problem
if you have an index to an array then you need to guarantee that the array locally looks exactly the same from when you send it to the remote when they receive it
and that simply isnt possible
The random number is array index, but it only resolves if the playerId's match
match to what?
Do I have to repeat myself?
If one player leaves in-between sending and receiving the message...then you get a problem
I remember that, and I'll watch out for it
It might be something I have to live with for now, if it even happens with my system which I don't think it does because no two players should ever have the same playerId
I think if someone left and another player was sorted into their element in playerList, the if statement would return false, and nothing would happen. Which would mean I teleport no one.
People are having matching player Id's on my local tests. Please tell me that's not true on published worlds lol
Every client that connects should increment the player id
maybe that doesnt happen locally not sure
On master it works as expected, but on all other clients it lists playerId 1 as playerId 2
I'll test on a published version to be sure.
It works for all but the first and second players who have the same playerId for some reason.
Anyone know why I can’t create avatar it says no asset bundle has been set
you'll want to ask that in avartars 3.0 gabe
To fix the edge case of a player being teleported while they quit, I'll have the master wait for a confirmation from the player that they teleported themselves, then teleport another random player.
Don’t be cross posting issues. The mods don’t like that XD
Also playerId isn't consistent between clients. I had problems with this before myself, finding that playerId is in fact not a good way to track players across clients.
The only way I found that was consistent was object ownership
Does anyone here know the link to the DalekHQ discord server
Thanks for the advice. I'll start thinking about how that could work.
The way I have it is an array of objects that the master will give to players as they join.
To mark them as used I would use a bool array...but we know arrays aren't synced, so I use an int with bitwise operators to encode bools as a bit in the int instead.
But, object ownership resets before onleave so clearing it is hard...
my method wound up involving also tracking the ids of the players who own them, locally un-synced, to use to figure out who left.
Networking with Udon is hell.
Does OnPlayerJoined run before, after or indeterminately of the player receiving buffered events like ownership updates?
@wheat rover no, player ID is absolutely consistent between clients. I have complex systems that rely on this.
Every player that joins will get a new playerID. It starts at 1 and just keeps going up. It never reuses numbers if someone leaves and rejoins
Huh. Well then.
You can try it out, it's at vrcprefabs.com/browse in the udon section, "simple object pool" it assigns a unique object to every player in the instance
Guess my battle is somewhere else with networking then.
By default, it will give ownership to the player it is assigned to. But there's a much cheaper mode that doesn't transfer ownership if you don't plan to use synced variables. It's great if you need some way to identify players, put them into groups like teams, or do anything interesting with voice range.
I can take screenshots of my world assigning multiple users the same playerId
Admittedly, it might have been my fault. Although I'm not sure how bad I'd have to mess up to modify a read-only value
Just do onplayerjoined > debug log player name and player ID
Where can you view the debug log while you're playing? Is there a part of the docs that says how to do that?
Right. It does unique playerIds for the master client, but for the other players who join it. Well I'll get a screenshot
There's a series of keys I don't remember, I don't use it. Usually I use the unity editor console because udonsharp has a built in log reader that automatically pulls logs into the console from whatever vrchat instance is running
If you're not using udonsharp, you can still add it to your project to get the log reader
Just enable it in project settings
Thanks, I'll read about logreader. I love udonsharp
Helps so much to do it in C# syntax
Here's the master's view
And the second player's view
So when player 2 teleports a player one, they both teleport.
Wait when you say player ID are you talking about their index in the playerlist? Because yes that's all over the place. I mean vrcplayerapi.playerid
It seems like you're just getting two references to the same playerapi. I assume this is an array, how are you populating it?
Here's my actual code, too
Onjoin and onleft I use VRCPlayerApi.GetPlayers(playerList), then I sort playerList by lowest playerId
Oop. I just doxxed myself.
By playerList do you mean the one I declared myself? Yes that is allllll over the place lol, but after being sorted it should be concurrent
It sounds like an issue with your sorting but it's too late at night to comb through that lol. What I can say for sure is that you will have a problem with "invalid" playerapis, which are players that have left. If you try to access anything about them, your script will crash. But they won't be null either so the only way you can deal with them is onplayerleft, look through your arrays and set those elements to null. If you just run getplayers again, it will not remove invalid playerapis. Which is why some people opt to just recreate the array from scratch every time a player joins or leaves. Something like
playerList = new vrcplayerapi [vrcplayerapi.playercount];
Honestly I cannot thank you enough. I was wondering if GetPlayers completely overwrote the old array or not, I'll try clearing it first, and update you tomorrow.
This is entirely personal preference, but I prefer to avoid getplayers entirely. This is what I use instead, keeping the same array and manually adding and removing players each time
VRCPlayerApi[] allPlayers = new VRCPlayerApi[80];
public override void OnPlayerJoined(VRCPlayerApi player)
{
for (int i = 0; i < allPlayers.Length; i++)
{
if (allPlayers[i] == null)
{
allPlayers[i] = player;
break;
}
}
}
public override void OnPlayerLeft(VRCPlayerApi player)
{
for (int i = 0; i < allPlayers.Length; i++)
{
if (allPlayers[i] == player)
{
allPlayers[i] = null;
break;
}
}
}```
If you wanted to add sorting logic to this, you could just do a basic insertion sort per element rather than resorting the entire thing every single time
GetPlayers probably only overwrites the elements in the array provided that are necessary. So if you have 4 players and the last player leaves it will write the first three elements of that array, but the last element will still be written to from last time. If this is the case then you should only get an invalid playerapi if the last player that joined left, and if any other player left, the last player should exist twice.
Just my speculation tho.
If that is the case then writing null to index of playercount should fix that
That sounds correct, but also jank like that is why I don't bother with getplayers haha
Well the intention was to avoid allocations
which youre not doing when you create a new array every time
The question is: Does it really matter...
Yeah I can see why they didn't make a method that returned a new array every time, it's better but also if they're not clearing the null elements that's problematic
When I do it, I'll keep the same array and just assign/remove players from it
Well you cant do that easily
Why not? That's what the code I just posted does
The best algorithm for that is "null gapping" which just searches for the first null element
Worst case the lobby is full and one player leaves and reconnects constantly
in which case you have to search the entire array from start to end every time
ofcourse in this use case thats neglectable
That's a whole lot cheaper than re-assigning the entire array every time
Yeah. Just saying that its not a solution that will work in all circumstances.
But probably most
Especially in Udon
And also that will completely jumble which player joined when
So if that is important then you need another method
If you need sorting, you add an insertion sort to that. If you need cheap, that's already cheapest. Not sure what situation it wouldn't be best in
That code you posted will also fail to track any players that joined before you.
No it doesnt
No, when you join you get spammed with a bunch of onplayerjoined
thats the lovely part about OnPlayerJoined
Since from your view everyone is joining you
As there is no "host"
Oh.
That's kinda stupid honestly
You are joining a lobby, though.
Yes, there is a lobby.
The lack of a central host doesn't mean there's no lobby...
VRChat works on a P2P-based system
Everyone is connected to everyone through a middle man
You still need to instantiate their player objects in your client. At some point, you need to receive the message that they exist. And that message is onplayerjoined. Maybe that's not the best name, but it is very useful to what is actually happening
I think its a good name
OnPlayerStart would make more sense as a name than OnPlayerJoined then. Oh well.
The player joins your view of the world
In fact
you can join an instance without other players joining you. In case they are on a different branch.
You will technically still be connected to the same instance over photon, but you wont receive any of the player controlled data.
Since you are on different network builds
Is there somewhere a code i can copy paste for a udon code for playing a viseme anim when a button is pressed and when its pressed again the anim is played in reverse
@me when answering
I have made an udon behavior and inside the behavior I have a non-public bool variable. I've set the default value to true, but when I repoen the variable file, it sets the default value back to false, this is incredibly frustrating and I've had it happen multiple times, with script variables, and also boolean node boxes inside the script logic itself, anyone else experience this?
it's also not saving my preference of sync type either, reverting back to none
I dont know what I'm doing wrong. But I'm trying to set the Voice audio of a single player to be heard by everyone in the world not that large. But for some reason its not working
It doesnt seem to be doing anything and you can only hear them at the default distance
While I haven't played around with this system much myself, you'll likely have to set it up to be global, as right now the system is just telling you to play your own voice further. As to how you would network that I'm not experienced in getting a player variable globally.
why do my reflection probes turn black when i bake em ?
For posterity, the in-game command is right-shift+`+3, but it requires the paramters --enable-debug-gui and --enable-udon-debug-logging in the launch.bat file for VRChat.
Damn, how does one escape backticks...
Got it. wew
Hey there, so I'm trying to play a YouTube video on the VRC Unity Video Player component, but I notice it doesn't play at all when the map loads.
Anyone know what might be wrong?
Hmm. I’ll play around with it.
It won't play YouTube URLs but videos from self-hosted sites seem to work.
@normal yarrow seems fine, have you tried using the example prefab in the vrcsdk examples folder?
Yes
hmm, tried other video links?
it may be a url that is blocked or requires payment to watch
try a different url and see if work
Hm.. tried a different one and got the same result.
same errors too?
Yep
and youve uploaded this world to vrc and got the same problem? (just making sure if it needs the server or not)
I've done build tests and it didn't play there.
well usually what ive seen causes it to not play is because it needs the server to pull from, but testing and playing it in unity will obviously not pull from a server
so if it works when its uploaded, then that was the problem, if not. it may be either the link or the video player not pulling anything at all
It's weird cause I can pull and play videos from my own site (server hosted elsewhere)
ah, so try streamable.com
I would but videos won't stay there forever.
with the same video, if its less then 10, you can just convert
YouTubeDL does not exist in the editor, so you cannot resolve any URL's that are not direct links to the files
streamable links stay for 6 months
Ahh
that is correct as well
Is there a way to incorporate it to the editor? 🤔
unless you have the plugin in unity
For VRC, yes if they wanted to. For you, probably not easily without breaking TOS.
Hm.. so I got no way to really test this on editor.
That's unfortunate.
Oh well, guess I'll have to host it off my site.
well i mean you could test if th uploaded world method works
I could do that but it would take forever just to test one video.
this error even shows with merlin's video player after filling out the playlist url field for that reason, works fine ingame :P
Messed with it and it still doesn’t work. I doubt it’s bugged as a few other worlds do this.
I'm following the tutorial for running the UdonExampleScene. The VRChat client is not launching when I press "Build and Test"
I notice that this doesn't seem to work in VRChat, is there a way I can have music have reverb to them?
@normal yarrow you need a zone
A zone? Hm..
and make sure it has "audio listener"
Alright.
How do I properly set up the min and max values?
Do I just max it all the way around the whole map?
you also need the filter
Got it now
you need both if its for player audio and off shore audio
then move the zone by the entrance
(And microphone speaking, but I can't seem to get that done right now since VRC_PlayerAudioOverride doesn't exist for Udon)
Oh wait, so does this zone only need to go over the audio source object?
Well it works now using Steam. VRChat client would not launch with Viveport.
it needs an audio source, from what ive see, and override should work
? ive never used the script, just the traditional unity way of doin it
Ah
add the audio listener to the cam, and bend it to your will via that
Hello! This English has been translated. I pray that it will be translated correctly. I’m sorry if I’m rude. I enjoy creating worlds with VRCSDK3 and Udon. But there is one challenge. I’m considering using the VRC_PlayerAudioOverride component to establish a conversation between two people who are too far apart to be heard. However, I can’t...
ahhhh, yes, i belive it still works
I was gonna use this so that if you're holding a microphone, your voice will project throughout the whole arena, and also therefore reverberate since it would come from the same audio source as the entrance music (ideally),
so it was added, i see what you mean now
Or at least an audio source right next to it.
lemme send you something you can tinker with
Sure thing.
you have messaging blocked
but theres a player audio chnger called " better player audio" and it works with udon, its worked for me for worlds i needed players to be heard accross the room (very big rooms)
I have two questions and a report
- What units are
velocitymeasured in? - Is there documentation where I could have just looked up the answer to that, and the answers to other specific questions about nodes
Oh hey Joker, lol
Hey Pablos!
Nice seeing ya here 👍🏽
I see you're still making wrestling stuff 😄
🤷♀️ do whatcha gotta do
yeah, learning Unity is why I'm here too 😄
It's definitely worth it.
anyway, let's save the chatting for in-game, I'll DM you my profile-- Back to on-topic:
I have two questions and a report
- What units are velocity measured in?
- Is there documentation where I could have just looked up the answer to that, and the answers to other specific questions about nodes
Sure thing.
and the report is: The "Searching for nodes" link on this page is broken:
https://docs.vrchat.com/docs/udon-node-graph-upgrade
It should be linking to here https://docs.vrchat.com/docs/searching-for-nodes but isn't
Hmm ok, this kind of answers me
A velocity in Unity is units per second. The units are often thought of as metres but could be millimetres or light years. Unity velocity also has the speed in X, Y, and Z defining the direction.
But I think to be precise the answer would have to be specific to VRChat, right?
Same with my more general question about docs. A lot of the particulars about nodes in Udon are going to be unique to VRChat, aren't they?
I think so, but I haven't screwed too much with Udon stuff yet.
Anything related to players and networking will be vrchat specific, yes. But rigidbodies, transforms, rendering, that's all unity
Well there ya go
how does the gun grip work for pickups?
You will hold it with x forward and z up
also hi phase lol
mine kinda freaks out I'm not sure, what do I need to do to set the actual location of where the grip is?
gun grip also does not allow you to turn it in desktop
Assign an empty gameobject to the gun slot in the pickup
and then just move it to the grip?
I'm using a trigger collider to add some velocity, and it seems inconsistent. Sometimes it adds, sometimes it doesn't. Anyone offer insight why?
I rotate it on the x axis -90 degrees to get the z axis facing up and x is still forward correct?
Setvelocity is very unreliable if the player is grounded and the value you're setting is low. It might be more reliable if you set 10 or if you try setting velocity every frame until the player is ungrounded
Normally z axis is forward but if you're coming from another program like blender that entire concept is thrown out the window so I have no idea what the forward axis of your particular model is
3 (90 days), unless account is paid which is ~60/year
ayy got it thank you phase
@unborn hornet i saw on their thing it said 6 months, i must be going crazy then
How should I detect when a player becomes ungrounded?
@dapper lion
guess i was crazy
If you have the player, it's just a property, is grounded
It seems like OnPlayerTriggerStay will be using more CPU time 🤔 am I right to think that?
I went with this, but I don't love it
It's checking the state of every player that's colliding, every frame, right? So at some large scale (lots of players, frequent collisions), could this be adding up to perf loss?
Uh what do I need to make an interact-able button? I tried using a vrcpickup component with pickuppable turned off, and - as I peeked into a Vowgan video out of frustration - without literally anything but a UdonBehaviour that does have an Interact-Event in it's script.
Really just this little black cube object there. Click it, get stuff to happen.
nothing fancy.
Similar to Update/LateUpdate, it is called for every frame that the player is determined to be within the trigger area.
Right, so wouldn't OnPlayerTriggerEnter cost less CPU?
I'm trying to figure out how to swap a Render Texture to a different one, and I'm new to Udon, oof.
Yes
I don't think I'm doing it right at all
Enough less that I should keep that in mind, or am I just being obsessive? 😛
Down side is that there are rare conditions when lag may occur which a player might pass through the trigger without having a frame of being registered as being within the trigger zone. So take care to be sure that the zone is large enough for your use case.
(though that applies to trigger zones in general, just a head up tip mostly)
Make sure you have a collider on the object that has the script with Interact on it. Otherwise what you have should work.
Uh evidently I did the big dumb and didn't link up the script.... sorry for the premature and unprofessional intrusion? :x
Okay I cleaned it up a little bit. Anyone know how I can achieve swapping render textures through a toggle button?
No worries, little things like that can be overlooked sometimes.
You'd want to have a bool or int flag to track the state and Branch based on the state after it's been changed.
Don’t mind if I could get that also?
sure lass
Okay, so I got this to disable the sprite and animation, however, I notice that it only resumes the animation and doesn't restart (it does restart when I manually disable/enable the animator in the editor)
@unborn hornet
Ok nevermind I just disabled the whole gameobject and that works instead.
@void ridge If you don't want to use OnPlayerTriggerStay you could do this
Teleports the player up a tiny amount before applying the velocity so being grounded isn't an issue
I want to know how to make a simple time delay , anyone can help me ?
Since Udon runs on the main thread synchronously you have to test a condition every frame.
The best solution is to have a boolean and a "EndTime" float variable that you set to Time.time + delay.
Then in Update you test if the boolean is set to true and if Time.time > EndTime and if so set the boolean to false and trigger your stuff.
Thank you 🙂
ok is there a place where i can dl udon code thingies ?
i kinda want one that toggles between animations i made...
door open / close
i have no clue what so fucking ever on how to do anything
If you're thinking you can find a way to have a door that's pre-configured: it's kind of possible, but you're gonna need to have some idea of what you're doing to connect everything up. Recommend watching some tutorials and getting an idea. Vowgan's are easy to follow https://www.youtube.com/watch?v=Bw4uvjrvdbU
Probably been answered multiple times before, but I don't know how to search for it: Are there already Udon prefabs that mimic all the triggers available in SDK2? I'd like to upload a world I bought from booth on SDK3 in order to future proof and save time later. Plus I could dissect the prefabs to start learning Udon while being able to have my world made public in a timely manner.
It doesnt have all the triggers but i put this together for common requests and examples for people to learn.
This also shows the node equivalent for the sdk2 triggers. https://ask.vrchat.com/t/vrc-triggers-udon/196/3
Actions AnimationFloat copy&pasteAO2YXW8bRRSG/0o01zvWfH9YykVpGxSBANHWNyiy5uNMWFjvovU6YKX5ZVzwk/gLjO14G+JtWUKCXLWKFdnyen38nHfe8878+fsf1+jKVStA0x+uUVpV1TdukV+gN3XZrV/Wl2UNz+py4bqmncznr6A7qxrX5WfrZQeLV11b1pf7F/lpBfu3Zk0ZUYFW+f8UJQFKGhZxNFRhobjCJsaEBQfmGTWcW5Uv/qVZll3Z1Gh6jX5DU2rIhBRojaZYmAm5KVDdRHhz/mKZq0U2iQTKM8wcy3cK2mKnrMdBBgXB0qCVf0vyXcFo4l...
@void ridge i kinda have no clue how to do ANY thing in the udon graph
and he just shows "its this"
and some of the things he has i cant get for some reason
@verbal socket what you need?
a udon graph where when a button is pressed an animation plays
for opening / closing a door
sorry bud, dont have something like that
@verbal socket you want something like a bool variable in the animator to switch between the two animations. then you would use the Animator.SetBool to make it open and close.
PC build but every time I upload it says it must be under 50 Megs....
Is there an easy way to locally sync a variable across alike udon scripts?
The simpler way is having a shared reference to a common data container. Otherwise you have to set it on all of them individually.
Yup that is just what I was going to do next. I was just wondering if there was an alternative method that was built in to do that. Thank you ^-^
Checking my understanding on this: is this the best way to handle gravity for a World? This is the graph component of my VRCWorld object. I just added on a Set Gravity node.
Or is there some better designed way for handling "global" gravity? Maybe something that's referenced for objects, too?
that just sets the players gravity.
Right, so do I have to also set the default gravity for objects somewhere, in a similar way? Or is there some more central place where gravity is controlled
Is there a way to force avatars on players upon world entry? Or maybe the player has to be standing on a player square and their avatar is force changed before the game starts.
Lookat Physics.gravity
physics.gravity. sets the scenes gravity for rigidbodies. https://docs.unity3d.com/ScriptReference/Physics-gravity.html
Jinx!
So is that a yes? Or are you just saying, this is how I change gravity for objects
And I still have to do them separately
its for the whole scene just have to do it once.
OK, because players count as rigidbodies?
Well...
only when not grounded.
Welcome to VRChat development. Players are weird. Especially when it comes to physics interactions.
im not sure why discord keeps trying to reply when im not wanting to. rip
I also want to know the answer to this question 😛
They change from rigidbodys to non rigidbodys?
vrc uses the rigidbody for gravity when the user is falling/not grounded. when you are walking on the floor you dont need that on so they probably set it to kinematic.
for force avatar stuff you can call the setavataruse on a pedestal during the start event but players can just switch back after. and most people will stop visiting your world.
people like using their own avatars.
Mostly because you cant temporarily set an avatar or restore their one
Is there a way to read what avatar someone is using?
In such a way that you could enforce certain conditions if they are/are not wearing a certain avatar?
not directly. there might be some funky work around but nothing reliable.
Users avatars and your world should be as seperated as can be
Maybe just a height range? I know in Laserdome they want a height range. I assume they just use the honor system, which kinda sucks
You can somewhat calculate a rough estimate but its kinda jank
How separated avatars are from World is a design question, seems to me it should be up to the designer 🤷♀️
you can get information about avatar bone positions and rotation. laserdone requires a specific setup due to this.
on the subject of jank, is there a system for me to determine who pushed a button in Udon? Like if I have a udon behavior on a button, is there a way for me to get the vrcPlayerApi of the person who pushed it?
I think its a design Philosophy enforced by VRChat. I might be wrong but there is a lot of indication that thats the case.
mainly depends what you are trying to do.
I have a button near spawn that when pushed, sets immoblize to false
that, or I have to use a particle effect and I'd really rather not do that
immobilize can only be set by the local player. not sure why you would need to know who pressed it.
no, you can set it via script
I need a button to re-mobilize someone who got immobilized
unless there's a manual command in-game? let me look at that...
If I'm setting Physics.gravity, when should I do it? Is there a good/conventional spot for "instance initialization" stuff?
other then a networked variable to target that player there is not really a easy way to do that at the moment. for freeze tag i have each user own a object then send a networkevent to the owner to freeze and unfreeze.
you can do it on start. or do you want it to be changing while in world?
For now, not changing. Where is Start? I see it in the VRCWorld graph, but is that called every time a player connects?
there's an onplayerjoin trigger event I think?
it the first event that gets called when loading into the world. its local.
Are there any known issues with audio sources looping despite them not being supposed to?
OK. So maybe this is a deeper misunderstanding I have. Physics.gravity has to be set locally for every player that joins, even though it's referenced for stuff that isn't that player, like objects and other players?
And is this how all variables work?
im trying to think how to explain this simply cause this opens up a large can of worms.
Do udon variables need to be public in order to be read from another udon script? I would assume this would need to be the case for proper scoping
vrc is a peer to peer system there is no central server for the instance. for syncing its players sending information to each other like positions of objects they own. so potentially you can have one player with regular gravity and another with 0 gravity. if the player with no gravity owns a synced object the other players will see it in 0 gravity. and the same in reverse.
the public option is just for displaying in the editor from my understanding. you can set nonpublic variables i think.
OK, hopefully the last question I have about gravity for now. How does Physics.gravity interact with VRCPlayerApi.SetGravityStrength? Will one of them override the other if set?
ive not messed with both at the same time but my assumption is the players gravity is physics.gravity * vrcplayerapi.gravitystrength.
in a old world in sdk2 i reversed the gravity so players would walk on the ceiling.
That’s cool
it should still be public was called no floor chat.
(thank you for your help jet)
I need help with my vrchat framerate,it is super stuttery. I can play the game but the frame rate makes it unbearable,i tried looking for answers by watching videos and searching on google and reddit but nothing seemed to work.i tried lowering my resolution and still nothing changed. Please help
This question belongs in #user-support-old or #vrchat-support. I think it's also answered in #faq
How do I change graphics settings for VRChat?
Holding down Shift while launching VRChat will bring up a configuration menu where you can adjust the graphics quality. Additionally, you may want to consider using the Minimum Performance Rank Display system and Dynamic Bone Limiter systems, available as a button in the top-right in the Safety tab of your menu.
After testing it, you seem to be correct. The public options seem to just make it visible in the editor
Okay, so I made a system to toggle an entrance tron, however, I need to now (somehow) get the one video player I have to toggle visibility, load a pre-determined URL, and play the video. When that gets disabled, it should stop the video and then disable visibility.
Looks like this works locally. I added a sort algorithm and all clients have players in the same elements of their playerLists. Thanks again.
🤔
do you have allow untrusted urls on? and you probably want playurl instead of load url. the video hasn't loaded when you are doing play. playurl will auto start it when it loads.
I'm doing this in the editor
are you using the unity or avpro video player then?
Unity Player
the playurl should fix it for editor. if not they i would try a test build to see if it works.
might not be working right in editor.
I'll do a build test and see if it works there.
when it comes to vrc components i dont trust the editor for testing.
Hm.. no, it doesn't play in the build test either.
The other tron graphics do play though (but that's because those are animated spritesheets because video player limitations)
you can put in a debug.log to see if the right methods are being called.
Where can I find that?
Ohh
wait
Yeah
I see what you mean now, lol.
Ok for some reason now my mouse is automatically dragging the udon graph screen, oof.
Gonna relaunch Unity
Okay where do I attach the log to?
i would put it in front of the stop method and playurl method. then you can attach a constant string to the log obj to print which one is being called. this is to make sure that things are firing correctly in the code.
Like this?
ya that works. then you could put "should play url" for the string.
Welp, nothing happened.
Also for some reason when I press the button, the editor game just pauses itself.
looks like you have an error causing the problem. click the red icon on the top right of the image.
Thank you very much! I figured I was asking a big question, but I really appreciate it!! 🙏
im assuming you have the video player referenced.
why do you have them set to synced?
So that everyone can see the trons change.
thats not how that works.
oh
that is for syncing variable values like ints and floats.
Oh I see
these are the only variables currently able to be synced.
Was the syncing causing the issue?
i wouldn't think so but maybe.
ya but it should work fine.
For whatever reason, it isn't.
I want to say its the editor not playing nice but you were having problems in game as well.
the editor could not be playing nice with the component but when you did a test build the sync variables broke it.
could try another test build.
do you know how to open the debug log?
I check the console?
for vrc.
No
That opens it up?
Nice
you will be able to see the debug.log message and if there is a error.
not really a question specifically about udon but i want to create a small forest scene and have the foliage sway to simulate wind. how would i go about doing that?
usually a shader or speedtrees.
😔
are you disabling the video player at all? or have it disabled at the start?
I have it as a child to an empty that gets toggled as enabled/disabled
So all the trons get enabled/disabled together.
that might be the cause. if you are calling the events before the component gets initialized could cause the problem.
i would personally keep it outside of the objects being turned on and off. then you just say to play and stop when you turn on and off the objects.
Ahh I see.
I'm really new to all of this so I would have no idea how to set that up.
would basically what you have now but you drag it out of the empty parent that is being toggled.
Ohhh I see
The only thing is, the reason why I have it disabled is because I have a picture that would be there if no video is playing.
you can separate the screen and the video player. so the screen would still be with everything but the video player component would be out.
do we know when sync animation will be available ?
Welp, yep, that worked.
Hm, now I need to figure out how to change the default color of the video screen to be black instead of white.
also i noticed that my mirror/avatar toggles, etc dont have the blue laser anymore when u point at it. is that just how it works with udon worlds now or did i forget something
Just a shot in the dark, since I know it's something I'd need to work my way up to attempting, but if I wanted to have a system that can save a players progress in a long duration RPG world into a code that you could copy/paste into a UI bar.. I saw something hinting at that idea, but is this possible without causing excess overhead?
I know I'd probably have to set points that the system would save and generate some numbers for.
But ideally, it'd be something random so people couldn't just cheat their way through if they figured out the pattern.
i dont know when sync animations will be available but you could potentially make your own. for the laser usually that if for pickups. dont remember seeing that for buttons.
yes it is possible but you would have to code it your self.
You think it could still randomly generate the "progression code" so that they'll be unique but still functional?
two ways could do it. based on the users display name it could jumble the code but it will break if the user change their name. you could also just make a encoder to make it harder to read.
OH! I forgot about seeing the world being able to read usernames!
it cant be completely random cause you need to know how to decode it.
That's a good idea.
It breaking if they change usernames isn't of too much consequence.
Thank you!
So i have a pickup item that's only changes client side, is there an easy way to make it server synced?
add a udon behaviour and click this.
its provided by vrchat's sdk.
yes cause you are telling it to stop. you would need to pause it then play when you turn it back on.
Right but I want it to restart when toggled back on.
im not sure what you are wanting then.
Basically toggle button to start the trons and the video, toggle it again to turn it off and reset it to the default tron pictures.
These are the default tron pics
ya that can get a bit tricky with the unity player.
Toggling the button will then play all of these
The giant screen would display the video player stuff
i would personally swap materials for this. so you would have to make the video player render to a render texture. put it on a material and set the materials needed when playing and not playing.
oof
thats terrifying
...yeah
I pretty much did it for these since these were 2D spritesheets
ill try there
Well, the entrance tron spritesheets are animated, so those needed to be spritesheets.
there should be a link on the github.
why not just use the spritesheets on the objects?
Okay well if now the video player is going directly to the render texture, I now need it programmed to show that RAW logo when no video is playing to the render texture.
What do you mean?
you are using a camera for the spritesheet animation. why not just apply the material to the objects you want to have it on?
you need a sprite sheet shader. who are you doing it for the camera?
If I use a sprite sheet shader, the emission goes bye bye.
And I need that emission to make them look like lit up LED boards.
another option is code the tiling and offsets to animate them.
a custom shader would be better but im assuming you dont know how to make one.
I do not.
the cameras are going to hinder performance a bit is the problem.
oh
Welp
I wonder if this will work
Is there a way to change your avatar without the VRC avatar pedestal?
Like you click a gameobject and it swaps?
Ahah! I figured out the video restarting issue.
😎
Makes way more sense now that I look at it. @raven peak
👍
Now I need to get the default video screen color to be black.
BlueprintID? Isn't that savefile scumming?
Upload with a file, and then try to upload the world again with a previous version of the same file?
I'm not sure.
I want to create a virtual barber shop world where anybody could sculpt custom hair grooms. I wanted to export them as FBX but there seems to be no way of using local / remote storage from udon. I noticed that in VKet you can have a button that pops up a browser window for a specified URL. Is this functionality accessible through UDON?
bro that is illegal my friend
same thing with 360 video players currently
@scarlet lake best thing you could for that feature is just putting a link in a type spot, and set it to copy
otherwise youd be heading towards the "no, dont" town
wah?
thanks! @dapper lion . i suspected that was VKet specific feature. I know there is no way of calling REST api from udon but through that button i could encode a fair amount of data in url itself. and then convert to downloadable FBX on server. sadly, having a copyable text field seems to be the only way to transfer data from VRC into real world.
correct, but yo can technically make a copyurl thing ive seen others do and the user just simply pastes in the link
that seems like the best option. ill google how to do that
video players are local you have to sync them yourself.
I see.
The other trons that were just spritesheets also didn't pop up either on the other client.
there is nothing "illegal" with 360 video players
any way to set the velocity of a game object using udon? I know there is bust i just dont know what the node might be called lol
What makes a GameObject move? The Rigidbody Component. So its a property of the Rigidbody. (Rigidbody.linearVelocity)
how exactly would i go about getting a reference to the rigidbody of another game object in the scene? Basically im using a button to teleport and reset the velocity of something that's floating in space
you can't drag a rigidbody into a public variable, and I couldn't seem to find a way to dig into a GameObject to find its rigidbody like you might do in unreal or something
but its possible i just don't know the right node or something
That happens most commonly when you have multiple pipeline manager components in the scene (searching with t:pipelinemanager in hierarchy finds them)
You can also import this and check VRWorld Toolkit > World Debugger if you are having trouble finding them
https://github.com/oneVR/VRWorldToolkit/releases
ah nvm, i forgot about GameObject.getComponent
You have any bigger trigger colliders aroynd the pickups that can't be picked up?
No triggers, just a button
I can pick them up just fine
But other people can't.
Non-masters?
They render, other people can see me shoot them AND their projectiles. They just can't pick them up.
And they aren't on desktop vs vr or something?
Are you on desktop?
Yes
Well that could still be some big area collider trigger you have in the world
Empty?
I created an empty
The mesh, grip, and spawnpoint are parented to it. The empty has the pickup script and udon script, rigidbody and whatnot
Shouldn't really change much as long as you have the collider and vrc pickup on the same object
I mean your picture looks alright and since you don't have any trigger collider I can't think of any other causes really
I can pick it up when I test build with two clients
Well both of those are desktop users so to be expectes
I can't exactly test it since I don't have VR. This is meh.
Can something be too small for VR?
I mean most likely but that doesn't seem too small
I moved the buttons and the whole table up some
AND doubled their size. Now to upload and drag a friend with VR into it.
Yeah, it was the size of the snowballs.
VR apparently doesn't like things that are too small
i think i am dumb cause all of a sudden all of my objects that i had sync posistion on for my worlds are being hella weird
and not working
did i miss an update?
I just realized that the reverb is applied to every audio source, oof
Any way to fix that?
I want to generate a bunch of random values when an instance is first loaded, and keep them synced for everybody so long as the instance continues to exist. The closest answer I've found is this:
https://ask.vrchat.com/t/getting-instance-id/501/5
Hmmm… you could generate a random value at start and write that value to a public, synced variable. You’d need to set a “worldGenerated” synced bool that would tell anyone that joined afterward that the random number has already been generated, so they don’t need to generate it again. That way you get a random value that’s per-instance. I’m kin...
I know how to generate a random values. What I don't know is how to do them as part of "initialization," such that it only needs to happen once.
I think I'm just still lacking the basic understanding of when and how to synchronize data. If there's a good guide for that I'd love to see it
Have all the values be set in start, but only if you're the object owner. So essentially...
private void Start()
{
if(Networking.IsOwner())
{
Synced Value = Random Value or whatever;
}
}```
@void ridge
For synced variables, the person who owns the object is the only player who can even modify the values of synced variables.
Thanks for being the person who answers on Christmas Vowgan 😄
I wrote that in U#, just imagine the first If statement is just a branch
No worries, just hopped on my phone for a minute lol
yeah, I think I get the jist, though I haven't used U# and have only learned a tiny bit of c#
I'm still sort of confused by this
I think I get that udon behaviors are always attached to objects. And I understand that networking is peer-to-peer and objects have owners on the network. But why limiting something like this by owner equates to initialization of an instance? Seems super weird to me
I'm also not totally up to speed on how Start works, but I can find docs for that part.
Synced values are set to anyone, so only one person needs to set them. Start also only fires the first time that the object exists, so you don't need to worry about it happening more than once.
Start also only fires the first time that the object exists
define 'exists' 😂
The first time the object thinks about itself, essentially. Technically it happens about one second after the world loads, but it never happens again unless you've spawned in that object again, then again synced variables don't function on instantiated objects as you can't network instantiate, so that's an entirely different thing.
Do you know about execution order joker?
Yes, execution order I understand
execution flows start with an Event, and anything that needs to operate on memory fires one at a time, in a pre-defined order. In Udon, that order is controlled by the in/out execution ports. And Block nodes are special and weird and I'm not sure why they're not redundant 🤔
I was talking about the unity execution order. https://docs.unity3d.com/Manual/ExecutionOrder.html
Ah you already grabbed it
Its the order of events that happen per frame.
Right, got that
Block nodes are a bit funky, but they're important for wanting to do multiple Branch checks in the same event without relying on it being true or false to lead into it.
I can respect funky.
Start is only ever called once for a given script.
This I understand. I think what I'm missing is deeper, meaning, when does a script run and what causes that?
When the script runs is dependent on the event being called. Update/LateUpdate happens once a frame. Start happens as soon as it exists. OnEnable happens whenever you enable the object, and the inverse with OnDisable. Interact happens when you click it, so on and so on.
OK, so for an object that is included as part of the initial state of a scene (i.e. not spawned in at any point), Start fires when the first user loads the scene.
And then it doesn't fire ever again (unless it's de-spawned and spawned again)
These are the official info for the start event. https://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html
The event start gets called once locally for everyone when the scene first loads up.
All events are local unless you send a network event to have everyone do the event.
OK, that's what I was afraid of. So if I'm using Start to generate a random number, then without something more, it sounds like it's going to try to generate a new number each time someone loads in. But that can't be right.
That is where the ownership check comes in.
When a new instance is created there will be a master of the instance (first person in there). They will have ownership of the generator so on start they will generate the number. Then using a synced variable when new people join will get the value of that variable.
Right, only the person who owns the object can even set it, so having a branch check Networking.IsOwner before you set those values will give you identical values for everyone.
What about ownership transfer? Is it just that there exists no possible scenario when a user is first given ownership of an object and then executes Start?
other than the scenario of instance creation, i.e. initialization
What are you trying to do? That would require you to take ownership then do the start event?
Oh, no, I don't want that. That just sounds like the thing that we need never to happen.
I want to generate a random number when an instance starts, an then keep that number in existence and synced for all users who may join, until the instance closes.
Have a synced variable this will be the random number to sync. On start have a branch with the network.isowner as the condition. The set the number to something random if true.
What I'm hoping is implied in Vowgan's solution is: when the master player leaves and ownership of the generator object is transferred to a new master, that new master couldn't ever go "I own this now, and I'm gonna fire Start"
nope will be fine.
No new players will ever on-join become the owner of the object. Even if you literally set them in Start to be the owner, ownership transfer takes a frame and can only be acted on during the next frame.
Yeah you'll be fine.
As long as there is a person in the world with the synced value it will be the same for everyone. The only time it will change is if everyone leaves and rejoins. Cause there is no one left in the instance to transfer the number.
But then a new number will be generated.
Right, that's the intended function
OK, I think I know what I need to know! That is, Vowgan is right, but now I know why they're right 😛
👌
Closing thoughts:
- Thank you both a ton for helping me out during your xmas afternoon 👍 🎉
- From a newbie perspective, this seems like an inelegant solution to what I might overconfidently presume is a somewhat common need. I wonder if this could be feedback for Udon.
Seems like not the rarest thing to want to run something at instance start, make some decisions, and then save the answers for the remainder of the instance.
I got nothing better to do at the moment. But i cant think of a more elegant solution other then more settings to sync.
Again, newbie--this is probably ultimately just a result of some larger architecture that I don't yet understand. But in any case, it seems to be within the scope of an SDK to make things like that easier 🤷♀️
Even if it's just to modify the VRCWorld prefab to include some easy spots for "stuff that runs once and only once for each game instance, right at the beginning"
Syncing will be getting a upgrade hopefully first quarter 2021. most of my projects are waiting for it
While it might look clean for the users perspective about the same thing would be going on in the background.
this is software. I thought looking clean with a mess under the hood was the name of the game 😏
"This is software" meant to be read in the tone of that one scene from 300 ("this is sparta")
bumping Pablo's question since I derailed it otherwise. only polite 😛
Usually happens when you have a filter on a audio listener. Let me look back on the question.
Are you using a reverb zone? The audio source has a option to bypass effects like it.
It shouldnt affect player audio. Unless they changes something i didnt know about.
Got a problem uploading my world, its not necessarily 'udon' but it is 3.0 and does use very basic udon stuff like light switches and such, tried uploading it (Again because I've already managed to before) and the first strange thing I noticed is that it was named 'unpublished world' the upload menu, after clicking publish and waitin a couple months I got to the uploading ui and the worlds thumbnail and name had been reset as if it was a new other world, as well as this I also couldn't even click the upload button...And I also got this in the error log:
NullReferenceException: Object reference not set to an instance of an object
VRCSDK2.RuntimeWorldCreation.Start () (at Assets/VRCSDK/Dependencies/VRChat/Scripts/RuntimeWorldCreation.cs:82)
This is making me unable to update my world from this point on and the weirdest part is, I tried doing this again but before publishing I put everything under a gameobject and hid it (Hid everything basically) and when I had the publish UI it had its name and thumbnail as usual but I did not try actually clicking upload cause I didn't want my world to be stuck as an empty space
The only thing I can think of that I changed in this version of the world is some lights and I added an object but nothing that crazy
Could it be that Udon does not support syncing strings that contain 0-bytes ("\0") in them? I'm getting this absolute banger of an error message, it doesn't stop, but it also never syncs:
It does affect it, yeah