#udon-networking

1 messages · Page 18 of 1

outer crater
#

Hello. Everything was working great so far (figured out how to set up the StringDownloader and send GET requests and receive a response). But I just stumbled upon a problem. You cannot modify VRCUrls in code at runtime?!! For example, I have a base VRCUrl like

"https://<your-app>.herokuapp.com/predict";

and I want to add some parameters at the end based on the song selection by a user. string

finalUrl = baseUrl + "?song_id=" + currentlySelectedSongID;

And it wont let me do the following:

VRCUrl urlObj = new VRCUrl(finalUrl);

It is fine, I guess, since I am working with a limited set of songs (so I can simply hard code all the URL options), but generally, I was thinking about implementing this in the future with any song people want (specified by a url) and I guess this makes it impossible to do that. Are there any workarounds? @lone zealot @finite sequoia @twin portal

#

I was thinking that maybe using VRCURLInputField could offer a workaround, but I am currently clueless

twin portal
#

The only current way to create URLs at runtime is by using a VRCUrlInputField

#

Yep lol

outer crater
#

Ah. Can you explain the process?

twin portal
#

You set what you want the URL to be in the box, then all the player needs to do is click it and send it, essentially

outer crater
#

Can you trigger it remotely (withotut the player clicking it)?

twin portal
#

Well... I think so, you can set it, and then immediately get it? With the two functions listed there

#

Haven't used them myself

#

Oh no wait you can't just set anything you want

#

Remember VRC doesn't like data going out. It's a security and consent thing. The player needs to have control over what URL is about to be loaded

#

But if you have a finite amount of songIDs, you can precompile them before runtime

lone zealot
silver hill
#

So Ive come up with a concept of an NPC enemy health tracker that would allow numerous people to be damaging it with high rate of fire weapons at once and it would be able to reliably keep up regardless of the chaos, My idea is that it keeps an Integar "Preserializeddamage" local to the player that counts the total damage they have dealt to the monster for one tick cycle, when the owner requests a serialization every 0.25 seconds it requests that the Preserializeddamage integar be added to a "Preserialdamagelist" (Integar[]) to an adress according to their player ID and then for that value sent to the owner alongside every other player with their own adress, then all the values in the Int[] would be calculated by the host and tally'd up to create a Totaldamage integar value to then subtract the health by the totaldamage amount.

All this would happen every quarter second (Hope this makes sense so far.

My worry is that because I only want one address per player to be modified by their player ID... like player ID 3 dealt 50 damage so the Preserialdamagelist would be .

0
0
50
0
0

And then for another player, ID 2 dealt 100 damage to make.

0
100
0
0
0

I dont know if these 2 Int[] results would try and overwrite each other messing everything up... What do you guys think?

#

Same image but the flow lines arnt graphically broken

finite sierra
#

not to mention every Ownership change takes abit of time annd can fail if it happens to often. and doing it potentially 4-16 times per second is far to often.

#

generally udon is not made to handle what a fps requires. hence why most fps you see have a very heavy limit on players and have fairly long delay's on shooting and other things

silver hill
#

Oh yeah I see what you mean, so I could put the request serialization in the top row, but what about the Int arrays? would they overwrite each other?

#

Just really need to know if the results of one entire Int array would overwrite another if one data packet arrives later than the first

obtuse echo
# silver hill Just really need to know if the results of one entire Int array would overwrite ...

Yes, that's what they mean. If two people fight over ownership, then values can get overwritten. There is no way for two people to use the same object and combine the array values in a way where it has both, like in your example it will either only be 50 or 100 with the rest being 0 (at least if they take ownership around the same time).
Good news though, you're on the right path. You need to use PlayerObjects instead. Those will assign an object to each player that only they can sync values with. The host has a copy of that object too, but they can't send, only receive values from it. So in your example, Player A would sync 50 damage and Player B would sync 100 on their own objects respectively. The host has both those objects and receives both values separately without conflicts, reads their objects and then combines it in the main script.

silver hill
#

Hm, not sure how Id implement that

#

So every NPC enemy would have a player specific hitbox?

obtuse echo
#

Skipping through it, they give an example of flash lights being turned on for each player individually. So everyone has a flash light that others see if you turn it on or off.
But for your case: Instead of just having a bool that you sync, you sync your whole damage event, then you put those values into your main script (whatever you're doing there)

silver hill
#

Problem is how can I sync a int value for damage to a host object without having to resort to networked custom events

#

Hmmm, just thought of something...

#

Not sure if its pretty much the exact same thing Im trying here though...

#

I could make it periodically send damage data from a hitbox via a networked event... but then that might get a bit messy in the end

#

not to mention laggy

#

I dunno the performance limits of tons of networked events goin on, is it possible to only send data to an owner?

obtuse echo
obtuse echo
# silver hill I dunno the performance limits of tons of networked events goin on, is it possib...

If you only sync something every time they actually hit it, it won't be too bad. If you need 80 players in your instance shooting something then you will obviously need to make sure you're not doing anything completely bad though. But you should be able to reach 20 players relatively easily. Still need to playtest and stuff to make sure the damage gets applied fast enough to feel good etc. But that's not really a networking challenge anymore at that point.

obtuse echo
silver hill
#

Im pretty new to manual syncing

obtuse echo
#

It's fast and can handle a decent amount of traffic.

obtuse echo
obtuse echo
# silver hill Im pretty new to manual syncing

Also, if this is all too overwhelming, you might want to start with something more simple. For example, just store the health in a central object on an enemy and then take ownership to manually sync how much hp they lost. Yes, it will conflict if two people shoot at it at the same time, but it's much much easier to do it like that.

silver hill
#

Yeah that would totally branch the game off what i have in mind lol

#

I will figure it out or bust

obtuse echo
silver hill
#

I intend to have a swarm of enemies fighting numerous players with fully automatic weapons, so alot of stuff will be going on

obtuse echo
silver hill
#

Ye, just thinking up a new method of doing it, il probably paste my results here later

#

What does the "Sendchange" tick box do?

obtuse echo
obtuse echo
silver hill
#

Oh! I never seen the on change event

#

So that tickbox is there to just fire on on change event?

obtuse echo
silver hill
#

I see

obtuse echo
silver hill
#

If 2 scripts tried to modify a variable in a third script on the exact same frame, would they fire one after another or try to do it at once?

obtuse echo
silver hill
#

Nice, that might work for me then

#

I only been "Programming" (with graphs) for like a few months so I dont know how computers handle code

obtuse echo
silver hill
silver hill
#

So lets say a bunch of people have sent a networked custom event to one script all at once, and all of them are telling it to add 10 to an integar, if they do the scripts one by one on that one frame I would assume it will go 10+10+10+10+10+10+10+10+10+10+10+10+10+10+10+10 Instead of just simply doing 10+ ?

obtuse echo
# silver hill

Yeah that looks very nice already. I definitely obsess about correctly syncing everything though because I think it's nice. But not everything has to. People will overlook it if you can actually make something fun.
And yeah, definitely recommend just having a Health script on your enemies where you can just call "take damage" and subtract the health. Much easier.

silver hill
#

And it will call it every 1 second so at worst the enemy that had 1 hp left and you shot it a bunch of times will at the very latest die at the end of that second lol

scenic sky
#

will calling RequestSerialization in OnPlayerLeft work?

#

currently, it doesnt seem like my instance claimer object is being turned back on and i feel like its because RequestSerialization is not being called when a player leaves


public override void OnDeserialization()
    {
        colliderRef.enabled = isEnabled;
        wallParent.SetActive(isEnabled);
        if (isEnabled)
        {
            status.text = "Active";
        }
        else if (!isEnabled)
        {
            status.text = "Not Active";
        }

        if (isInstanceClaimed && isVIP)
        {
            Debug.Log("Instance is claimed by " + instanceClaimerName);
            foreach (GameObject obj in vipObjects)
            {
                obj.SetActive(false);
            }
        }

        if (!isInstanceClaimed && isVIP)
        {
            Debug.Log("Instance is not claimed! restoring claim button...");
            foreach (GameObject obj in vipObjects)
            {
                obj.SetActive(true);
            }
        }

        Debug.Log("OnDeserialization recieved");
    }


    public override void OnPlayerLeft(VRCPlayerApi player)
    {
        Debug.Log(player.displayName + " left");

        if (staff.Contains(player.displayName))
        {
            staff.Remove(player.displayName);
            Debug.Log(player.displayName + " removed from staff");
        }

        if (staff.Count == 0)
        {
            Debug.Log("Staff list is empty");
        }


        if (player.displayName == instanceClaimerName && staff.Count == 0 || staff.Count == 0)
        {
            instanceClaimerName = null;
            isInstanceClaimed = false;
            Debug.Log("No staff left, enabling Instance Claimer for VIPs");
            RequestSerialization();
        }
    }```
safe path
#

I tried asking about this in Udon general yesterday, but didnt end up geting it to work.
All that doesnt run is my Network event and idk why.

sick gull
safe path
#

Yes, but only when I call check for in list by itself

#

If I called teleport players, the debug works, but the rest doesn’t

sick gull
#

Ok lemme rephrase this.

When you call Teleport players, does the CheckForInList debug go of?

safe path
#

I think that might be the problem. I can’t double check it right now. But I’ll take a look thanks for the help.

twin portal
#

remember that they need to be the Owner of the UdonBehaviour in order to be able to call RequestSerialization
OnPlayerLeft is executed by everyone else once a player leaves, so everyone will attempt it, but only the owner will succeed the RequestSerialization call
and OnDeserialization is ran for everyone but the one who sent it, so if the Owner needs to run that logic too, it should be put in its own function, and then that function should be called in both OnDeserialization and in OnPostSerialization

scenic sky
#

Im very struck right, iv been trying this for awhile but i just cant seem to get it right. im trying to sync the number of staff for all players so i can enable/disable a button accordingly but im having trouble with the staff not syncing correctly after the player leaves along with not seeing any logs from on ownership transferred

scenic sky
#

i ended up redoing most of the code and ended up with this but i still seem to be stuck, for whatever reasons the logs inside of the "if (Staff.Contains(playername)) is not being reached. according the debug console in vrc

public void _RemovePlayerFromStaff(string playername)
    {
        Debug.Log("RemovePlayerCalled!");
        if (staff.Contains(playername))
        {
            Debug.Log("Player who left was found in the list!");
            staff.Remove(playername);
            staffAmount = staffAmount - 1;
            staffAmountStatus.text = "Current Amount of Staff: " + staffAmount;
            Debug.Log(playername + " removed from staff staff count is now " + staffAmount);
        }

        if (!localPlayer.IsOwner(gameObject))
        {
            Networking.SetOwner(localPlayer, gameObject);
            Debug.Log(localPlayer.displayName + " Now owns the system");
        }
        RequestSerialization();
    }```
silver hill
#

@obtuse echoMade a networked health tracker that has everything I need, tons of variable damage at rapid pace, optimised, and can have tons of people blasting it at once and it will keep up, only downside its accuracy, It takes the total damage you shot at it, brings that Int to a Table of Networked custom events, fire off a custom event that closely matches the amount of damage you dealt rounded down, then deals the actual damage you dealt after the custom event, No serialization required!

#

I guess it also has the side benefit of limiting the maximum amount of damage a player could deal if they were cheating/glitched

#

Oh it also has flags for Critical hit zones too

#

dealing twice damage if its a crit spot

scenic sky
scenic sky
#

If you want a value to change after a player has left, who is the one who changes it? And how do you ensure that the change is visible to you and everyone else? I'm not really sure what im doing wrong

obtuse echo
finite sierra
#

Networked events will slow down or outright skip at heavy loads. Atleast that's what I found

safe path
#

Does the object that a script with a network event is on have to be a player object for the network event to execute?

#

can somebody please explain what a network event is?

#

I’ve been struggling

twin portal
#

a network event is just a function that's executed by every player once it's called

fallow mountain
#

No, it doesnt have to be a player object

safe path
twin portal
#

what sync type is it set to?

safe path
twin portal
#

is it Continuous, Manual, or None?

safe path
#

Let me look where do I find that?

twin portal
#

you can see it in the Inspector

safe path
#

LEGOS my hands are shaking. It worked.
After hours it worked!

twin portal
#

lol

#

was it set to None?

safe path
#

Yes

#

Yes it was

twin portal
#

this is usually why, for every script I create, just add this at the top so the script always has the right state that I need

#

just change to None, Continuous, Manual, etc. to what the script is made to be

#

I think this is also the only way you can use the NoVariableSync mode, which won't sync variables but still let you send custom network events

terse cape
#

does anyone have any networking tips to speed up events happening during run time. Im pretty new to this and not sure whats causing events slowing down on another player. Checking console in game I can see everytime I request an event it is sending 22 bytes to anothe rplayer idk if thats bad or not

#

ik its kind of broad but 😭 I can be more specific in areas

deft bay
#

Can I teleport other people by touching them with an object?

#

Teleport to a specific position

inland fern
#

Is there a way to get a world to detect an instance type and enable a gameobject depending on such

#

specifically public group instances

tulip sphinx
#

@terse cape rather tell, how you observe and what you call slowing down.

terse cape
#

for instance I am using collision between a rigid body slamming into a cube, and the cube should destroy on impact

#

I notice that the cube takes a while longer to destroy on the second client

#

about like 4-5 seconds but it vaires sometimes

#

I checked if the network was clogged but always returned false in multiple areas i checked

tulip sphinx
#

@inland fern no

#

@terse cape rigid body on networked objects runs only on owner, is destroying function runs locally?

terse cape
#

uhhh I set the destroy to be a networked event

#

so not locally

tulip sphinx
#

@terse cape uh i think its more about referencing object to destroy or smth... can you set up smth simpler to test parts? like button - event - play sound. if its fast, then replace button with cube collision, or play sound with destroy.

terse cape
#

ok thanks

wind nebula
#

Hello Guys... i was working on my World today. I encountered a weird Issue with the Network ID Scene IDs... whenever i remove an Object with "VRC Object Sync", the Scene IDs are not refreshing properly.. i need to do it all the time manually via the "Network ID Utility". Is that a new Issue? Or what could happen to my Project?

fallow mountain
#

you cannot have gameobjects of same name in the same heirarchy parent, so if you have same names next to each other you need to rename them to Name_1, Name_2, etc...

#

Then clear the Network IDs and remake them

wind nebula
#

but thats the Thing.. i dont have Gameobjects of the same Name

fallow mountain
#

ok then what is the network ID erroring about? can you post a screenshot to see what it is about

wind nebula
#

if i remove a GameObject the Network IDs doesnt regenerate by its own

#

yeah sure i recreate it

#

hold on

#

if i regenerate the Network IDs... its without Errors

#

the missing Script is EQS Data... dont know what it does

fallow mountain
#

EQS Data?

wind nebula
#

yeah idk... cant find anything in the Internet about that....

#

its not conflicting... when the Network IDs are regenerated it doesnt effetc it

fallow mountain
#

it says it deleted editor only data EQS Data

wind nebula
#

Yeah idk what that is xD

#

something with Clientsim

fallow mountain
#

are you deleting things in play mode?

wind nebula
#

no

fallow mountain
#

what object are you doing, is something marked as editor only?

#

just regular vrc pickup?

wind nebula
#

that appears when i hit Play Mode with regenerated Network IDs

fallow mountain
#

what are you doing in your game, what is the vrc object sync on?

wind nebula
#

just a normal Axolotl 3D Model... so i can grab it with VRC Pickup

#

the world was still working before the SDK Update

#

thats constantly reappearing

#

idk if i "Fd" up my World

#

and btw the World was working all the Time... that Object exist for 2 Years

fallow mountain
#

SDK update <--sounds sus, especially that is the only thing that changed

#

quite clearly cause and effect

wind nebula
#

i changed the SDK back to 3.7.5.. teh Error still is there

#

something is wrong with the new SDK idk

#

it killed my world maybe?

fallow mountain
#

what is player object 1 main quest json?

#

what gameobject does it relate to

wind nebula
#

idk? the Scene is called Main Quest

fallow mountain
#

player object 1 sounds like it is VRC player object related

#

can you post the network id utility window when it has error?

#

it should tell you what gameobject is causing problem

wind nebula
fallow mountain
#

yeah maybe they have same name

#

under a same parent

#

maybe in a prefab

#

click select and rename the chairs

wind nebula
#

i removed them... i didnt needed them

#

do u have time? we could call

#

so have more Inside to it

fallow mountain
#

so you deleted the chairs, cleared ids, regenerate ids, still here?

wind nebula
#

the Client Storage Error yes

fallow mountain
#

but network id window, still show the chairs?

wind nebula
#

no

fallow mountain
#

try clear network id, restart unity

#

see if it works

wind nebula
#

cleared it, same Error

#

still calling for ClientSimPlayerObjectStorage Error savings

fallow mountain
#

do you have VRC Player Object on anything in your scene?

#

delete the component and re-add them, maybe SDK related

wind nebula
#

the VRC Player Object is in VRCSDK3 right?

#

its a DLL File

fallow mountain
#

no i mean

#

do you have a gameobject in your scene, that is a VRC Player Oject?

wind nebula
#

noo... not that i know

fallow mountain
#

wait, what SDK version is before and after?

wind nebula
#

my SDK was 3.7.5

#

i updated to 3.7.6

#

i still have a backup from February...

#

i just wanna know why my Project just bricked xD

#

wanna see it yourself?

fallow mountain
#

im still on 3.7.5 so probably will work

#

but if it broke after update, then it is quite surely update related

wind nebula
#

i just test my backup if there was any similiar Errors...

#

if not... i can just go again and work on that older Version

#

sometimes Unity does Unity Things

fallow mountain
#

or you can make a new scene and then copy gameobjects over one at a time

#

to see what exactly is causing the problems

wind nebula
#

also an idea

fallow mountain
#

or copy half, then repeat

wind nebula
finite sierra
#

sooo i just found out that a Long and any synced variables have twice the data cost. so even if a Long is just 8 bytes it cost 16 to have it synced. which defeats the purpose of doing any sort of bit packing. like 2 byte and 2 int takes up 16 bytes for some reason.

raw umbra
#

Since ints bytes shorts ect have a data cost that is higher than twice their size

#

So yes packing into a long still saves signifigant data

#

I did my own research in this recently (Sidenote arrays have INSANE crazy headers) for my networking journey

hoary frost
finite sierra
#

the only time it seems worth packing is when you deal with Collections, such as array or data dictonaries and so on.

hybrid kindle
#

ugh, does anyone have an example for how to make this synced for late joiners? I've tried everything I can think of. Its just a texture swap array of a material.

fallow mountain
#

oh wait

#

coding in mspaint

#

For the owner, modify variable->req serialization->apply variable

#

And then, for other people including late joiners, onDeserialization->apply variable

#

That is the basic structure

#

OnDeserialization will fire automatically when other people (including late joiners)

#

receives the variable change from the owner

cinder sphinx
#

Does anyone know if variables are synced per-object or per individual variable? Basically I want to know if I change multiple synced variables at once, would a remote client recieve the changes all at once or is there a danger that they'd get them out of order/one at a time. Reason I ask is I need some way to send events with arguments, and I'm figuring an on-changed or on Deserialization with a set of communication variables might work well for this, as long as they all update as a group.

strange token
#

it's per script, as you could have 2 different synced scripts on a single object and you'd need to request serialization in each script to sync that script's data

fallow mountain
#

what is the best way to send events with arguments? surely it has to be onDeserialization to make sure the variables are received?

#

Is there really no way to send events quickly with individual data?

finite sierra
#

you cant send arguments

frozen igloo
strange token
frozen igloo
#

yeah, requestserialization will ask that networking component to serialize when the next good time is, and when it does it will package up the data from all udonbehaviours on the object, not just specifically the one script that asked

#

it's a tiny bit weird but it does make network IDs drastically more simple, which is very helpful when network IDs are already pretty complex as is heh

strange token
#

that makes a lot of sense, yeah, never realized it was done that way

#

I'm glad you frequent this place to answer hard questions with your vast knowledge xD

frozen igloo
#

any time 😅

fallow mountain
#

Is there really no way to send networked event with specific variable attached? Like if I fire a gun at a specific angle, I need to request serialization of at least a position and rotation for the precise placement of the shot, but if I fire the gun faster than serialization can package variable (every second or so?) wouldn't all the information go missing except my last shot?

twin portal
#

no, you generally don't want to sync variables with a network event

#

if the gun is a pickup, you won't need the position or rotation, you just fire the particle

fallow mountain
#

I want to show a precise bullet trail for each shot, for example

foggy jackal
#

particle trail?

fallow mountain
#

for example

#

and I don't want it to look different because of lag

#

on different clients

#

(actually this sounds like a pen drawing problem)

#

hmm

frozen igloo
# fallow mountain Is there really no way to send networked event with specific variable attached? ...

yeah, firing a gun is one of the few things that really does work best as a network event and our support for that is lackluster. Sending that use case through state-based networking is possible but a bit clunky. You could either:

  • Wait until we get around to implementing network events with variables
  • Implement an event buffer with time synchronization
  • Use normal network events and make a pseudo-variable by having a bunch of different event endpoints and dynamically calling the one you want as if it's a variable
frozen igloo
finite sierra
#

@frozen igloo would you know what Version of Vrchat uses for c#?

devout mountain
#

Im trying to implement a button that can teleport a player (whos name is on the button). The problem im having is that the teleporting works when im the target, but doesnt work if i want to teleport any other player. How would I sync this teleport to others?

private GameObject bartenderSpawn;
private VRCPlayerApi playerLocal;

public void TeleportPlayer()
{ 
    SendCustomEventDelayedFrames(nameof(_TeleportPlayer), 0);
}

public void _TeleportPlayer()
{
    playerLocal.TeleportTo(bartenderSpawn.transform.position, Quaternion.Euler(0, 0, 0));
}
fallow mountain
#

Make the button oninteract -> send networked custom event to all, and then have a custom event check if local player is the name on the button, if yes then teleport local player

devout mountain
# fallow mountain Make the button oninteract -> send networked custom event to all, and then have ...

Do i need to change it to OnInteract? Im using UI Button and just call the method over OnClick().
Ive changed it to SendCustomNetworkEvent. Now it works locally in Unity Client Sim but not in VRC. I cant teleport myself or other players.

private GameObject bartenderSpawn;
private VRCPlayerApi playerLocal;

public void TeleportPlayer()
{ 
    SendCustomNetworkEvent(NetworkEventTarget.All, "TeleportLocalPlayer");
}

public void TeleportLocalPlayer()
{
    if(Networking.LocalPlayer == playerLocal)
    {
        playerLocal.TeleportTo(bartenderSpawn.transform.position, Quaternion.identity);
    }
}
fallow mountain
devout mountain
fallow mountain
#

your script needs to be networking set to manual or continuous, otherwise it wont send network events i think

#

oh and of course you need to check if the local player's name is matching the name you want

#

which is your playerlocal i assume?

devout mountain
devout mountain
fallow mountain
#

hmmmm

#

do you have dev gui enabled in game? because you can press Rshift + ` + 3 to open the error log and see what is stopped the udon behavior

#

bartenderSpawn is it referenced properly?

#

shouldn't it be public? and then referenced in inspector window

devout mountain
devout mountain
#

ah nvm found the keybind

devout mountain
fallow mountain
craggy pivot
#

anybody know if playerIds get recycled? I have an array of ids that will grow infinitely so if somebody leaves and later on somebody new is assigned their old playerId that would be an issue

tulip sphinx
#

id just grows, rejoining will not reuse it

craggy pivot
#

cool. do you happen to know if the same player leaves then rejoins will they reclaim their old id?

tulip sphinx
#

i already said, it wont

#

every joiner=new id

craggy pivot
#

gotcha

tulip sphinx
#

if you need to restore, use player objects from persistance update

craggy pivot
#

cool didn't know about that, thanks

finite sequoia
#

Back to square 1 for Pixelcanvas again...
I did try to use the recommanded structure for syncing the data, using OnDeserialisation to send an event.
Silly me forgot the problem was that "everything was sent at the same" time during OnPlayerRestored,
of course sending at OnDeserialisation trigger the same problem.
Same as having a OnStart starting a custom delay, since all the OnStart would fire at the same time on every tiles.
I really need a manager for this one...

#

@twin portal well, turns out even with a single manager sending events at a rate of 1 call per second...the same bug still occurs (4 players, in an empty world)

#

honestly I don't really know what to do aside of transforming the tiles into generic "if touched send custom event"
but even that...Either I write the IDs manually for the whole grid or...the automation to write them would run in the same problem again

#

honestly I'm hitting a wall here

#

I don't see the "whatever you're doing you're doing it too fast" in logs tho, that's one change I noticied

#

which...makes sense since the manager is sending only one custom event per second in this test...

#

"failed to authenticate" oh well I'm in timeout again thanks to these tests

finite sequoia
#

Dunno if that's because they're inside a PlayerObject but even when I set the networking to "none" on all the tiles, the list don't become smaller in the network ID window. (or all that matters is they're referenced in another object's array..?)
Is there a hard limit on how many networked objects IDs exists in a world?

#

I see no solution to this, even if I removed Udon from all tiles I'd still need instead a FOR (collision check on the pen side to know if what was hit is valid) that would be calling things too fast again since the number of tiles stays the same...

#

it's probably doable on U# but I don't see in Graph.
It's not even that the prefab doesn't work, it just make the world freak out if there's 4+ players

sturdy hornet
#

I know this is the most basic question but its been so long I forgot what the name of the node that does a manual sync for everyone

finite sequoia
sturdy hornet
#

im dumb lol

finite sequoia
#

it's ok, happen to everyone xD

finite sequoia
#

Ok, from 1300 to 30 IDs (removed Udon from all the tiles and changed the whole logic)
let see if that makes a difference... (speed of calls is the same)

finite sequoia
#

As expected, switching from "stand-alone tile detects if what is touching it is the one valid thing (pen)"
to ''pen have to check the whole array of colliders to see if it is a valid tile (and which one)"
induce...a lot of lag at x32 (x8 and x16 are acceptable on desktop, but x32 is a big drop.)

Well at least it works, now time to see if the "players get kicked" bug still occurs...

#

4 players works now

#

the setup is laggy as heck compared to stand-alone tiles but reducing the numbers of IDs...made the bug stop

#

I...guess there's a hard limit that get hit by the instanciated PlayerObjects then...

#

8 localtesting clients: 7 works, 1 is black screen but don't seems related.
That's already blowing out of the water the "2 to 3 players trigger the bug" results from stand-alone setup

finite sequoia
#

Only thing I can picture to remove the lag is a very cursed...Let say "Pen" collide with "PixelCanvasTile_150"

  • partial name check to see if it's the correct object type. (here: "PixelCanvasTile")
  • in a math variable, string substraction "PixelCanvasTile_" to only keep the number
  • convert variable to Int, use it as reference for index search.

This way I only need to check the object interacted with (problem 2 being insane lag because 1k+ long FOR)
without adding UdonBehavior to every tile (problem 1 was the number of UdonBehavior/NetworkingID)
But even then I need to account for if the object gets cloned or the name would still have characters past the number.
Guess I'll have to look into that whole "format" thing...

The fact all this is just because of the number of UdonBehaviors (which worked as Manual, everything was working and saving perfectly and without lag...) and not even the actual speed of actions is...demoralising.

I get that it's getting annoying to repeat the same question but is it expected behavior to have such a limit? Or should a bug report be filled about this whole players get thrown out of the world in loop when there's that many UdonBehaviors (even if they're set to Manual or None) ?

finite sierra
#

if you want to know if its the same object you have to use the Network ID that is provided by Vrchat in order to ensure its the same object across the network. which will speed up lookups in general.

#

however a 1k for loop is very heavy in order. you are most likely looking at 1-2 ms minimum to do so in udon as its upwards of 1000x slower then native c#..

finite sequoia
#

yes, hence why the tiles were originally stand-alone

#

and everything worked fine. no lag, save correctly, display correctly to other players

#

but the simple fact there's so many UdonBehaviors, even if sync was set to None, was enough to hit some limit

#

if more than 4 players were in world, the 4+ were stuck in a loop till the game time them out or they close the game

#

hence me trying to ask multiple time if it's expected or should be reported...

#

because yeah, I mean there's not many worlds who'd even need that many behaviors to begin with, so it make sense

#

.
Current check is a classic array for the colliders, I havn't switched to the name madness...yet

#

but already very laggy we both noted, because obviously that's quite the loop.

finite sequoia
#

them being listed in NetworkID window made it so many IDs existing the problematic behavior was happening

#

hence me switching to an array listing them object (whose Udon was removed from) and the problematic behavior immediately disappeared

finite sierra
#

well you are asking it to create 1000 + of objects.

finite sequoia
#

again, hence me switching to an object used as reference manager because yes, I understood that needed to be changed

#

but now the check causes these lag drops, which...it's super long of course it's expected

#

both approaches lead to unplayable results

#

(well, stand alone was perfectly playable solo or with 1-2 other players, the world just freak out if there's more PlayerObjects being instanciated for new joiners)

#

but solo there was no lag, nothing

finite sierra
#

well yea. because they all need to instantiate it.

finite sequoia
#

So yeah I'm hitting a wall on both ways to approach the problem here...

finite sierra
#

i dont even know what you actually are trying to do ngl

finite sequoia
#

persistant pixel canvas

#

don't get me wrong the visual part is childplay

#

when pen touches tile, set tile's SharedMaterial to pen tip's SharedMaterial

#

the end
Stand-alone it was just the tile checking if what enters is the pen object so no need for an array
(unless there's multiple pens but there would never be enough to be a problem even if let say a QVpen set was used, so it's still easy to setup)

#

it's the whole "which one was interacted with to set the value at the right index" part that have all these problems

#

stand-alone it was just an Int in the tile (easy and effective, only the relevent tile was called only when needed)

#

but with a manager array I need the correct index to set the value instead, hence the current check

#

the thing works. I just need a more efficient way to check that doesn't lag...

#

and that doesn't use 1k IDs cause the world freaks out from them just existing

#

Sorry if this whole thing sounds like insanity, I've been running in circles trying different ways for a whole month...

#

as a Graph user

#

So yeah, I don't really know my options like a programmer would normally know obscure node/function names ._.

rugged dock
#

I have a question, I have a animation of a console breaking and letting out smoke, I want to make it so that when you touch it with a toolkit object, it gets fixed, the animations are done and the animator is set up, I have an udon graph for toggling animations and also for triggering animations by using game objects, but the issue is that I don't know how to sync it.

Essentially, I want to be able to pick up an item, touch an object with that item, and have it trigger an animation and have it be synced.

Here's what it looks like in case anyone knows why it won't sync up.

twin portal
#

hm ok.... may not be too bad to sync

#

right know you're using SendCustomNetworkEvent, but this will only fire for those already in the instance and not sync for late joiners

#

and when someone joins, you GetBool for the animator state, but an animator's states will not be synced, so this is going to get whatever the default value for the animator is and run that

#

so all you'd really need is your own bool that's set to be synced. and then change the animator's parameters based on its current value

twin portal
#

if your graph is set to Continous sync, it should then change IsOpen depending on the value of the synced bool

#

if it's manual you just need to RequestSerialization any time the bool gets changed. oh and change ownership whenever needed

rugged dock
twin portal
#

alright no worries, we can do a step at a time

rugged dock
#

Thank you so much, where should I start?

twin portal
#

first you'll need the variable, click the little plus at the top left, search for bool, name it something useful, then set it to be synced

rugged dock
#

done.

twin portal
#

so it looks like we want to change this during OnTriggerEnter, since that's where we're currently setting the animator's parameter. So we just need to edit it so it sets our own bool instead

#

but right before, we need to change the owner as well

#

and syncing stuff that involves collisions can be a little tricky since all players can possibly fire the event.... depending on what's happening

rugged dock
#

Would it be easier to do this over a screen share?

twin portal
#

yeah but I'm busy atm lol

rugged dock
#

Okay

twin portal
#

this toolkit, is it a synced pickup?

rugged dock
#

Yes

twin portal
#

so this.... is a little bit of a pain-in-the-ass problem I've encountered before. What will happen is, any player that sees the pickup enter the trigger zone will fire this event, even if they aren't the one holding the pickup. This will be a problem with the current approach, since if I did something like this, there can be potentally multiple players requesting ownership all at the same time

#

so there's multiple ways to get around it. you just have to keep it in mind
maybe only the person holding the pickup has this object's trigger collider enabled? maybe we check if the local player is also the one holding the pickup first? Or we only check when the owner sees the collision, and trigger then

#

or you change it so the repair happens when you press Use on the pickup

rugged dock
#

What if we did a counter so that it only works when it detects one toolkit at a time?

twin portal
#

there's still only one toolkit, it won't really reliably count more than one. You can sort of guess that the player holding it will fire it first due to the ObjectSync delay, but it's not a very reliable assumption either

rugged dock
#

Well to be more clear there will be multiple toolkits for various people.

#

People will be "repairing" various things across the map.

twin portal
#

right there's not just one, so we'd need to check if OnTriggerEnter, the toolkit that caused this event is also being held by the local player

#

I think I've got an idea

twin portal
#

I'm about to edit that, that was just my example

#

that graph would technically sorta work but would be buggy due to the behavior described

rugged dock
#

Okay.

twin portal
#

I think I'm missing something here, forget how to refer to the self gameobject in graph (probably needs to go into the SetOwner node)

#

then all you'd need is the events for the variable change...

rugged dock
#

How did you get this?

#

nm found it.

twin portal
#

cool lol

#

anything that says "VRCwhatever" in graph, you just omit searching for "VRC"

#

most of the time, at least

#

gets confusing

rugged dock
#

And what about set is open sync?

twin portal
#

hold CTRL while adding the node to the graph

rugged dock
#

What kind of variable do I need to make?

twin portal
#

those should already be available if you still have those custom events in the graph

rugged dock
#

I don't.

twin portal
#

those aren't variables, they're your Custom Events and their names

#

if these are in the same graph (may need to compile first), the dropdown shouldn't be grayed out

rugged dock
#

Oh okay, I thought we were re doing everything so I deleted the previous stuff, but I just ctrl z'd and got it all back so it's fixed now, I have the on and off options.

twin portal
#

no worries lol

#

I think that's it though. at least the core of it

#

could test by making isOpenSync public or something and watching it in the Inspector while testing it in ClientSim

rugged dock
#

The code on top is what we did, and the stuff below is what I already had, look good?

twin portal
#

yea lemme just get my magnifying glass and read that

#

there are parts of the old graph we don't want anymore I think

#

oh right yeah the whole OnPlayerJoined part shouldn't be needed

#

isOpenSync Change will also fire for late joiners so it'll take care of that

rugged dock
#

Revised.

twin portal
#

oh and the Networked event too I guess. It's benign since nothing is running it anymore

#

well I've just tested it and seems to work...

rugged dock
#

Hmm, not for me.

twin portal
#

I didn't test networked yet tbf

rugged dock
#

Pipe is the name of the object needed to break the console.

#

I tried running into the trigger area with the pipe but it didn't trigger the animation.

twin portal
#

did you check the "sendChange" box in Set isOpen?

#

hm mine works networked as well, so we need to find what's different

rugged dock
#

Yes it is ticked.

#

Also what should I replace the networked event with?

twin portal
#

may need to insert some Debug Log nodes into various parts and see which part isn't ending up running

#

that whole Networked event shouldn't be needed

#

since nothing is calling it anymore

#

we're relying on Continious sync and the isOpen's Change event to do the networking

rugged dock
#

Well I just tried to playtest again and it didn't trigger the animation.

#

The "IsOpen" box should be ticked in the component as well right?

twin portal
#

that tickbox is what the default value for isOpen should be; a check would mean it starts as true

#

no check just means it starts false

#

since I didn't want to set up a whole animation to mimic your implementation, my On and Off events are just this

#

if you add these Debug Log nodes at the start of these events, we should at least see the message getting printed to the console when the pickup enters the trigger

rugged dock
#

Do I copy that or do I plug the logs into something else?

twin portal
#

copy this, then after the Log nodes, plug that into your current nodes that are setting the animation

#

so that way it Prints Log > Sets Animator

#

or put them after the animator. guess it doesn't really matter

rugged dock
#

Like this?

twin portal
#

nooo that'll break the compiler

#

you only need one Custom Event node for each event

fallow mountain
#

^

twin portal
#

you can daisy-chain them together

#

oops that bottom one's value should be false but you get the idea

#

and I would set the log to actually print some words like I've got with a const string node, so you know which event is running

#

right now it'll just print "Pipe" for either event

rugged dock
#

When I ran into the trigger area with the pipe I got this error.

twin portal
#

awesome

#

so it didn't find our VRCPickup which we coded no safeguards for

rugged dock
#

Is that an issue with the pickup object or the code?

twin portal
#

the pickup's collider and VRC_Pickup component need to be on the same object

twin portal
#

but currently collider and VRC_Pickup need to be in the same place

rugged dock
#

Oh, well I put an empty game object onto the pipe to function as a grab point, should I remove it?

twin portal
#

did you use the Exact Gun/Grip with that or?

rugged dock
#

Yeah

twin portal
#

that won't be where the collider is then, I think

#

I'd have to see your object in the hierarchy and where the components are

#

we can change the get component to something like GetComponentInChildren instead for example

#

we just need our script to be able to successfully find the VRC_Pickup component

rugged dock
twin portal
#

ok interesting

#

I set my pickup as the default, collider is not trigger, and the pickup has gravity

#

but if I set it the same as yours it crashes

#

curious

#

ah no wait

#

it's cause I still had those animator nodes... which I don't have an animator so it crashed lol

#

I think you need Orientation set to Grip to actually use that point but mine still seems to work hmmm

#

oh I think I see it

#

can we get a zoom and enhance on this part of your graph

rugged dock
twin portal
#

there's a teeeeny thing missing

#

see it?

rugged dock
#

Yup, trying again now.

#

It worked! But there was a slight oddity, I had to touch the trigger area with the pipe twice to get it to react.

twin portal
#

might be related to the script's default value and the animator parameter's default value

#

they'll need to match

rugged dock
#

Which node would I tick to fix that in the graph?

twin portal
#

this box in the Inspector of the script

rugged dock
#

That worked, thanks so much man, your an absolute lifesaver.

rugged dock
#

I used the pipe to break the console, which did sync, but when my buddy went to fix the console with the toolkit, it didn't fix for me.

twin portal
#

odd

#

I'll try a network test or two

#

nope I can't seem to break it

#

you can output the IsOpen bool somewhere in an Update loop, and check both your logs to make sure the value is always the same for both players

rugged dock
#

Maybe it's my setup, I have 2 triggers for the same thing, one for the pipe which breaks it, and one for the toolkit which fixes it, the trigger for fixing it is toggled off by default when it's already repaired, and the trigger for breaking it is disabled when it's already broken, they both occupy the same space but are on at different times.

twin portal
#

oh yeeaaah. This current script assumes there's only one trigger.

#

I'm assuming you have a copy of the script on each of those triggers?

rugged dock
#

Yes but I have different things slotted in each component.

twin portal
#

each script is going to have its own copy of the IsOpen variable, they aren't going to share it

#

so we'd have to modify the script to read what the current parameter value on the animator is first, then flip that

rugged dock
#

Is that a simple fix or a complicated one?

twin portal
#

should be easy actually

rugged dock
#

Cool.

twin portal
#

so this section, where we get and set the synced bool

#

instead of just reading isOpenSync, we read what the parameter is on the animator

rugged dock
#

And how do we do that?

twin portal
#

well in your On and Off events, we use SetBool. but now we need to get the bool. you can probably guess what node we'll need

#

hope this works at least. I'd do this a little differently if I knew the full picture

rugged dock
#

So that should fix the issue for the setup I'm using?

twin portal
#

I hope, at least

#

this should take whatever state you currently see for the animator, flip it, and send it to everyone else

rugged dock
#

And one last thing, should this be different for both triggers or should they both be enabled?

twin portal
#

the default value shouldn't matter anymore, since we're no longer reading it, we're taking the value from the Animator instead

#

true or false will have the same result

tawdry silo
#

I can not find one single example of persistence being applied in U#

#

I see the example scenes in the documentation, but nothing I can really look at the code for - I'd rather write with it than use graphs

#

Can someone help? I'm ripping my hair out just trying to save a float

twin portal
# tawdry silo Can someone help? I'm ripping my hair out just trying to save a float

The pages for the two types of Persisence, PlayerData and PlayerObjects, have some examples
https://creators.vrchat.com/worlds/udon/persistence/player-data/
https://creators.vrchat.com/worlds/udon/persistence/player-object/

PlayerData is a key-value database for storing persistent data about players, such as their score in a game or their preferences in a world.

PlayerObjects allow you to automatically give each player who joins your world a copy of a GameObject, such as a flashlight, a health bar, or a sword.

#

you can also install the Example Central scenes for persistence and look at the code used for them

rugged dock
twin portal
#

you need to plug the Animator into GetBool, not your bool

#

I'm surprised it even let you plug a bool into that...

rugged dock
#

I did that earlier, didn't work either, and the reason I managed to get it to plug in there is because it was originally the animator but I switched it to IsOpen when it didn't work.

twin portal
#

eeeeeh.....

#

well it definitely needs an Animator plugged into instance

#

any errors in the console?

rugged dock
#

No, in fact, when I run into the trigger zone with the pipe, it doesn't show anything at all.

twin portal
#

hard to tell where it's failing then

#

you have it outputting to console whenever IsOpen is changed?

rugged dock
#

Not sure what you mean by that but the log stuff is still there.

twin portal
#

it's still outputting successfully?

rugged dock
#

Should be.

twin portal
#

with your graph selected, can you press CTRL + A, CTRL + C, then come back here and CTRL + V to paste it

rugged dock
twin portal
#

meant like the nodes themselves but that works

#

I've already got it now lol

#

no need for the big paragraph

rugged dock
#

Does it appear to be scuffed?

twin portal
#

nope looks fine...... if I use one collider

#

testing with two

#

hm with two it breaks, if one collider turns it on, the other can't turn it off, until the first one turns it off; then the other one can turn it on

#

and I think I know why

#

a change event doesn't occur if you set the variable to the value it's already set to

rugged dock
#

So what can be done?

twin portal
#

nothing!
just kidding. just have to change the script slightly to account for it

#

or just use one collider

rugged dock
#

Well is there a way to make it so that one collider will recognize 2 separate objects and trigger different animations depending on which one it detects?

twin portal
#

definitely

#

the part in the graph where you're checking for the name of the other collider? you can just do that twice

#

well. I may have come up with an incredibly stupid solution

#

what if we just kinda.... force the sendChange to happen? even if the value we're ending up with is the same one it had before?

rugged dock
#

"Get in that box!"

"I'm already in the bo-"

"Get in the box!"

twin portal
#

I'm testing if this jank works for other players

#

if so this will be very funny

#

aw drat it only works for the one who sends it dang

#

otherwise it might try and play the animations twice

#

this almost works

rugged dock
#

How's it shaping up?

twin portal
#

almost done

#

KeyName is the name of the first object, KeyName2 is the second

#

first should only turn the bool on, second should only turn it off, and network it

twin portal
#

doesn't even look like the collision is triggering, or we'd see messages in the console

rugged dock
#

What are your exact settings on the pickup?

twin portal
#

default settings + ObjectSync

rugged dock
#

Yeah it just doesn't work.

#

Not for me anyway.

#

I won't make you put up with this any longer man, you've done way more than enough at this point, and I thank you for the time spent and the effort given.

twin portal
#

rip

#

it's probably somethin' weird making it not work

rugged dock
#

Oh my god it just worked, the trigger zone was bugged, when I just tried remaking a new trigger area it fixed itself, you gotta be fucking kidding me.

twin portal
#

Unity moment

fallow mountain
#

animator crashed because it couldnt find some parameters?

#

there are some warnings when u were testing in editor

fallow mountain
#

nvm

hybrid kindle
#

so- this script i altered before doesnt work for late joiners. help

#

i think its cuz im not getting the updated INT variable when a player joins but im just not sure how to do that

fallow mountain
#

in variables

#

and, script should be set to manual sync

hybrid kindle
#

on both

#

would this work?

fallow mountain
#

no, request serialization needs to be after you have changed the variables

#

and, you should not merge flows like that, it is buggy and best avoided

#

and, ondeserialization should not go change variables again

hybrid kindle
#

so how do you reccomend i set this up.

fallow mountain
#

this should not be network event here

hybrid kindle
fallow mountain
#

it should sync with request serialization and ondeserailization

hybrid kindle
#

vrcRat well- it dont

fallow mountain
#

can you post the variables window and the script in inspector window?

hybrid kindle
#

like it should work but its not

fallow mountain
#

you have a bunch of warning, waht does it say?

#

yellow triangle

hybrid kindle
#

all unrelated

#

but if you care-

hybrid kindle
fallow mountain
#

try restart unity idk, it can fix sometimes idk why

hybrid kindle
craggy pivot
#

If there is a synced array and a non-owner client modifies it does this break the syncing and all future updates?

#

modifies and/or reassigns

sturdy hornet
#

so im trying to get it to sync up the floats to play the same animation but they play an animation just a random one and it doesn't sync properly

sturdy hornet
#

also this part doesnt work its supposed to check if the old value is the same as the new one and if it is it set it again

fallow mountain
#

what exactly didnt work, just for late joiners?

hybrid kindle
sturdy hornet
fallow mountain
#

like two flows going into a same box... don't do this, just copy the box and plug them seperately

sturdy hornet
#

is this whats causeing the syncing issues?

fallow mountain
#

and also, you have two request serailizations but no onDeserialization, so the other people cannot act on the changed variables

sturdy hornet
fallow mountain
#

send change just means it will trigger an event node "on variable change" for that variable, it has nothing to do with sync

fallow mountain
#

actually you need to tick "sync" in the variables list

#

and... set sync to manual, in inspector window

#

tick "sync" only for the variables you want to sync

#

so, request serialization just means the owner will send the variable to other people.

#

you need a OnDeserialization node, which means when other people received it.

#

Because the udon graph runs seperately on different computers, so for other people, the onDeserilization will fire when they receive the updated variables......

#

altough i guess you have "oldFloatGreen change" to do stuff.... idk

sturdy hornet
#

im confunsed

fallow mountain
#

send change means it will trigger "oldFloatGreen change", this will fire for the owner, but idk if it means "oldFloatGreen change" will fire for other people when their variables are updated from deserialization

twin portal
#

SendChange does work, just have to understand how it actually works. A variable's Change event fires whenever it is detected that the variable has a new value
this doesn't necessarily have to be a networked change. So checking "send change" will tell the client (the one running this part of the graph) to also run that variable's change event

#

if the variable is synced, and its value has changed from when it was last synced, then Change will fire for remote players too when a network sync is performed

fallow mountain
#

Actually seems like a more efficient way than OnDeseralization if it is only one variable to handle?

twin portal
#

works pretty well if you're using a variable to set a particular state, you can use the change event so that the variable's value always updates the state

sick gull
#

I am finally hunkering down and trying to understand networking. I am making an admin panel. I really like Just B Clubs system so I am trying to replicate it for the most part.

I would appreciate some critiquing on my code. I am not sure if it is secure. I don't know how client users can abuse Udon since I have never used a client. Also open to optimizing and learning some best practices.

Basically, this is the code on the Button in the 'Cool' column.
This blue slot is a player object.

using TMPro;
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
namespace sondly
{
    public class CoolToggle : UdonSharpBehaviour
    {
        [SerializeField] private TextMeshProUGUI buttonText;
        [UdonSynced] public bool isCool = false;
        //Create a list of strings
        private string[] coolPeople = { "Sondly", "Cool Person" };

        void Start()
        {
            //Check if the owner of this networked object is the local player
            if (Networking.IsOwner(Networking.LocalPlayer, gameObject))
            {
                foreach (string name in coolPeople)
                {
                    if(name == Networking.LocalPlayer.displayName)
                    {
                        ValidCool();
                        break;
                    }
                }
            }
        }

        public void OnClick()
        {
            //Check if the owner of this networked object is the local player
            if (!Networking.IsOwner(Networking.LocalPlayer, gameObject))
            {
                Debug.Log("CT | Not the owner of this object");
                //Check if local player is in coolPeople
                foreach (string name in coolPeople)
                {
                    if (name == Networking.LocalPlayer.displayName)
                    {
                        Debug.Log("CT | Local is cool");
                        SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.Owner, nameof(ValidCool));
                        break;
                    }
                }
            }
        }

        public void ValidCool()
        {
            Debug.Log("CT | ValidCool");
            isCool = true;
            buttonText.text = "Y";
            RequestSerialization();
        }

        public void OnDeserialization()
        {
            Debug.Log("CT | OnDeserialization");
            buttonText.text = isCool ? "Y" : "";
        }
    }
}
silver hill
#

So Im running into a really odd problem my player objects that I use for guns take data from a local object which tracks data like ammo, which weapon you're using and whatnot, works great in singleplayer but whenever joined players try and use it, its variables are tied to what the instance owner has currently set them to, such as I want to use a pistol that is on ID 1, but the host hasnt chosen a weapon yet (ID 0) the joined player is unable to withdraw a weapon, even though they selected it, whenever the host has selected ID 1, the joined player can now use it.

Its been annoying me for days and cant figure out why this object which doesnt have any sync on it is being tied to the host of the session.

#

So the PLAYERSYSTEM is just a local object that controls it all, its not a player object and at first I thought that its before setting of (continuous) was the issue, setting it to none didnt rectify the issue

fallow mountain
#

vrc player object? each player shuld have their own copy

#

may be a reference problem

onyx path
#

Im looking for a simple code that activates an object for like 2 seconds then deactivates it, I just need a way to make buttons click when u press them, anyone have anything like this already made?

twin portal
#

just needs to enable the GameObject and turn it back off?

twin portal
onyx path
# twin portal does it need to be synced as well?

no snyc needed, yah just needs to be able to turn an object on briefly then turn it off. I would put a sound in an object that turns on on awake so whenever its briefly activated the sound is played then reset to play again on click

twin portal
onyx path
#

sweeet

silver hill
fallow mountain
#

set the script set the sync to none

silver hill
#

Tried that, it didnt work

fallow mountain
#

does it have vrc object sync?

silver hill
#

Nope

#

All parts of the gameobject, parent and children with their scripts have it set to none, no object sync or anything

twin portal
#

where are these stats being pulled from, persistence? if not from networking

silver hill
#

So the player objects are taking data from this object in question, the local game object has the data it needs to tell the player object what weapon to pull out

twin portal
#

and how is it getting that data? Just default values, pulled from the player's persistence? not many options if you've disabled networking

#

it sounds like data is being grabbed from the wrong player

silver hill
#

So the player persistence object is what the players grab hold of, it houses the weapon models and whatnot but the ammo that they have in the gun is stored by the player system master, which is the local object

#

hmm hold on leme try something

#

theres numerous objects/scripts that are local which house data for the guns to use

twin portal
#

from the description of your initial issue, it sounds that despite any networking, when you actually set those values they're being grabbed from the wrong player. Are you checking for Owner or Master somewhere in order to grab values?

silver hill
#

Hmm, not sure what you mean by that, let me check something

twin portal
#

I ask because with PlayerData, you specify which player you get the persistent data from. It doesn't have to be the local player. There may be a spot that you meant to use local player, but are using Owner or Master instead

silver hill
#

Oh I havent even implemented playerdata yet, Ive got it set up to easily implement it in but not till near release/beta I'm just getting data from the local object and then once its sent to the persistence object it uses networked events to tell everyone "Hey Im using gun ID X now and it has X camo applied and X attachments"

#

No serialization needed on that front which I like, but Ive noticed some other things wrong with my local objects and am gunna test now

#

I just hope that I can get this working cause then that means I can truly start development of the game lol

twin portal
#

I feel that

silver hill
#

I already got monsters networked and working which I thought was going to be the head scratching part but nope its the guns that are being a pain

twin portal
#

when it comes to amount of work predicted to do, it's always the opposite when it comes to this stuff....
things that I thought would be quick take a week, things that I thought would take a month I get done in a day

#

cool monsters, love seeing NPCs in VRChat

silver hill
#

Whats funny is that I did a play test online expecting to write down a long list of errors that need fixing but nope, every feature worked first time

#

Ah wonderful, its working as designed now

#

Yeah the issue was that a child object needed its sync set to none

#

So its interesting to note that by default any variables on a "local" udon behaviour are synced to what the host has, interesting... if I were a VRChat dev I would have it defaulted as none to avoid confusion but this has been a huge learning experience

twin portal
#

that doesn't sound right. Variables are not synced by default

silver hill
#

Ohhhhhh?

#

Well thats a hoot

#

Cause all my scripts default was set to continuous

#

hmmm

#

In any case I at least know what each setting sorta does

twin portal
#

the sync state is continuous by default, but the variables themselves still need the little "sync" checkbox checked

silver hill
#

a sync checkbox? where?

twin portal
#

in the graph on a variable's settings

silver hill
#

Oh that

twin portal
#

that tells VRChat to network sync that variable

silver hill
#

...to what the instance owner has it to

#

or is there more to this

twin portal
#

to the script's owner more accurately, but yes

silver hill
#

Oh yeah the owner, I guess by default every object is owned by the host

#

makes sense

tulip sphinx
#

its owned by the oldest person in the instance, so first one to join, not host. when previous owner leaves it can skip questies/people with ping etc as well. so never assume who owns the object in the end, set it yourself

silver hill
#

Yeah my system relies on the instance owner really so Im gunna have to put a critical error for everyone to reload a new instance if they leave

#

I recon the monster AI would break

sick gull
#

IDK if my approach of using PlayerObjects allows my system to be secure... Because of the player always owning their own object. They have to grant themselves permissions

silver hill
#

You making a sort of club world?

sick gull
#

Yeah, I'm making a bar world

#

Drinks are implemented, drunkenness etc.
Main piece left is the overall design of the bar. Super prototype rn and a moderation panel.

#

I saw some paid assets. I bought Demon Permission System but I didn't like how it was laid out. I like the toggle ranks over a blanket rank

silver hill
#

Oh no... you're not gunna have like a bouncer system where questionably old players ask people for age and date of birth right? :L

sick gull
#

I am against it personally

#

I think its stupid but the people want it

silver hill
#

Right on brotha!

#

oh so you are having it :L

sick gull
#

Yeah, it'll be opt in like it is in all the other bar worlds. Its just for the people that use it. IDC personally.

silver hill
#

I find it cringe as a whole, you have a bar world in which they serve pretend drinks that you can pretend to drink and pretend to get drunk :L and then you have kids that barely reached puberty asking 30 year olds who might be consious about their age :L uhhhh yeah 😛

sick gull
#

Yeah I def agree. Especially w/ IDs now.
Some bar groups still don't trust the ID system in place.
._. if someone went to the extent to fake an ID. I am 100% certain they can memorize a fake birthday

#
Gumroad

Fully customizable admin tablet for your VRChat World completely modular for easy setup/modification. This is the only asset you will ever need for managing your world and events!Please leave a rating on this product! Helps my product get recommended more! ⭐️⭐️⭐️⭐️⭐️➔ Features Local Toggles Synced Toggles Pickup Respawn Goto (teleport to a playe...

#

I saw this asset but I haven't found a world to test it in

#

and it seems to be meant for more personal clubs. Like the club owner literally owns the world and their "staff" pop in a keypad code to gain staff

silver hill
#

What features would the thing you're making include

#

Cant really read the code, so cant comment on your code :p

sick gull
#

Master rank -> Gives the user all perms
Security -> Give the user acces to verifying players
Worker -> Gives access to the drink spawn menu & behind the bar
Verified -> Access to the clerb.

Cool is just a test for syncing crap.

I also want a jail feature cause it is CINEMA in sunset bar when you lock people up for their wrong doing >:))

#

I basically wanna copy Just B Club 4.0s menu.

silver hill
#

A jail huh? sussy :L

sick gull
#

Don't do the crime if you can't do the time 😎

silver hill
#

This is VRChat, there will be many who are just masochists 😛

sick gull
#

Oh yeah. We had this youtuber troller who we were ragebaiting for like an hour in the jail cell. IDK why he stayed but he really enjoyed it I guess

deft bay
#

I need help with networking! For teleporting of multiple people (port key)
and with sync appearing of objects so multiple people can see it.

Are there udon experts here?

sick gull
#

You can follow this button tutorial and modify it to teleport more people.

deft bay
#

Well my thing is I need one person touch another one with a stick to teleport him and himself to a spec position

#

My attempts didn’t finish successfully so far.

sick gull
#

OnPlayerCollisionEnter maybe?
Have it store the name on a synced string.

Then have a method you call CustomNetworkEvent(Event.Target.All (or something), nameOf(TeleportPpl))

#

TeleportPpl will check if the machines localplayers name shares the synced string, if it does, teleport them & the machine holding it.

deft bay
#

Will it work up to 55 players?

sick gull
#

so you dont wanna teleport just 2 people?

deft bay
#

I do, my purpose is to have one person (teacher) touch his student with a stick and teleport him to a room for a conversation.

I though of doing it where they touch same object like card together and that will teleport them but it doesn’t work properly

sick epoch
#

Figure out who enters the collider and who is the owner (person holding) the stick

#

Tp them both

deft bay
#

Whenever I pick up and hold a “card” and then someone touches it I myself only teleport but not the other one. And then it teleports me back and forth randomly

sick gull
#

Can you show the attempt?

deft bay
#

Yes, 1 min

#

Side question, does Vr chat allows to track colliders on our virtual hands?

#

I found it only works with feet? 🤔

twin portal
#

eh? no, you can use GetTrackingData to track the position of the hands, and put colliders on them

#

Your teleport process should be relatively simple, with the only real problem being that only the local player can teleport themselves, so your implementation would need to account for that

#

You can have a collider with OnPlayerTriggerEnter on it; when it triggers, check for a few things

  1. if the local player is also the one who fired OnPlayerTriggerEnter, then that's the player that was touched by the stick. Have them teleport themselves
  2. if the local player was not the person that fired the event, then we know we're someone else. Then, check if the local player is the one holding the pickup. This is the second player that would then teleport themselves.

Everyone else would do nothing, presumably
You could do some additional checks to make sure that someone is holding the pickup before teleporting, or someone could just walk into the stick and teleport

deft bay
#

Ok, let's brake it down. Here is the script that works 100% for one player:

#

Not sure if you're seeing the code....

#

in full

twin portal
#

you need to wrap your code in triple backticks ``` so it formats nicely

deft bay
#

on both ends?

twin portal
#

yes

deft bay
#

man..

#

Sorry I am still learning discord lol

#
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;

[UdonBehaviourSyncMode(BehaviourSyncMode.None)]
public class TeleportOnGrab : UdonSharpBehaviour
{
    [SerializeField] private GameObject object1; // The pickup object
    [SerializeField] private Transform position1; // Teleport destination

    private VRC_Pickup pickup; // Pickup component
    private Vector3 firstGrabPosition; // Position where object was first grabbed
    private bool hasTeleported = false; // Tracks if you've teleported to position1
    private bool isFirstGrab = true; // Tracks if this is the first pickup

    void Start()
    {
        if (object1 == null)
        {
            Debug.LogError("[TeleportOnGrab] Object1 not assigned!");
            return;
        }
        if (position1 == null)
        {
            Debug.LogError("[TeleportOnGrab] Position1 not assigned!");
            return;
        }

        pickup = object1.GetComponent<VRC_Pickup>();
        if (pickup == null)
        {
            Debug.LogError("[TeleportOnGrab] Object1 needs a VRC_Pickup component! Please add one in the Unity Editor.");
            return;
        }

        Collider col = object1.GetComponent<Collider>();
        if (col == null)
        {
            Debug.LogError("[TeleportOnGrab] Object1 needs a collider for pickup! Please add one in the Unity Editor.");
            return;
        }
        if (col.isTrigger)
        {
            Debug.LogWarning("[TeleportOnGrab] Collider is a trigger. Pickup might behave oddly unless intended.");
        }

        Debug.Log("[TeleportOnGrab] Initialized - Object1: " + object1.name + ", Position1: " + position1.position);
    }

    public override void OnPickup()
    {
        VRCPlayerApi player = Networking.LocalPlayer;
        if (player == null || !player.IsValid())
        {
            Debug.LogError("[TeleportOnGrab] Local player invalid during pickup!");
            return;
        }

        Debug.Log("[TeleportOnGrab] Picked up by " + player.displayName);

        // Record position on first grab
        if (isFirstGrab)
        {
            firstGrabPosition = player.GetPosition();
            isFirstGrab = false;
            Debug.Log("[TeleportOnGrab] First grab position set to " + firstGrabPosition);
        }

        // Schedule teleport with 1-second delay
        SendCustomEventDelayedSeconds(nameof(PerformTeleport), 1f);
    }

    public void PerformTeleport()
    {
        VRCPlayerApi player = Networking.LocalPlayer;
        if (player == null || !player.IsValid())
        {
            Debug.LogError("[TeleportOnGrab] Local player invalid during teleport!");
            return;
        }

        Vector3 teleportPos;
        Quaternion teleportRot;

        if (!hasTeleported)
        {
            // First teleport: Go to position1
            teleportPos = position1.position;
            teleportRot = position1.rotation;
            hasTeleported = true;
        }
        else
        {
            // Second teleport: Return to first grab position
            teleportPos = firstGrabPosition;
            teleportRot = Quaternion.identity; // Default rotation (facing forward)
            hasTeleported = false; // Reset for next cycle
        }

        player.TeleportTo(teleportPos, teleportRot);
        Debug.Log("[TeleportOnGrab] Teleported " + player.displayName + " to " + teleportPos);
        // No pickup.Drop() - you keep holding the object
    }
}```
#

finally

#

Anyway, with this code, if i pick an object, it will teleport to a position with no problem after 1 sec

#

if i pick it up again from there it will put me back to orginal position, and i can do it back and forth

#

now, if i want to add a second player, this is where it breaks

twin portal
#

right.... because this script only does one player

#

so you still need the implement the whole "poking" thing

deft bay
#

this one will not teleport second one and it will teleport me (1st player back and forth sporadically

twin portal
#

that's because you're using OnTriggerEnter, which fires for ANY collider that successfully collides with the object

twin portal
#

You need OnPlayerTriggerEnter

deft bay
#

ok, let me try it

twin portal
#

this function gives you a parameter player; this is the player that got touched by the collider, so this is probably what you want to assign your touchingPlayer variable to

#

probably also need to do a check to make sure the touching player is not also the one holding it. or you'll just self-collide and trigger it

#

ah you've got that already, touchingPlayer != holder

deft bay
#

ok, trying it now

#

Btw, when I leave sync method as manual, it gives me error as “card” has obj_sync to it. Then I change it to continuous, does that contribute to a problem?

twin portal
#

yes because ObjectSync requires Continuous sync, and the most restrictive sync type is always used; so in this case, if you set it to Manual sync, ObjectSync will stop working properly, hence the error

#

so you'll have to keep this one as Continous. but I don't see a reason this needs syncing at the moment

deft bay
#

Well, what happens is without obj.sync script if two players in world we have 2 separate “cards” if I move mine it doesn’t move on his side

twin portal
#

yes, because that's what ObjectSync does. it syncs the object's position between players

#

if you don't have it, you won't see the same thing

deft bay
#

Right, that’s why I am using it in that set up, but other script gets mad if I keep that sync is manual vs continuous because of it…

#

Which I keep it as continuous was just wondering if it brakes something or not

rugged dock
#

Hey @twin portal, sorry to ping you, but I really wanted to see if I could obtain your assistance again since you were such a lifesaver last time, I want to make a pickupable object, which combines with other objects of the same kind into one, and shows a number above it representing the number of stacks it represents, and I'd also like to make it so you can separate stacks from it if you ever wanted to "break a bill" so to speak.

twin portal
#

could maybe use an object pool for that

#

just Return the object it touches to the pool, then maybe OnPickupUseDown Spawn the object

#

just get the length of the pool to show how many is stacked into one

#

you'd probably have to have only one "stacking" object like a wallet or something for that to work well...

fossil kite
#

are there any examples for the intended way to add a VRCUrlInputField to your scene? everything else has a handy automatic entry in the 'UI' section of the right click menu, but this seems to need to be made manually, even though it requires other components to work? and it seems like it doesn't even work with TMP text fields, even though all the (VRC) items in the menu use TMP?

fossil kite
#

What does it mean if a VRCImageDownloader is able to display fine when the material's shader is Unlit, but if the shader is Standard it just turns flat black?

fossil kite
#

I mean more like a guide with steps

#

I did get it working by looking at a video player but I'm still curious if I did it as intended

finite sequoia
#

I'll be trying another approach for PixelCanvas, as suggested by another dev...And feel a bit dumb for not thinking about it sooner. "Chunks, just like Minecraft". Instead of running the whole FOR in one go, just spacing chunks of it throught a few frames to give some breathing room.

finite sequoia
#

is any of these two nodes reliable as identifying and comparing an object goes...?

#

since it will be chunks, aka smaller arrays, I can't just swap the reference on the fly for communication,
so I was thinking that pen's logic could be changed to:
"identify what you collide with ->
send ColorID & the object info to the chunk managers
-> run the tile color change and data save in the managers (slow delayed sequence)"

finite sequoia
#

looks like hash worked, I now aquired chunks ayaka

finite sequoia
#

aaand of course when there's more than one player everything breaks...I swear I hate networking so much...

#

that thing makes no sense...I give up for now...

tender jetty
#

So for the last half day I've been trying to make this syncing work, but nothing I've done works. The basic idea is that you run into an item (in this case food ingredients), it makes itself disappear while also adding +1 to an INT parameter in an animator. Once the INT is the right number, the animation plays. So collect enough items, then animation plays. I've tried following examples I've been directed to but nothing works and it all breaks or doesnt even build the world due to errors. The image provided is the basic script set-up with nothing to do with syncing, just the base graph.

twin portal
# tender jetty So for the last half day I've been trying to make this syncing work, but nothing...

you're just changing the parameter on the Animator, which won't be able to be synced directly. Additionally syncing collision/trigger events can be a little tricky.
Edit this so that you have your own integer variable, and increment it where you would usually, and check the "send change" box on the variable's Set node.
Then, use a Change node (hold alt while dragging node onto the graph). This event will fire whenever this variable changes its value. Use this node to simply SetInteger on the Animator to whatever your own integer currently is.
With the Animator set up to handle this process, your integer set to be synced, and the script set to have Continuous sync, everyone should have the same integer, and thus the same Animator state.
For this to work cleanly though, we need to change it so that only one player runs the OnPlayerTriggerEnter code. Just check that the player who caused the trigger to fire (the VRCPlayerApi player output on the OnPlayerTriggerEnter node) is also the local player, so that only the person who actually touched it runs the rest of the code. Before you Set your integer variable from before, you need to set the local player as the owner with Networking > SetOwner.
The part that disables the object needs to be synced too; that can be done by separating those nodes into its own custom event, then calling SendCustomNetworkEvent to disable it. Unless this also needs to be synced for late joiners, then you can do the same Change event with a boolean that controls if the object should be enabled or disabled.

tender jetty
fallow mountain
#

because right now, you can repeatedly walk in and out of the trigger to add INT

tender jetty
fallow mountain
#

ok it can be its own process before adding INT, dont worry about it now

#

one thing at a time

#

so to track INT, are you just tracking it on this pickup (which you shouldn't) or is there a central stats manager script somewhere else?

#

if you sync the INT you effectively are treating all players as one single player

#

one person pick up, INT +1, another person picks up, INT +1 again

#

so.. what is your world doing exactly, what is INT for, how is it normally added and used... you gotta architecture from big to small

#

i wouldn't make a health potion remember my HP for example

#

so i would instead have a pickup item just do one thing, that is increase an INT stored in a player's player object i.e, stats manager script, and the stats manager script is responsible for playing animations for each player

#

so each player object syncs their stats, and then locally check if it has reached a number, if yes then play animation

#

so the only thing that is networked is player stats

#

(and some disable event for the pickup i suppose)

tender jetty
#

I wouldn’t even know where to begin to do that with graphs, my only knowledge comes from tutorials I find online.
I might just change the system to something that doesn’t use INT because it seems too complicated just to make sure even two players can have the same effect.

fallow mountain
#

well, it doesnt need to be complicated, but what you do depends on what you want to achieve...

#

and you want the simpliest solution to what you want to achieve

tender jetty
#

All I want is for an animation to play when the int reaches the right number. The int would increase when a collectible is collected. Players work together to collect the collectibles. All of that I can do with a script already except for just syncing it

strange token
#

I only know U# so if you’re doing udon graph I won’t be able to assist with the actual set up, but that’s the steps needed to be able to increment something synced like that

twin portal
#

you see the part where you do Addition on the animator parameter? just hook that into your int instead

fallow mountain
#

alternatively, send network custom event to ask the owner to add the int (and manage cooldown timer by one person rather than passing around)

#

(because if two people pick up at same time, they will both try to add the int at the same time, and if there is lag, they might bypass any cooldown)

tender jetty
twin portal
#

I would also Get the value of the Int, instead of from the animator

#

so all you're doing is taking your Int, adding 1, setting it to this new value, then it will be doing the "sendChange" part automatically

#

that's where the Int Change node comes in. Use that event node instead to set the Animator's parameter with SetInteger

tender jetty
#

So it'd be something like this where what I had for the animator is connected to the Int Change event and the Set Int is the one running from the PlayerTrigger Event

fallow mountain
#

maybe like this

twin portal
#

yea almost, Uzer has the right corrections

#

you're currently getting the parameter from the Animator, and then just setting it to what it already is. lol

#

you want to set it to your int

#

which maybe could use a better name

tender jetty
#

So something like this?

fallow mountain
#

yea i would call it EatAppleCount or something more specific than just "int"

#

because i thought all this time your int is Intelligence

twin portal
#

I think that SetOwner node needs the "player" input, plug in Networking > LocalPlayer into it

tender jetty
#

Alrighty there we go

fallow mountain
#

request serealization

#

to sync Int to other people, so other people can add to the number when they pick up the next apple

twin portal
#

if it's continuous it won't need RequestSerialization

fallow mountain
#

wouldn't that take up bandwidth when not needed?

#

or is it actually faster

#

than serialization?

twin portal
#

I think for this little of data, either sync method won't really matter to use

tender jetty
#

Well awesome, thanks for the help. Ill test it out with a friend of mine later today to see if it works properly. If not Ill just come back and see what I can change

tender jetty
#

Alrighty I ran into my first problem when testing it. When collecting the food items, the animation only plays if the transition condition equals 1 (or is greater than 0). That means that when a collectible is gotten, the integer is only being set to 1 instead of adding to the int.

#

and when testng with two clients, it wasnrt sync'd anyways

fallow mountain
#

is sync set to continuous?

#

is FoodInt ticked as sync?

tender jetty
#

yes and yes

fallow mountain
#

so u mean, ur animator expects it to start from 1?

tender jetty
#

To put it more clearly, you can see I have the transition condition here set to Int=5, so the next animation will start once Int equals 5. I have 5 of the collectibles out for testing before I make more. So each collectible SHOULD add 1 to the Int equaling 5 and trigger the transition condition.
That doesnt happen though when the 5 are collected. I messed with the transition and saw that when its Int=1 the animation will play but not when it's any other number, only 1.

fallow mountain
#

idk, it says 5

tender jetty
#

A comparison might be easier. The first video is when the condition is INT=5 and the second is when INT=1

#

Nothing else was changed, just the condition number

twin portal
#

oh I know what it is

#

you've got a copy of this script on every piece of food

#

which will have its own int, not shared between them

#

collecting 5 of them won't set the animator's parameter to 5, it'll set it to 1, 5 times in a row

fallow mountain
#

lmao

#

yeah that must be it

tender jetty
#

Oh dang it. How do I set it up so they share the int? Would that be through the graph or placing the script on something different?

twin portal
#

you can change the setting of the Int; rather than adding 1 to itself, add 1 to the current parameter
it would be more stable if there was a cental script that kept the count of all the pickups though

tender jetty
#

no clue how to set up either of those

twin portal
#

the first option you were basically already doing

#

do this again

fallow mountain
#

yeah you need to read from, and write to the animator int directly

twin portal
#

no just set the int here, and keep the Change event setting the animator

#

this is the quick way but probably will network inconsistently if multiple people are picking things up simultaneously

tender jetty
#

Yeah the Int=5 worked, but the int didnt sync between clients, the collectible turning off did though

twin portal
#

all of your animator nodes are Equals to check for 1,2,3,4, and 5?

#

so if a player's animator is on state 1, the network sync skips to 3, the animaton won't reach the state it needs ot

tender jetty
#

Actually I just swapped some nodes around and got it working. From the player trigger to becoming owner, then transitions into the sendnetworkcustomevent. Then the custom event activates the int change and the collectible turning off

#

worked for both clients when I just tested

#

Dont know if this is the most optimal way, but at least it worked

twin portal
#

all that matters is it works

tender jetty
#

Just to make sure, is there risk of lag or anything due to the sync?

twin portal
#

not lag, no

#

especially not syncing a single integer

tender jetty
#

awesome

fossil kite
twin portal
#

280,496 bytes

hybrid kindle
#

where am I going wrong. I have an array of materials to swap on this skinned mesh renderer, but I want it to swap only the second element. Theres other script for actually doing it but im getting errors in this part.

twin portal
#

what is the error

hybrid kindle
# twin portal what is the error

[UdonBehaviour] An exception occurred during Udon execution, this UdonBehaviour will be halted.
VRC.Udon.VM.UdonVMException: The VM encountered an error!
Exception Message:
An exception occurred during EXTERN to 'UnityEngineSkinnedMeshRenderer.__get_materials__UnityEngineMaterialArray'.
Parameter Addresses: 0x00000014, 0x00000028

Object reference not set to an instance of an object

twin portal
#

possibly this component is coming up as null

fallow mountain
#

the material is set to an int, and then it tried to set it as material

#

shouldnt this be a material?

hybrid kindle
#

Still having issues when it gets to the set value node. I tried setting it to the material array but the int determins what material in that array is chosen.

#

[UdonBehaviour] An exception occurred during Udon execution, this UdonBehaviour will be halted.
VRC.Udon.VM.UdonVMException: The VM encountered an error!
Exception Message:
An exception occurred during EXTERN to 'UnityEngineMaterialArray.__SetValue__SystemObject_SystemInt32__SystemVoid'.
Parameter Addresses: 0x00000015, 0x00000016, 0x00000017

twin portal
#

I think SetValue may not be the node you want to be using

#

I'm not seeing a SetValue node for just Material, I think SetValue does something different and isn't specific to Materials

#

you're trying to set the material in a specific slot on a mesh, right?

#

or just the texture?

hybrid kindle
#

or i suppose element 1 cuz coding shenanagans with unity

#

the logic for the material array swap itself is already set up and works, i just cant really get it to do the element 1.

twin portal
#

I think you'll want to be using sharedMaterials, setting the mat at index 1, and then setting sharedMaterials back to the renderer

#

SetValue isn't the right node, and at the end you're setting "sharedMaterial", which will always be the first material on the renderer

#

try adding these nodes instead

hybrid kindle
silver hill
#

So I was just thinking, if I have a networked event that causes an object to instantiate, but i want said spawned object to then be networked, is that even possible? Because I can imagine all that will happen if I network event an instantiation it will spawn a local instance of the object for every player but wont be networked...

#

Would an object sync component rectify this?

twin portal
silver hill
#

Oh really? I see, that is troublesome news

twin portal
#

an alternative could be to use an ObjectPool or PlayerObjects, depending on implementation

silver hill
#

So if I want a sort of enemy spawn system, the enemies have to be hidden somewhere in the world and simply teleported

twin portal
#

pretty much, and an ObjectPool would be able to handle that

silver hill
#

An objectpool... do you mean "Gameobject[]" ?

twin portal
silver hill
#

Hmmm, if I have to use preinstantiated mob entities, perhaps I could link all their AI's together and using a central AI controller, could have many hundreds of enemies on screen with little performance drop

twin portal
#

if we weren't talking about game development, what you just said sounds like something a mad scientist would say

silver hill
#

I want a balls to the wall monster slaying game for VRChat, no messing around

#

Using everything that I know I will push VRChat to its limits muuhahaha!

#

This non networked instantiation is an issue though... will through some hurdles in the way...

silver hill
#

Getting this message, not sure what it means

#

Happens whenever I spawn a remote player

fallow mountain
#

vrc pickup, player persistence object 6

finite sierra
silver hill
#

Oh! Interesting, I know some games like to hide their enemy entities off screen somewhere for the games to call upon but I always thought that it uses them as a basis for an instantiated clone.

digital oriole
fallow mountain
#

you know there is a world called vacuum cleaner simulator or something, with easily many thousands of particles that can be "killed". i wonder if u can adopt it to make it a monster mass murdering simulator

strange token
#

I made my own VRCObjectPool for my coin system but honestly those coins are so broken I can’t tell if the object pool has bugs or it’s just the coins 😂

#

Every time a coin is reused after being used once that instance, it’s spawnpoint is offset to somewhere in the sky

sick gull
#

check the spawning crap out

#

Is it based off a transform or something?

obtuse echo
fallow mountain
#

i guess particles, because it looks like particles

#

but idk

obtuse echo
# fallow mountain but idk

I was mostly curious how they do the point counting. I assume they use a combination of attractor zones and OnParticleTrigger? I have never tried it though.

#

Curious if that works in VRChat

tawdry silo
#

Does Start() run locally for users joining existing instances?

tawdry silo
#

gosh

fallow mountain
#

you should look at the in game log and see what the error says, it will be easier

brisk spade
#

My world has developed issue with (at least) two scripts having syncing issues. I know about these two due to them having logging, but they both used to work.

On one, it doesn’t ever log OnDeserialization happening, nor any udon exceptions I can see - and all the local aspects of it appear to still work.

Script is marked (via annotation) a manual synced. The sync code is simple — variable = json, RequestSerialization, log that it was sent. The log message is being logged when the first person joins the world.

Additional joiners wait for OnDeserialization, and that logs success OR failure at parsing, and has no other way out of OnDeserialization except exceptions. Nothing is logged. So data is being set, but not received. Variable is [UdonSynced] and private.l though I tried making it public. I don’t think I modified this script since it worked.

The other is the opposite:

in this case there are two udon scripts on the game object. One marked [NoVariableSync], the other is manual. In debug view both are shown as manual. In this case OnDeserialization logs receiving data 2-4 times per second. There IS a code loop here as the synced script is a helper — it gets the synced data, calls the main script with it, then the main script calls all listeners to alert them to data having changed. The helper has a check and throws it away if it’s unchanged and returns, doing nothing. In this case, I only see this on the second joiner as well (but there is no special check for this condition this time!) when the update method is called it logs both when it sends and ignores the data, and it’s only logging ignored statements. The first person in the instance logs neither event happening, nor OnDeserialization being called.

If the associated button is manually toggled the syncing DOES work…

This second script was definitely not changed.

I did change from the beta sdk (had a bug fix I needed) to the updated stable sdk.

But at this point I’m at a loss.

#

This is happening in my dev copy of the world and preventing me from pushing it to production.

twin portal
brisk spade
#

so i can try that.

heavy spindle
#

Also, the person calling RequestSerialization() doesn't get an OnDeserialization event

brisk spade
#

No, but the other person does... but isn't

heavy spindle
#

Yup! OnDeserialization is for clients not in control of data being told that there is new data and that all of the data was unpacked from the packet sent by the Owner and is ready for use

brisk spade
#

I need to figure out the quick launcher as that'll let me test both sides locally?

twin portal
#

this will probably log the same way it's currently behaving

brisk spade
#

I'm new to u# and dealing with persistence and syncing data in the same script - everyone needs to agree. So many edge cases.

brisk spade
#

So, changed logging.

#

script 1, not receiving updates: It'scalling requestserialization, but OnPostSerialization isn't logged.

script 2, constant OnDeserialization: it's not calling RequestSerialization (except when manually toggled), but OnPostSerialization is firing multiple times a second.

#

It's like it's using the wrong sync mode

twin portal
#

are you ensuring that the owner is calling RequestSerialization?

brisk spade
#

this was just me in the instance.

twin portal
#

then yeah you'd want to check the sync mode. If OnPostSerialization isn't being called, then the serialization is never happening, despite being called

brisk spade
#

This is the one not calling it:

[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
#

I may take the annotation off and use the dropdown

brisk spade
#

So right now, this is one of the scripts I'm seeing issues with. Possibly I'm just missing something due to my lack of experience with udonsharp (and csharp). This one is the one that's constantly sending updates. It's tagged with [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] (does the fact that I'm using an abstract base class impact this maybe?)

On the object owner side:

2025.03.31 02:57:06 Debug      -  [ToggleManagerSync] OnPostSerialization() _syncedState=False success=True bytes=18
2025.03.31 02:57:06 Debug      -  [ToggleManagerSync] OnPostSerialization() _syncedState=False success=True bytes=18```

On the other side
```2025.03.31 03:55:52 Debug      -  [ToggleManagerSync] OnDeserialization() _syncedState=False
2025.03.31 03:55:52 Debug      -  [ToggleManager] Set() False->False
2025.03.31 03:55:52 Debug      -  [ToggleManagerSync] (ignored) Set() _syncedState=False, newState=False, oldState=False
2025.03.31 03:55:52 Debug      -  [ToggleManagerSync] OnDeserialization() _syncedState=False
2025.03.31 03:55:52 Debug      -  [ToggleManager] Set() False->False
2025.03.31 03:55:52 Debug      -  [ToggleManagerSync] (ignored) Set() _syncedState=False, newState=False, oldState=False```

Please excuse my code. I don't know the extant of what I can do with either c# or u# yet.

Sync helper
```using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon.Common;

namespace HeatherMay.ToggleManager {
    [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
    public class ToggleManagerSync : ToggleReceiver {
        [UdonSynced] private bool _syncedState;

        public override void Set(bool newState, bool oldState) {
            if (_syncedState == newState) {
                Debug.Log($"[ToggleManagerSync] (ignored) Set() _syncedState={_syncedState}, newState={newState}, oldState={oldState}");
                return;
            }

            if (!Networking.IsOwner(Networking.LocalPlayer, gameObject)) {
                Networking.SetOwner(Networking.LocalPlayer, gameObject);
            }

            _syncedState = newState;
            RequestSerialization();
            Debug.Log($"[ToggleManagerSync] Set() called RequestSerialization()");
        }

        public override void OnPostSerialization(SerializationResult result) {
            Debug.Log($"[ToggleManagerSync] OnPostSerialization() _syncedState={_syncedState} success={result.success} bytes={result.byteCount}");
        }

        public override void OnDeserialization() {
            if (!manager) {
                Debug.Log($"[ToggleManagerSync] OnDeserialization() called without manager set");
                return;
            }

            Debug.Log($"[ToggleManagerSync] OnDeserialization() _syncedState={_syncedState}");

            manager.Set(_syncedState);
        }
    }
}

Abstract base

using UnityEngine;

namespace HeatherMay.ToggleManager {
    [RequireComponent(typeof(ToggleManager))]
    public abstract class ToggleReceiver : UdonSharpBehaviour {
        protected ToggleManager manager;
        abstract public void Set(bool newState, bool oldState);

        void Start() {
            manager = gameObject.GetComponent<ToggleManager>();
            if (manager != null) {
                manager.RegisterListener(this);
            }
        }
    }
}```
#

The other one isn't syncing at all, and is a fair bit more complicated, but I suspect the root cause is the same.

faint rock
# tawdry silo gosh

Everyone is running their own copy of the world, so as far as Unity is concerned, the world started when you loaded it. Lots of things make more sense when you see it from that angle. Also how everyone is basically running single player with some things explicitly networked, not a central "thing" that everyone is seeing.

brisk spade
#

Whelp, I think I've solved it.

  1. Not syncing: This was an error on my part multiple steps away that resulted in one script turning the object off. Apparently even off enough runs that it did everything BUT sync.
  2. Continuous sync: Class was marked as [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] but the abstract base didn't have any attribute set, and the other class on the object was set to NoVariableSync; my understanding was that NoVariableSync can be used with Manual or Continuous - and I guess technically it can. Sync got forced into Continuous.

The only way I was able to get it to do manual sync was have the component, the base class, AND the other component all agree. It would do manual syncing IFF the base, the component, and the other component on the game object either all had the [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] OR none of them had the UdonBehaviourSyncMode attribute at all and I set it instead via dropdowns.

#2 here specifically I don't fully understand. If anyone can help me understand what's going on and how to do this correctly I'd appreciate it, as I'd prefer to set attributes on my components as appropriate, but it seems like there's interference there.

finite sierra
#

None of them can have different types. If so it would become the least restrictive which is manual

brisk spade
# finite sierra You can only have one type per object. If a object has multiple children who eac...

I was basing it on this:

NoVariableSync Enforces that there are no synced variables on the behaviour, hides the sync mode selection dropdown, and allows you to use the behaviours on GameObjects that use either Manual or Continuous sync.

Which I expect to mean I can safely have one component set [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] and another set [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] and it'd work. I also would expect that the base class - being only used as a base for the component, and not an actual component (it doesn't even have a matching u# asset) didn't matter, but in this case I either had to set [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] on all three, or remove that and set manual in the drop down. If I didn't, it was continuously syncing.

timber parcel
timber parcel
silver hill
#

Hmm, would the spiders even be able to do anything like perform attacks and whatnot?

#

Or even just animate?

#

and perform all the different animations for attacks and stuff

timber parcel
#

There are trade offs.

#

A good compromize would be having the particles swap in for real versions when they get close to the player

silver hill
#

Yeah like in Serious sam or epic battle simulator

#

I dont think I would be able to recreate something like that with my skill level

#

Im just using what I currently know I can do to acheive what I know I can acomplish

cold laurel
# timber parcel If you want to go REALLY efficient. You make a single AI controller that has a m...

.. the controller keeps track of their location and health in a massive synced array ..
I highly doubt this will work. Worlds like Zombie Survival have an entire custom network stack built for them.
They only sync the position once when the enemy is spawned. And then they keep the navmesh target synced. This way they can get away with a lot of enemies without clogging the network.
This approach assumes the enemies won't live long enough to desync too far, but generally it's fine™️

timber parcel
finite sierra
timber parcel
#

Yeah. Having predictable enemies is best network wise. If the are totally predictable you don't need to sync them at all.

finite sierra
#

each enemy most likely only has 1 or 2 synced variables that are updated somewhat frequent

cold laurel
finite sierra
#

most likely between 16-20 bytes per enemy

cold laurel
finite sierra
#

like what kind of custom? you cant really get around Udon's stack

timber parcel
finite sierra
#

so unless you mean like how they handle the updates etc

cold laurel
finite sierra
#

right. which wouldn't really do anything through.

#

anyway its beside the point.

cold laurel
finite sierra
#

also Kitkat which one of the zombie survival worlds are we even mentioning here?

finite sierra
#

i assume u mean the Rat Survival?

timber parcel
finite sierra
#

eh. Kaster just fyi you are heavily limited. 11 kb/s max. and that is generous. at most you are looking at maybe 5-6 kb/s

cold laurel
finite sierra
#

yes we have a 280.496 bytes max on manual but every second we can only put out as much as roughly 11 kb/s so its going to take around 25+ seconds to sync

#

and thats if it does not fail. or if its not clogged etc.

#

realisticly that much data would prob take 30+ seconds or maybe even 45+

timber parcel
finite sierra
#

not to mention Udon would have a hard time not struggling going through alot of loops every frame.

cold laurel
#

Not only do we have 6 to 8kb/s bandwidth for udon sync, but that isn't even the amount of usable data you can send

#

You still need to account for Udons massive network headers

cold laurel
#

How often are we talking here?

#

Lol

timber parcel
#

Why would you sync a few times a second?

cold laurel
#

Okay, great! That's where the misunderstanding happened.

#

I was under the impression that you wanted to do the ai behavior calculation on the master's side and then sync it out like object sync does but in a centralized manner.
This of course is a terrible idea.

#

I take it you're suggesting to instead use that massive vector 3 array once for the spawn positions?

timber parcel
#

Now before I continue, does udon syncing a array only send the changed elements or all elements?

cold laurel
#

No

timber parcel
#

That was a or question

cold laurel
#

It serializes all scripts and synced variables on the gameObject RequestSerialization was called on.

timber parcel
#

All, got it.

#

Okay, well need a master array and a transfer array, or split the array up over multiple objects... But that seems silly.

We set a certain value of enemies to get updated per second, transfer a chunk of the array to transfer array along with a index, then sync that, with a inverse offload script on deseralization of course

finite sierra
#

100s of Vector 3 in an array. that is alot of data. most likely 2.4 kb´or more.

timber parcel
tulip sphinx
#

even continuous sync is 5hz, not 20

timber parcel
#

nono, 20 from the list

#

Not syncs