to be saved on the server add a guid to the object
send("test", { guid:"...", myData: [ ... ] }
the guid can be the guid of your component that is sending, e.g. just: this.guid
thanks !
by user 700879811085598831
yes they show fine
by user 700879811085598831
looking at chrome’s dev tool, there is on my glitch page’s assets folder a css that overrides the style i had set in the project html back in unity
by user 700879811085598831
Oh ok, that is present in the project folder under styles …
by user 700879811085598831
i’ll be editing that then
by user 700879811085598831
I still don’t know why the skybox works on mobile ios and not on mac
by user 700879811085598831
Hey @marcel ! I rewrote my code including the send (JSON) function, however it seems that it works like a remote procedure call and won’t be transmitted to users joining after the call was made. Is there a way to create a state for the room that would be transmitted to all upon entering the room regardless of when the call was made, the same way the instantiateSynced function worked ? Could I use the @syncField decorator for my seed (2D array) ?
by user 700879811085598831
Did you send it with the guid
field? The server sends the saved state to all new clients when they connect later
Btw if you want to debug this: the glitch console should log some info when it receives or sends networking messages
You can try using syncField but I’m not 100% sure if it works correctly with arrays or jsonobjects (depends on the data inside the json object I think)
that was it ! I didn’t realize it was necessary for the server and thought it was only to differentiate internally between different components. It works perfectly now ! thanks !
by user 700879811085598831
For anybody interested :
myArray: number[][] = [];
onEnable(): void
{
this.context.connection.beginListen("networkedArray", this.onDataReceived);
}
onDisable(): void
{
this.context.connection.stopListen("networkedArray", this.onDataReceived);
}
onDataReceived = (data: any) => {
console.log("Received data:", data.worldSeed);
if(this.myArray.length===0)
{
this.myArray=data.worldSeed;
this.createWorld();
}
};
public sendArray(): void
{
if(this.myArray.length>0)
this.context.connection.send("networkedArray",{guid:this.guid, worldSeed: this.myArray});
}
private createWorld():void
{
//instantiate world according to received array
}
by user 700879811085598831
Happy to hear you got it! And yeah the guid key is used for storage, i think it’s also one of the undocumented things right now that should be added to the docs.
@Kevin would you want to share your code here? needle-tools/needle-engine-support Share · Discussions · GitHub
We’ll make it easier to discover code shared there in the future for others by e.g. automatically adding it to the docs
If you can share the complete code of that example component it would be nice
will do !
by user 700879811085598831
Hello @marcel ! about the skybox problem. It still doesn’t show up but I started integrating a canvas to test and a panel with no image assigned actually made the skybox show up within that panel (rect transform) as you can see from the video. The teal color outside of it is from css. On ios in shows up. Any idea where the problem could come from ?
by user 700879811085598831