#archived-networking
1 messages Ā· Page 117 of 1
ain't no thang
That's a nice saying
One more thing
How do I know how the network performance is
If it's good or bad
for realtime or http?
your realtime networking library can get you the ping value
mirror, photon etc
@late swallow If you learn a bit about playfab
Playfab?
You can host your unity instance there
I need to understand tick rate better lmao
Playfab does matchmaking and joins the players by static ip to a unity instance
You can have globally available matchmaking for server authorative game rooms
My gf has really bad internet and I don't know what a good tick rate would be for an acceptable experience
Oh ok, I'll look into that
If you are new to multiplayer game dev
And you are connecting by ip
You can use hamachi
It puts you and your friends in a virtual lan
Hamachi is easy
Hamachi is how you play minecraft with your friends
I know
same deal
But I don't want users to have to use that
Plus
I'm planning on releasing this on all platforms
And VR
So
No dice
I mean get the game working and somewhat fun first
And then worry about production maybe
Well if you know what you are doing
Server authorative realtime multiplayer is big issue you know
Wait so, my issue was validating data to be sent to the database
So if Firebase can do that
I am thinking
Then I might not need a dedicated server
You can have custom code in firebase that can handle some processing
That's what enables you to use it as a backend as well
But I might be wrong, not experienced in firebase
Hey anyone using photon for simple multiplayer ?
None of my animations are synchronized on the network
I see that my view is recognizing the animator view which is in a child gameObject, but I suspect that my animator view doesnt catch my view properly, even tho I got no error
Does the default animator view has to be on the same gameObject as the view ?
I've been advised to maintain a separate project for my server build to ensure security of some secret API keys that access the backend. (Playfab)
- I have heard #if server checks could mitigate the risk of a key leak.. is there anything else, and basically is it in any way acceptable to try ship from a single project.
I feel like if I'm #if checking throughout, making sure client never runs server calls I should be fine.. but I have no idea how vulnerable build apps are beyond decompiling..
as a solo developer, maintaining two projects for a single game has me worried.. š¬
you just have to keep the keys separate not the whole build
as a solo dev you have practically no chance to do everything right and secure, so if there is a dedicated third party that wants to hack/exploit you, they will figure out a way to do it
so keep backups and hide everything critical behind the security offered by playfab and other services you may use.
I guess with the editor extension playfab provides the key can feel "hardcoded" into the editor when server api is enabled.. (key being visible to the editor, non editable, generated for the title basically)
yeah exactly.. so I'm not too worried just trying to stick to best practice anyway.
you server build should not have any need for "admin" access to your server host
for example when a server is started I need to authenticate users; when I'm starting a server instance I pass in the server entity token, and on client side they'll be passing in their local profile key. In that case of a build starting a server I do need the admin access (though I'm not 100% if admin access is the same thing as server.. separate thing I think
*clients are not starting servers
so really, they have no need for that in their build.. which is why I was hoping #if checks would be enough
https://community.playfab.com/questions/20248/what-is-the-developer-secret-key-in-playfabshareds.html
found something reassuring
https://community.playfab.com/questions/18694/can-i-create-a-custom-client-and-server-in-a-singl.html
Yeah the forum is a confusing place lol.
everything about networking requires you to think about stuff five times from different angles until it makes sense
How does Unity internally test multiple clients with networking? Do you all build clients every single time you want to iterate?
You can use something like ParrelSync to open your project multiple times and run multiple clients without having to build.
just use the multi project thing
or get a good pc and just build 
Is that what you all use internally?
My issue in ParrelSync is that the two clients aren't agreeing on the NetworkConfig. It seems like they are getting different global hashes or something
Some of our teams use it. We used it in the development of Boss Room for instance.
Oh wow. What's your workflow when iterating on network code?
yes- this is why I bring this here so those angles might be covered more quickly with the help of someone who may have more experience in what I'm attempting. š
Apparently it does, finally got confirmation.
Server APIs require your dev secret key
those are probably not granting access to your account though, they just grant access to a specific app to access the networking API
you can also make those keys expire regularly, and you could just make a new build every day with a new key
dev secret key grants access to everything as far as I know, any player any thing it's the master lock
Never include your developer Secret Key in a client build that you send to your customers. Doing so exposes your title to abuse.
I'll just see what all goes into a separate server project I think. Might be less hassle in the long run day-to-day and there is an official example (stating it as the best option for security)
If your old keys are compromised, rotate the keys to return your Title to a secured state.
right- key is where they state Never include your developer Secret Key in a client build that you send to your customers. Doing so exposes your title to abuse.
rotating is a last resort, not something I'd want to be doing on the daily.
you are running in cricles here
just dont send the key in any form to a client
you have already described ways to do that, beyond that, rotate the keys
the way playfab works when you enable a certain API the key will be present in the build
I don't see it as running in circles š
I'm thinking through the options
thankful for the feedback provided
idk the api of playfab but if you need to compile keys into the binary that API is useless and i highly doubt they made it that way
well when their suggestion is always "make server/client project separate" I doubt they came to that conclusion (despite user feedback asking for other solutions) for no good reason
This is going to be the final point, anyway.. I'll try work through it.
i think you are misunderstanding what that recommendation actually means
yes I was reading it as can as in possible but not the recommended approach.. which was enough for me to reason with honestly.
I was also concerned not knowing what I'm doing my "diligence" when blocking off code for a server-only build would be lacking, exposing certain things.. I'll compare to their shared git project
What is required to keep your developer key out of a client build
What needs to be removed
Do you just need to remove the playfab shared settings SO or what?
If you follow the discussion there are some links to a forum that will give a better answer than I could come up with.
Do you know what exactly are "Server API endpoints". Obviously I need to be able to have my client make some API calls to be able to sign in and start servers, what API calls are the one you don't want included in the client build
Im stupid, https://docs.microsoft.com/en-us/rest/api/playfab/server/?view=playfab-rest the calls under the branch "Server" are server api endpoints
yeah client' model vs server.
Anyone here ever used Photon Networking for a shooting game? I'm currently trying to pass to other clients that the player has changed the weapon, I've tried using RPCs, Custom Properties, and PhotonSerializedViews and nothing seems to be working for me. Could just be set up incorrectly. If anyone has any experience with that it would be greatly appreciated. Been trying to figure out this issue for around 10 hours.
Is there a way to call gRPC on WebGL?
10 hours spent on syncing a weapon change? There are many many tutorials covering this sort of thing for pun surely.
(Pun is the networking, Photon is the company)
hi i am following the docs for Unity's new networking system and when i click 'Start Host' nothing happens. below is my setup
What are you expecting to happen?
it to spawn my object for the player in
no game object for the player is spawned in
Is the prefab setup correctly?
.
it's set up in that pic
i've tried setting it in player prefab and the network prefabs list
Lol. There are plenty of tutorials that follow it. That I stated above havenāt worked for me. I didnāt follow anyoneās weapon change so it could just be that when I try to implement their way of syncing it doesnāt work with how Iām implementing. Hence why I said itās not working for me and was asking for a more basic setup instead š also Iām well aware pun is the ānetworkingā if you want. Most people call it Photon since it stands for Photon Unity Networking
Instead of informing me that there are surely plenty of tutorials, that I surely have attempted to follow. Maybe try helping, since I asked for it. If I stated what Iāve tried Iāve surely attempted watching tutorials and reading the documentation first. š
Anyone is able to help syncing animation though network with PUN, doesnt seem to work at all on my project ?
Movements are successfully synced over network but no chances yet for animations.
I think this will be pretty straightforward for an experienced PUN dev,
I am able to pay to make it work or to know why it doesnt, I think this is just a matter of minutes to solved it.
Inside the photon animation view the animation parameters are listed are they changed from disabled to discrete?
Yeah I've changed some from disabled to discrete or continuous and nothing got synced
All the disabled ones will never sync though. None of them are working or just the disabled ones?
None of them are syncing, I have tried to enable them all without success
Could I see your script where youāre implementing them
Sure, thanks for your help š
I'm trying to implement it on top of Corgi Engine, which is a platformer engine on Unity
Here is the file referencing the animations, I can provide more if needed (I can see animation initialization around line 580)
I havnt modified the code regarding animations, I've just implemented the photon view on all related scripts to sync movement, which is working great,
Animations are being played perfectly on local for each player, but animations are not propagated over the network
"Most people" calling it photon would be wrong..
As photon holds multiple products ( as I'm sure you're aware. ) which people reference here..
-Pun
-Bolt
-Fusion
-Quantum
..these are all "Photon".
Yes, Pun is the popular one, just needed to clarify as these all work in their own way.
In Pun, changing an item should be as simple firing an rpc, as you've read in the docs.
If you are struggling with this particular area, feel free to post a snippet of the troublesome code for people to guesstimate what might be the problem.
Believe it or not, 90% of the people who come here "asking" for help do so without any prior research of their own.
Getting hostile isn't going to get you anywhere.. I wasn't attacking you when I was simply seeking clarity into the issue and suggested a tutorial, you gave virtually no indicator what might be the problem simply saying "I've tried all these different methods none worked".
Show your implementation, maybe someone else is willing to help you.
Only got hostile because you posted the obvious stating it shouldnāt take that long to figure out.. I know that which is why I was asking for help. Instead of posting smart aleck comments either offer help or donāt comment. Itās simple
You can't receive help making people beg to see your code.
I was sympathizing.. 10 hours is a long time we've all been there learning a new topic. Wasn't intended to come across as anything offensive.
You may want to go back and read my post.. I didnāt beg anyone to ask for my code.. I asked if anyone has ever accomplished what Iām trying and if they did what worked for them.
Definitely comes across offensive when your post seems as if itās attacking someoneās intelligence.
This is a very long script to read on my phone lol. Iāll have to try and help when Iām at my computer
I can't control how you take things.
If you tried as you've stated these various different ways of syncing the weapon change and all failed, and you're asking for help; without seeing your code and without being suggested a tutorial, what do you expect people to do?
Just move on. Iāll get help from others or continue figuring it out on my own. Have a good one
Cheers mate.
Thanks, I'll stay here please let me know šš
It looks fine to me, I'm not sure why it's not working. Hopefully someone else can see what I'm not seeing is causing the issue
Many thanks for your help, I'll keep searching
ok so, I literally can not find an answer to this and I have no idea where to ask
so, I'm just gonna do it here
I need to make a dedicated server for my game
and my project is a social platform as well, using Firebase
I wanna know where I should verify data and stuff
if a user requests to see another user's profile, I need the server to check if their profile is set to private or not, and return an answer accordingly
do I do all of this on the server build or...?
do I need to do this in Firebase?
Firebase has a discord, you might wanna ask the question in there too
thank you!
is there a plugin or something that can allow all devices to connect to my game without the internet? in other words, a NAT hole puncher or net play or something like that. someone can help? i want to connect device directly to other devices in the area.
@lethal tree does it explain how to connect in the guide?
it should iirc
Gotcha, I think I was confused because the unity looks different from mine
I thought it might have been outdated, which is why I came here. Thank you!
Actually, how do it get the options to appear
I have very little compared to the guide
This is the guide
This is mine. Am I missing something?
why did you take a pic of your inspector yet manage to take a screenshot of the guide?
I'm getting into backend stuff for a sever authoritative title, wondering if using the exclusive server API itself is the go-to way since it seems to me more straightforward than if you were to use cloudscript since there are less steps to verify, right?
A simple example client sends command in game asking for x gold, server verifies, uses server api to change player's gold to x in the cloud. Simple, secure..
Where in cloudscript, you're sending logic directly to the cloud from the player to change gold to x.. and then you're supposed to verify it in the cloud?
I'm not understanding the need for cloudscript I guess, I know it's supposed to make things simple, but in doing so it feels like it's also adding more complexity in terms of security.
There are plenty of videos outlining the simplicity of cloudscript, but they never seem to touch on cheat prevention which seems like an obvious rule of thumb
Though now that I'm thinking about it if your client is part of the server's simulation you're not even needing to verify on the cloud since any value sent from the client is reverted to the server state anyway- š
@mortal horizon š Cause I was reading the guide on my phone and my pc canāt handle unity and a screenshot program lol
okay so I have a script which disables and enables buttons, but for some reason it's not registering the press. even after assigning it to a specific void, it still won't register the press, this only happens with my networking projects specifically(Mirror) anyone know how to fix it?
Iāve gone around trying to figure out how to connect unity to photon but I keep getting both a OnConnectedToMaster and OnJoinedLobby error. Iāve gone around trying to google and find videos but Iām lost. Does anyone know the next step?
which package should i use for multiplayer as a beginner?
Hi, I'm trying to have a pause state for my player when in a photon match, they'll be able to press a button to leave the match and go back to main menu
But the button itself seems to not work at all, not even hovering over it does anything
No clue on why.... any ideas?
Hello everyone. I was just able to get my multiplayer tested and working. But there is extreme lag. Does anyone know how to fix this? Thanks
How many tabs are open? I mean youāre running 2 clients with a whole server. If itās really annoying then close all extra tabs open thatās all I can really say
It was two different computers
who can help me with photon 2 , i try copy 2 videos and don't work .. ?
or you recommand other "asset"
What specifically didn't work?
when i try connect and press join , nothing happen
if you have a tutorial can help me with all [JOIN / JOOBY / START GAME] ty ā¤ļø
Would definitely start by googling around if you haven't already
Many tutorials that walk you through step by step no point linking pick the one that works.
What should I use to create a multiplayer game? Riptide networking? Mirror etc?
What is the easiest
Depends on who you are, what you know and what you want.
So a problem is becoming really frequent and is very very annoying. This has to do with the playermodel and viewmodel and who it shows upto which screen, I want the localplayer to see other players as the playermodel, while the viewmodel only shows up for the localplayer. It was fine before, but once I added a class picking system, it broke it and now, for some reason once a new client joins, they are seen as the only localplayer as the most recent's code is working properly, but for some reason, everyone else isn't even on their screens, leading to them only seeing the insides of the playermodel with no viewmodel.
That's very subjective, Mirror is more fiddley, and so is Riptide, but Photon is more simple/widely used but will probably end up being more expensive if you're comparing it to Mirror and RIptide. Which don't have dedicated servers unlike photon, but if you're putting your game on steam, it would cost much less.
hey guys can some one help me please with photon 2 projectile syncing I don't really understand how can i send the projectile position through an RPC when i cant send game objects or transforms via RPC function
(Photon PUN)
Ok so like when transferring ownership to another player, does the gameobject need a photonView itself? And if so, how would i go about a online block based game?
Oh shit one second
Guys i'm using Mirror for my multiplayer but what should i use instead of NetworkBehavior on the class?
I can't find xr legacy or multiplayer hlapi
Can someone help me?
nvm i found the problem
For anyone that wants to know you should put using Mirror instead of using UnityEngine.Networking;
Ownership is only defined for networked objects, so yes, they need a PhotonView.
You don't want to have hundreds or thousands of them in your game (depending on what they are used for). So if you need to refer to blocks, you could possibly also index the blocks and use that as reference (you don't have to use PhotonViews to sync updates / changes).
You may want to join the Photon Engine Discord and ask this in the #pun channel. This question may turn into a somewhat longer conversation...
Overall: If you can, avoid sending updates for projectiles. As long as everyone knows when a shot was fired, where and in which direction, you can usually show it in adequate precision over the path of the projectile (if it's visible at all).
Have a look at the included samples (in the PUN package), to get an idea how they sync shots (the PUN Basics Tutorial and the Asteroids Demo both include shooting).
hey, thank for the answer, yes I did check the tutorials and the demos too, but in the demo they sending transform and i was copying the code and its just not working for me for some reason, the projectile it still doing its job so all the clients can see that the projectile is decreasing the enemy health its only the projectile it self is not visible
and yes i posted in photon engine too , but in that channel i never got an answer š
That happens. There is no guarantee to get a fitting reply. It might make sense to ask again with some more info on what you are after, etc.
E.g. is it a slow or a fast projectile? Could a raycast be enough for the hit calculation (and a line renderer would be enough visually) or do you need to follow the path of the bullet, etc.
Hey, what would be the best multiplayer solution for a turn based strategy game?
I have only used the old unet up to this point.
I am thinking of trying Photon maybe.
Well definitely not UNet. Unity's new official solution is called Netcode for GameObjects, then there's Mirror which is like UNet, and of course Photon has various products
Hey anyone is familiar with Photon Pun2 ?
Looking for someone who could help fix my 3d character, animations arent propaged to client using photon animator view, movements however are correctly synced through network.
I think this is something that can be achieved pretty quickly for somebody who's used to do these kind of things, because everything is already implemented.
I am able to compensate for the time spent, I think a 10 min call is enough.
Dms are open
Let me know if this isn't the right channel
For some reason, only the host player (which is also the server) Is getting this Rpc:
In some script That Only The Host Has Access To:
DisableSelfClientRpc();
[ClientRpc] private void DisableSelfClientRpc()
{
Debug.LogError("Got Here");
PlayerObject = NetworkManager.Singleton.SpawnManager.GetLocalPlayerObject();
Debug.Log("Starting To Affect Stuff for " + NetworkManager.Singleton.LocalClientId);
PlayerObject.GetComponent<PlayerDisabler>().EnableMe(NetworkManager.Singleton.LocalClientId);
UIDisable.DisableThose();
}
```Did I do anything wrong? only the host gets the "Got Here" print.
Hey there, did you solve the problem?
i think you need to add a photon transform view
oops nvm
Hey not yet unfortunatly š¦
I have normally setup everything, this is the character
Gotta be honest pretty lost with this; because with it being multiplayer and having the blocks networked I thought the only way to do that was with Photon.Instantiate, and same with Photon.Destroy? So are you just talking about a different way of 'contacting' them? Feel like theres just something major I'm missing to get that to work
Hey Can anyone help me with an issue i am having with photon and animation rigging?
I'm not the best coder i have benn trying to fix this issue for over 2 days
I am having an issue with animation rigging specifically with Multi Aim Constraint. In simple words I want my character to look in the direction they are facing. this works in the client(Editor) but not in the build when a someone joins and I look around the other charecters IK moves also(I have tried using : if (!PV.IsMine){Destroy.GetcomponentInChildren(MultiAimConstraint).gameobject)) but that just crashes the build and i have no idea how else to fix this
here a video example:
Not sure about your setup, but are you using a script to control the aim compinrnt?
*component
I have the transform under a camera holder and the Ik is set to that transform
I can send all the code regarding this and screenshots of my setup
But if you are instantiating a player, what script is attached to handle input?
So you gotta check that
For isMine or not
Right now all instances of that script listen for your input
Ohh let me try that
This solved the issue but now there is no Ik whatsoever
this is my prefab setup
Also im sorry for the bad quality its the only way i could upload to discord
Does anyone have tips for how to make movement secure + server side authoritative? My team is a little puzzled on how we can make sure movement is protected from cheaters, including jumping, actions, etc. Do we just need to send movement packets from the client to the server and have the server check the packet properly? Any points to a guide or more information would be great.
Thanks.
Hello hope a stranger help question using mirror I encounter error ".unity needs to be opened and resaved , because the scene object Card has no valid sceneId" what's the possible problem ? help plz
What are yāall using for networking?
Iām assuming youāve tried google?
ask in the mirror server
the invite is pinned
I did several times
Well. The minimum needed to "network an object" is to make sure everyone agrees which object they refer to via some ID. If you've got some level or chunks, they already have IDs (you store and reference them somehow). If this is the same reference on all clients in a room, you can begin to talk about said object/block. You can tell the others "i picked up block xyz", or whatever else can be done with it...
Maybe this is related to using triggers. Hard to say. This doc may help:
https://doc.photonengine.com/en-us/pun/v2/troubleshooting/known-issues/#photonanimatorview_and_triggers
YOu gotta show your code, so we can look at it
I actually figured this out the reaso it wasnāt working is because I didnāt have a photon transform on the camera holder
Thank you for all the help though
Great you got it working š
Only because of your help lol I would have never thought of changing the input settingsš
Alright but how about new blocks placed like Minecraft or terraria?
Same? But with a different value for the referenced index.
Is the problem active or just in your mind of understanding it? Did you test any code yet to checkout?
It's like accessing some array. But instead of just changing the values in it, you send a networked message which index should become which value.
This is the basis. That may need to get some optimization. Depending on the size of chunks and the speed of changes, you maybe don't want to send a message just to change a single value.
Ive read prob like 12 hrs worth of content, but think i worded most of the questions wrong so theres a different way to go about it; like the ways that i saw mostly involve transferring ownership, or not having ownership which i havent figured out yet
Bc transfers require Pviews, which would make sense why it didnāt work properly
And wouldnāt really work long term Anyways
Ok so like a list of blocks that once anyone clicks it send to master client to break it..?
If someone clicks only one block, you don't have to send a list but ... kind of, yes.
I don't know if we talk about a few blocks or if we talk about a scale a la Minecraft. For the latter, I guess some optimization is required.
Any good tutorial for Unity's Relay system on Netcode for GameObject?
Okay ill see what i can do
Watch out for mods, you are not supposed to offer jobs here from my experience.
Yea not that kind of networking. There is a section on the forums.
I've made a turn-based game (snakes and ladders) and right now it just works with one player, I wanna turn it into a multiplayer game but I'm not sure where to begin. I've looked a little into Photon 2 and the new NetCode by Unity but I'm not sure which one to proceed with
Itās typically a good idea to start with multiplayer if thatās your intent. Adding it later isnāt impossible, but just more work. Youāre gonna have to change some functionality.
Different people have their preferences, I am enjoying PUN2 so far
Thanks, I've read this but it doesnt seem to change anything in my case š¦
For the most part animations are still called like a single player game. You just set it up like normal and then with the animator view you choose discrete or continuous. You should then see animations on each client
As long as youāre calling it correctly in your scripts
I have setup a photon view, transform view and animator view on the player prefab
All photon components have been added to the view observed component
Player location is sync through network with transform view successfuly
Animation however doesnt work whatever I do
I am able to do it on a blank projet real quick, but I need to implement it on this specific character prefab
So the animator view needs to be on the actual thing doing the animation does your player have an empty object holding everything then the model?
The animator was on a child, so I moved it on the root component were all the scripts are
Both case didnt worked
I use discrete mainly in my animations also, idk if that matters, but I would look at the difference between discrete and continuous. Some of those probably could be discrete
Yeah the animator and the animation view would need to be on the child I believe. Have you tried taking it out of the gameObject and just attaching everything to the actual model? Does it work then?
Also if I could see your script youāre using to call animations from that may help @unreal falcon
About the update mode (discrete, continuous) I believe it's just the refresh rate, tried both options without success
Here is the (long) script š (around line 580)
Yeah I know what they do. Iām saying continuous is just as it states, some of those may not need to be continuous
Oh I havnt tried that, I might give it a try right now
Atm all the scripts are at root, but the model is a child of the root gameobject
Thereās a lot going on in that script lol. Iām not gonna be able to tell if somethings wrong with it on my phone.
Understandable lol
I have tried attaching everything to the model itself, same result unfortunatly
I am thinking about giving up at this point
oh shit, sorry about it! Didn't know that:(
it's a bit misleading... sorry about it!
I wouldnāt give up. Thereās always an explanation. Mine is set up super simple. If you add me I can call you later and show you how I set mine up.
Can you photon instantiate without a photon view on the new game object?
If you want it to be networked
It has to have a photon view
what would be a way to make a kill counter in photon that checks who sent a shoot rpc and killed you and adds kills to them
I would YouTube this, plenty of tutorials about this kind of topic
So a game with a bunch of blocks is not possible?
ive only found 1 tutorial for it and its completely different from my system
Iāll have to check when Iām home how Iām handling destroying objects. Iām assuming thatās what youāre talking about
Yea, like breaking/placing blocks, or gameobjects, I just cant figure it out so would be greatly appreciated
Itās not the system that needs to be copied itās just how to set up the RPC and adding to a kill counter that needs to be followed then adjust for your situation
Yeah I can take a look when Iām home. Itāll be a bit though
yeah im not copying it its just when i tried to adjust it i couldnt really follow. ill try again i guess
I think what I did was set tags, then destroyed it and if the photon view was mine I added it to my inventory else I just destroyed it for everyone
Iād have to see what youāve tried
Show your code
currently i dont have it implemented cause i scrapped it yesterday
I gotcha.
ill try it now and if i have any problems ill ask here, thanks
aight ya, like at most it would be in the 100,000's of blocks, prob closer to an avg of 1000 per player, but thats way more than photon views could prob handle
Heās a little snip I found online. Try it out
Yeah Iāll let you know. Hopefully thereās a way around that
š thanks š
Wrong tag lol
Then with that code just also have an RPC to add to the score
@pliant birch
I'm home, looking at mine now.
Thanks man, appreciate it
So yeah none of mine have PhotonViews, are you able to jump in a call?
Unfortunately not atm, workin on homework at school, just wanted to get the question out there
Im basically free all of tomorrow though so whats a good time then?
I'm usually available around 10pm est. Just on a early today. I can tell you all I did was make a script called "Ground Item" and I attached a scriptable object of the item to that script. The scriptable object actually holds all the information about that gameobject. Then I made a collider on the object and added it to be "Is Trigger" once inside of the collider I have the option to pick it up which adds it to my inventory (if the photon view is mine) and deletes it if it is mine and if it isn't mine.
I only used a trigger collider instead of raycasting to pick it up, because I'm using raycasting to follow the mouse and I didn't want it doing two things and acting weird.
Nothing is needed networking wise because the objects are spawned into the scene from the master client so everyone can see them at that point, it's basically like putting a gameobject in there by hand then loading it. It doesn't need a Photon view
Hey!
Tell me something why do I have to use DTO when the database table matches perfectly to the payload coming from a client?
for some reason my rpcs are only getting sent to the host:
private void Update()
{
if (Leader) //is server || is host
SomethingClientRpc(NetworkManager.Singleton.LocalClientId);
}
[ClientRpc] void SomethingClientRpc(ulong clientid)
{
Debug.LogError("I am a clientRpc!" + clientid);
}
``` - only the host is showing the error log. did I do anything wrong?
maybe provide some more context
Is it a good practice to use DTO over Entity derived classes as payloads?
that depends on what philosophy of programming you subscribe to. I'd say use abstraction/indirection only if necessary for you and others on the team to understand what is going on, otherwise use the thing that gets the job done in the most direct and simple way possible.
best practices are only valid in the exact context they originated in
Who calles those functions?
a script that runs on every single client
Did you make sure clients are connected to the host?
yes, their player objects also spawn in the world.
Maybe I wrote it wrong? I know the suffix needs to be ServerRpc and maybe there are other things I'm missing
What network are you using, photon?
Also, does it need to be network object / shouldn't be one in order for it to work?
netcode for gameobjects.
But im thinking on moving for something else
Oh, did you name your thing correctly, the function
Oh you did
And you are sure your client is not also a host?
I have 2 clients
one is a host, the other is a normal client
when I call the Rpc through Update() [that runs for EVERYONE], they both execute it like a normal function.
Just to be clear that accidentally both are acting as host and therefore not connecting to each other. I dont know your library you are using, but at first, there is surely a way to check who is connected, right? Just to get the simple errors out of the way if you not already did
.
they are 100% not connecting to each other.
well the client and host are sharing the same unity project, right? So if you start the wrong or dont assign correctly, they both COULD act as host
they are both 100% not acting as host.
I put a debug.log() at the start, they are not hosts.
Both?
Well who is going to call the client rpcs then if there is no host? I sthat meant to work like this?
And your ClientRPC function only runs on the server, right?
will it be wrong if I send it on the client too?
I mean, this specific script runs on both clients and server.
In Update() I check if its a server or client.
if it's a server, I call the ClientRpc (so hopefully the client will execute it)
if its a client, nothing happens.
That should work I guess... hm
thanks for trying to help, but at this point, it seems like netcode is way too new for me to write code with it.
there is just not enough support or examples for things, the documentation isn't even complete.
I'm thinking on moving to fishnet. or just another network solution in general. how hard do you think it will be to completely switch an online solution?
I only used photon back in the days, worked quite easy. But I am not uptodate on realtime networking right now sorry. Most of the time workin with websocket and server connections
working with sockets was always the best option š„
Yep, so netcode, is that a Unity thing? Or a custom one
I was waiting for the new unity networking but never catched up when or if it was released š
its supposed to be the official networking solution, released in 2021.
but its really far from being used in personal projects...
it worked very good for me at the start, but it has too many simple problems that no one can help fix...
So you had a working solution with it and ClientRPC calls before?
Did you check out the multiplayer project demo they have and see what they did?
Also, photon is super user friendly so if youāre new to networking Iād recommend it.
Hey wanted to give you a quick update,
I finally succeeded to propagate my character animations on network,
I tried many test case to see where things went wrong
Long story short my character prefab was a bit complicated and I had to remake the player prefab to make it works, I also added some missing view owner verification to propagate animation only when I wanted to, now it's working out of the box.
So thanks so much for your support š
No problem. Congrats!
Whats the best solution for making a game with rooms, matchmaking and such, lets say a system like fall guys, I dove straight into netcode for gameobjects and after a bunch of days trying i was only able to connect locally to the server, what a pain, is there a better choice out there?
I have been using photon, but not sure if thats still up to date to use
I would say Photon due to the amount of tutorials and resources available
hello , guys for a pvp game where should i host my game and what technology i need , i want dedicated server
Any opinions on mirror vs photon?
for unity netcode
the library
how would you go abouts making a custom server on the cloud and building on there
as an alternative to relay service.
You'd just create a server build in Unity (checkbox in the build settings) and then call StartServer on the NetworkManager to start a server instance. Then upload the built server application to a server or a cloud provider.
PUN, Mirror, Fusion and Quantum are geared towards different types of projects. What is right for you depends on your project.
Well Fusion is replacing PUN, but you get the gist.
what is mirror geared for then?
in the first video dapper dino has he says he's gonna say what its for but only tells what it does, not what its suited towards
Okay , also i was wondering like for unity netcode, should the server instance be rendering the game content or just dealing with requests
I recommend checking out the websites of these networking solutions. Mirror has primarily been about classic MMO networking, while also using Unity as the runtime for ease of use.
Best case would only be server stuff. depends on your game
i think i misunderstood anyway server doesnt really render anything its just an instance of the network manager
the local component updates are done on the client i presume, or i guess it depends on how you choose
If you create a server build and start that Unity will run in headless mode and not render anything. To improved performance you might still want to remove some components from your server objects such as animators, mesh renderers, audio sources etc.
oh right cheers
does netcode for game objects deal with creating multiple game rooms by the way
like say i have some simple game pong
would a host send some RPC or something to generate a new room and that server stores this ID and player names in it
and then people join that game etc
or is this managed by the unity lobby service
anyone know a good way to go about offline server bodies in a server. So when the player disconnects, a body remains on the server let's say (sleeping) and other players can interact with it, when the player reconnects he will be spawned back at his body location unless he was killed when he was offline. Any resources on learning to create this or just general direction would help.
Hey guys. I have a little unconventional question. I'm developing mod for Unity game that uses Photon. And I want to find some way to communicate between clients utilising it. But looks like that in order to send some message, I need to have GameObject that have Photon View. And this view have id range to 999. It is scary to just use those id, since I cannot be sure of every view id that would be used by game or other mods. Is there a way to create some generic communication channel that wouldn't rely on those ids?
Does anyone know the best Lan networking solution, to play with people on my network?
ty
that was a joke btw (although those are great switches)
it depends on what you want to do. mirror is probably easiest and most straight forward.
how much work do you want to put into it?
enough for us to pvp
I am very good at coding, but I have no idea how to do networking.
if you don't need training wheels, don't like oversimplification, but also don't want to build stuff from scratch, mirror is a safe bet. Its not a solution for competitive FPS without a lot of custom code but for your use case it should get you to "PVP" and fun-with-friends quickly
thank you
is there a way to setup a mirror server that runs 24/7 ? I tried setting up a dedicated server with Playfab but it keeps shutting off
buy a vps and put it on there, playfab servers are on-demand
[SecuredOperation("organization.add,admin")]
[ValidationAspect(typeof(OrganizationValidator))]
public IResult Add(Organization organization)
{
IResult result = BusinessRules.Run(CheckIfOrganizationIsAlreadyExist(organization.OrganizationId));
if (result != null)
{
return result;
}
string base64Guid = Convert.ToBase64String(Guid.NewGuid().ToByteArray());
organization.OrganizationId = base64Guid;
_organizationDal.Add(organization);
return new SuccessResult(Messages.OrganizationAdded);
}```
Hello. This code is in one of my manager scripts.
Which layer is the best place to put 'gui' code in it?
so the new generated GUI will be the id name of the entity instead of incrementing the number.
Hello People!
Another question š
I make OTP system for our end users and not sure if I must create a OTP table that tracks the one time password, or I can put that password as a field in User table
Since those values are trivial, one-time things, in any way should I create a seperate table for it?
I mean tens of thousand of unnecessary record will be stored at the end of the day.
instead of re-writing the field, I'll use the table
What do you think
I got my third question already but anybody here š
I am looking to efficiently capture the screen in unity, does anyone have any pointers to resources that may help me capture the screen and pack it into a byte array more efficiently than this. The small image is the texture creation, enum is the processing and pushing of frame to Agora and the profiler with the tanked FPS and performance
Why are you using marshall.sizeof for that ? You are checking the size of one byte every time so you can just do 8 * bytes.Length, or sizeof(byte) * byes.length (which compiles into the former)
Anyone know how to return a reference to a networked object from server to client in netcode for gameobjects.
im having some trouble with photon's serialize
so basically im trying to make it so when an object/player dies, it gets tped to death area and everyone sees that, ive tried while loops and everything but the info isnt transmitting; heres my code. ```c
using UnityEngine;
using Photon.Pun;
public class Target : MonoBehaviourPunCallbacks, IPunObservable{
public float health = 100f;
public Vector3 deathpos;
public bool isdead;
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
while (true)
{
if (stream.IsWriting)
{
stream.SendNext (deathpos);
}
else
{
deathpos = (Vector3)stream.ReceiveNext();
}
}
}
public void TakeDamage (float amount)
{
health -= amount;
if (health <= 0f)
{
Die();
}
}
void Update()
{
if (deathpos == new Vector3(0f, 0f, 0f))
{
}
else
{
transform.position = deathpos;
}
}
public void Die ()
{
deathpos = new Vector3(-24.23993f, 37.48f, -17.78f);
Invoke("respawn", 3);
isdead = true;
}
public void respawn ()
{
deathpos = new Vector3(0f, 0f, 0f);
transform.position = new Vector3(0f, 0f, 0f);
health = 100f;
isdead = false;
}
}
how to use optional parameter in a RPC (Photon Pun2)
I mean in methods like Kill(bool ShowGhost = true)
make an overload that isn't a rpc which calls the RPC with a default value
Has anyone encountered the same problem?:
The physical network objects falls through the floor when starting dedicated server.
[NETCODE]
I'm making a tile turn based multiplayer strategy game, is it reasonable to make a 'synchronization' function that at the end of each turn just takes the board of the last player that moved, destroys the other player's board and replaces it with the last player that moved's board? or is that too inefficient to be worthwhile?
you wouldn't get much out of a "good or bad" example.. depends the context and what your definition of either means
I would say the current state of photon they are good for most unity use cases..
also said to be "AAA" in features and quality I don't see anyone suggesting otherwise.
I would say destroying the entire board for each turn is a bit inefficient yes.
When I try to sync data to syncvar, data is not synced
You can use available options like Photon or Mirror. Unity currently doesn't have a production ready multiplayer solution.
Hi all, I have a unity project where the target fremework version is 4.7.1. I am trying to include a Client project that uses grpc in this unity project. First of all, I created a library project named ClientMgr with the same target framework data(4.7.1) selected and I installed some packages in this project using nuget (net45\Google.Protobuf.dll , net45\Grpc.Core.Api.dll, netstandard2.0\Grpc. Net.Client.dll, \netstandard2.0\Grpc.Net.Common.dll). Then I added this library (ClientMgr.dll) to my unity project as a reference. My project compiles without any problem, but when I run my game in Unity, my reference file (ClientMgr.dll) I added is automatically deleted and I get an error. Can you help me where am I going wrong?
Is anyone using the new input system with the new unity netcode?
Work on your naming conventions, abbreviations aren't good in unity. But make your takip method a [Command], syncvars only sync when the variable is changed on the server due to mirror being server authoratative
Does anyone have experience with Unity MLAPI/Netcode and Mirror? Been working with the former for a few weeks and keep running in to breaking bugs that are logged on the forums. Wondering if switching is the right move.
I guess a simpler way of asking - is mirror considered production ready? (I think the answer is yes but always good to get views)
Netcode is the buyout of mlapi under heavy construction due to new ownership, mirror is the unet successor, with plenty of releases and community support.
Mirror is 100% production ready.
It is between Mirror and Photon usually depending on game.
Thank you @somber drum
I was wondering why the APIs were so similar, I guess it's the UNet origins
Though its been improved so much its not really fair to call mirror unet, but yeah they kept it easy to move to mirror from unet.
I think I'll spend a few days to explore Mirror, seems worthwhile š
Yep definitely, check out the mirror community discord when you get a chance helpful folks with project showcases.
Oh that's a good idea, will do
hi, im using mirror and ive just made a lobby, but now every time i start the game it sends me this error: " Disconnecting connId=0 to prevent exploits from an Exception in MessageHandler: MissingReferenceException The object of type 'NetworkIdentity' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object" any suggestions?
Finally did it with free fishnet š
The function named move gives this error when it stops working
how to fix this error?
Anyone have a multiplayer game idea
hey guys i have an issue when i try to spawn a projectile both client can play the attack animation but only the master client spawns the projectile which is then take its way to the target position, the client can't spawn a projectile at all but the client can see the master client projectile however the projectile is not moving, can some one help me with this pls?
It appears either your component is missing a rigid body or the Parent variable is null when the function is called
So I have a problem. I started using (Netcode https://docs-multiplayer.unity3d.com/) and have game where I have Action system, and want to bradcast actions with its own parameters. Every action extends abstract class in which I want to place networking logic, but I don't know how to handle generic params that will need to go throu. Please look at diagram. I want to achieve sth like this. Is it good aproach or I should use different pattern? In both cases I'd be thankful if you'd help me with proper solution.
The bossroom example does something similar but without inheritance
As I'm looking into boss room example there is only one payload ActionRequestData and with each action you might be sending tons of unnecessary data... I really don't like this solution and hope that there is other option (If not then I will use it, but still it's more like antipattern to me;p)
have a look at the serializer, it compresses the data to only the required bits
its also just an example to illustrate what you can do. i'd like to think this custom serializer approach is the way to go. It allows you to keep a nice API and do efficient messaging without coupling everything in your game to the netcode
When ever I preform a animation the other player preforms the animtion to ( im using photon)
[Using Photon]
Does anyone know a good way to have each player with their own Main Camera references?
The game works fine when I enter the room alone by myself, but when a 2nd player enters the room, the my current player's main camera is detached, and the new player's camera reference works, so they could move around, where my character has errors of that missing cam reference and I can't move around.
Also Unity was unable to detect a main camera in the scene for my player.
Hello, I'm trying to grab a video from a URL and play it in the video player. It works fantastically the first time, but then it fails the second time (when i try to queue up another video from a different url) with this error:
ArgumentException: Failed to create file C:/Users/Kaleb/AppData/LocalLow/Scythe Dev Team/Happys Humble VR\tempvid.mp4 UnityEngine.Networking.DownloadHandlerFile.InternalCreateVFS (System.String path, System.Boolean append) (at <e61918abe7eb4cca803071d15bb3e52b>:0)
Here's my code:
IEnumerator SaveVideoToDrive(string vidURL)
{
uwr = UnityWebRequest.Get(vidURL);
string path = Path.Combine(Application.persistentDataPath, "tempvid" + ".mp4");
uwr.downloadHandler = new DownloadHandlerFile(path);
yield return uwr.SendWebRequest();
if(uwr.result == UnityWebRequest.Result.Success)
{
v.url = path;
Debug.Log("File saved to: " + path);
}
}```
Any idea what I can change to fix it?
It's specifically this line that fails uwr.downloadHandler = new DownloadHandlerFile(path);, but only after running the method the second time
Using Netcode for Gameobjects - can I refer to prefabs over the wire?
Hello plz help I'm new to mirror this code works if I'm getting the client identity. But how about the server ? I've been searching around to no avail.
can anyone help. ^^
// PlayerManager is basically the one that spawning
NetworkIdentity networkIdentity = NetworkClient.connection.identity;
PlayerManager PlayerManager =networkIdentity.GetComponent<PlayerManager>();
You can send the hash (network id) over an rpc
But mostly it depends on the case
Of what you are trying to do
I got around it, I wanted to refer to a prefab asset that isn't a network prefab over the network so other clients can spawn it
Spawn camera for the entity that has a network identity marked as local.
Thanks! I was using the pre-existing camera.main in the scene and referencing it to the entity on start(), I guess I'll remove the main camera from the scene and have each own entity spawn their own. Should I tag it as Main Camera after spawning them or will that have conflicts?
(Assuming I'll handle deleting any other main camera if it's not local)
You don't have to remove the camera, just check if the entity is local in your Start routine
Close & delete the old file before writing to it again.
Thx. I fixed
hey guys i have an issue when i try to spawn a projectile both client can play the attack animation but only the master client spawns the projectile which is then take its way to the target position, the client can't spawn a projectile at all but the client can see the master client projectile however the projectile is not moving, can some one help me with this pls?
Easiest way to do this rather than me fully explain it would just be to look up a Photon Tutorial on shooting bullets. Itāll be the same exact process.
Hey guys! Just had a quick question about headless server builds, is there any way to make one for iOS?
I just started work on a 2d top down multiplayer game using photon. i cant fin out how to make the camera follow each player. how can i do it?
If ur camera is an object not in player prefab u can have a cam pos obj in ur player prefab and give ur cam a tag as cam and
If(isMine) Transform cam = GameObject.FindObjectWithTag("cam");
And set that camera position to cam pos object position but if ur camera is a part of player prefab then u can simply enable or disable camera depending on isMine
Note the keywords above just give a basic idea they might be not correct
Refer to above way
It might help u as well
I've had something like
Transform cam;
void Start(){
if(PhotonView.IsMine){
cam = Camera.main.transform;
}
}
void Update(){
playerMovement();
}
void playerMovement(){
//etc etc, player moves according to where cam is facing, cam is needed here.
}
When a new player joins, they can move, where the remaining player can't and their cam reference is 'gone' or 'stolen'
Can't help with the exact code here but the PUN Basics Tutorial covers how to keep control of your own character and the related camera (only)...
https://doc.photonengine.com/en-us/pun/v2/demos-and-tutorials/pun-basics-tutorial
i did check out but it has nothing to do in my case š¦
It should if youāre just shooting an object.
not just shooting but it has to follow the target
So all you would do different is instead of making it shoot out straight is change that to follow the target position. Everything else would be the same
yes but i cant send the target position trough RPC
You should be able to. You can pass floats through rpc. Pass it that way
i see, so something like all vectors(xyz) 1 by 1, ill have a look
Correct. That should work for you. Just set each float to the x, y, z of the player position and then pass that through the RPC
guys which server tier on aws lightsail would be enough for about 20-40 players in a browser party game
i am using mirror
id say try the $10
anyone real familiar with Photon 2.0 here ?
So, if I call PhotonNetwork.Instansiate() on a prefab, and I only do that from the master client, where do instances of the scripts in that prefab exist? I'm getting a bit confused because they seem to quasi-exist on everyones client but at the same time not exist there at all. Like I'll do something like
```
[PunRPC]
private void SetSolvingPlayerCrossNetworkRPC(int viewID)
{
_solvingPlayer = PhotonView.Find(viewID).gameObject.GetComponent<PlayerController>();
}
but `_solvingPlayer` never updates on the clients...
What networking solution?
This is super vague. Also unless you make variables for the photon variables you have to call them before. Otherwise how would the script know what youāre using?
Hello I have one problem
I am doing a multiplayer game and the rooms are not complete never so I need to create bots to complete the rooms
But I donāt know how to do it
hey same here trying to create new room for each scene cant figure it out
did you find any solution please let me know
Figured it out
I just changed my scene to switch to
idk that fixed my issue\
hey can we get over a quick call
if not possible go through this and see if you can give me any solution
I have 3 Scenes which are main menu , office and outdoor
the player connects to photon server on main menu
and joins office room on pressing join button
the player can enter the outdoor scene on trigger
so i want to create a photon room for outdoor scene on trigger
Hello I have one problem
I am doing a multiplayer game and the rooms are not complete never so I need to create bots to complete the rooms
But I donāt know how to do it
Please help
Does anybody know what the best networking solution is for a simple turn-based Chess-like game with "deck"-building? Preferably with the potential to futureproof server set-up for anticheat. I want to use it with PlayFab, at the moment I'm looking at Mirror.
I have previous experience with Photon PUN and Fusion, but not sure it's what I'm looking for with this project.
Mirror is nice. Or you can use Netcode which is basically your own networking system. A good tutorial Iāve come across which is open source on YouTube you can search āunity multiplayer chess epitomeā. That channel has a series of it
@weak plinth Playfab might be pretty nice imo
You could use something like redis to store states that belong to the matches
Are you talking about asynchronous play?
it could be synchronous too
with cloud functions and a fast database
it might be just fine
you wouldn't host a server for the game
you'd just worry about cleaning up the database after the games are finished
That would be fantastic if it was viable.
Only problem is I need to use a clock to keep track of time remaining.
I saw with Mirror you can have hundreds of 1v1 games running on a single server.
Hello I have one problem
I am doing a multiplayer game and the rooms are not complete never so I need to create bots to complete the rooms
But I donāt know how to do it
That's a very open-ended question.
Ok let me explain better
I meen that to start that game there must be 30 players in a room but only they are 10 so to start the game are left 20 more players so for people not to wait instead of 20 human player join 20 artificial intelligence players automatically after a time
I donāt think anyone is going to sit here and write code for you to have bots join a room. Iām sure there are YouTube videos on this. I would start there.
The same code you call to join by button use that on the trigger but switch to outdoor instead of office.
Maybe have it to where the master calls it and switches everyone
I look in YouTube and I donāt find it
Do you know how to do it or do you have a tutorial?
@keen pivot I'd think of ways to server/master client simulate additional players
I always use the "player" of the networking library as the clients entry point and nothing more
If your game uses the "player" as the players character, thats gonna be more difficult for you
I suggest designing it so that the "player" object possesses a networked object which is a character, a player controller
Then make it interchangeable with AI controller which also can possess the same character
Part of engineering is being able to solve problems. This is a very specific thing that you'll probably have to work out for yourself.
This is pretty old so take it with a grain of salt but it may have some information that you can use to figure it out.
Ok thanks for all of you
roblox
?
Mirror, Photon, NLAPI
Come on, couldn't you just google that?
here is what you need to search for:
How to make multiplayer games in Unity
Just copy and paste
hey guys
im using photon pun 2
how do i check which player i am
like am i player 1 or 2
cuz i wanna assign red team to p2 and blue team to p1
just want a simple if(playerid == 1){redteam} or smth like that
Try to retrieve the ActorNumber from the Player maybe
https://doc-api.photonengine.com/en/pun/v2/class_photon_1_1_realtime_1_1_player.html#ae336775e717f1f825f2955fc8b627738
Or maybe UserId instead, because docs say ActorNumber are never recycled on re-join
Also pay attention to :
UserId of the player, available when the room got created with RoomOptions.PublishUserId = true
I feel like this had something to do with code so imma ask here, When I preform an animation my other player preforms it too. Any idea on how to fix this? I use Photon.
Please help
Need this for a school proj
probably need to check if the photon view is the local view
Iām using photon pun 2 and I want to know, how could I save rooms to a server?
So like if someone creates a room named āroom1ā then builds in it and leaves
then recreates a world named āroom1ā
that building isnt saved because theyāre making a whole new instance of the room, how can i make it safe on the photon servers?
im having a problem with creating room with photon
players are joining their own individual rooms instead of joining a single room
how do i fix this
I don't think that is something you can do by default with PUN on the server side. You probably could license the server and modify it to do whatever you need, but outside of that the custom logic would live on the clients, and clients directly doing these kinds of operations is probably not ideal.
Anyone know Multiplay from Unity? How many players can it have per server?
There is a matchmaking checklist to fix these cases:
https://doc.photonengine.com/en-us/pun/current/lobby-and-matchmaking/matchmaking-and-lobby#matchmaking_checklist
thanks will try
im using trigger in photon
but when one player enters trigger area it triggers for all users
how do i fix this
You could check if player entering the area is the local player
How do i do that ..??
Hi, chandraprasadajay26.
hello
How are you?
good how are you..??
Good, how about you?
all good
Okay.
hey can anyone help with this
if PhotonView.isMine I believe is what it is to check for local player
Then you would call change scene inside that
if(!photonView.IsMine) return;
is this correct
is this the way to check for local player
That checks that if itās not yours
But if you want specific code on the local player you would say is
if(photonView.isMine)
{
Code here
}
@rocky garden
Hey everyone. I'm trying to implement networking in my game which is like a matchmaking 5v5 shooter. I'm thinking that dedicated servers are better than P2P for this. What are the top recommendations for dedicated server (API?). I've heard of Mirror, Photon, and Unity's Netcode for Gameobjects. I'd love to hear some thoughts.
I like photon because of the simplicity and the variety of resources and tutorials. There are a ton on shooter game tutorials. You also can have 20 concurrent players for free for testing and designing the game. Mirror is another good option, I still prefer Photon. If you have a good knowledge of Networking then Unityās new solution may work for you, just not a lot of resources currently.
hey @feral oak its working but not exactly. the trigger only works on master client
even if other players enter trigger area its getting triggered on master client
Thatās strange.
Maybe show your script
just a sec
can you get over a quick call..?
I canāt at this exact moment. But I would be able to in a bit
Okay
i just did \
So for a simple Chess-like game (with slight adjustments such a piece-dropping like Shogi and "deck"-building), would it be possible to create a local multiplayer version first, then implement a client-server-based multiplayer function later on? I've been trying really hard to work out how to get it set up for it, but I think I'm just not getting it. I want to spend more time doing rather than going in circles, but ideally I don't want to have to start from scratch when I do get around to it.
you can make a local multiplayer game with a client/server architecture, even use actual netcode for it; adding networked multiplayer from the "outside" to a non-networked game gets complicated very quickly.
what is the best multplayer network option for webgl based 2d games ?
photon is overkill ?
if I use PhotonView.Find() how do I then get the gameObject that view is attached to and how do I get components attached to that gameObject?????
I've tried:
PhotonView.Find(2).GetComponent<GameManager>();
and:
PhotonView.Find(2).gameObject.GetComponent<GameManager>();
and what happened?
I have a doubt, can python socket server accept unity socket client?
Hello, I recently jumped from unity 5.x to the 2021 version (Big Jump!) I am in the process of learning the new Unity.Netcode functions and the issue I am having now is that I cannot send GameObject references via ServerRpc calls. Does anyone have recommendations to get around this?
Unity 5.x worked:
void CmdThisGuy(GameObject objWithNetworkIdentity)
Unity 2021 Does not work:
void ThisGuyServerRpc(GameObject objWithNetworkObject)
Possibly best to ask in the official dedicated netcode Discord. Invite is pinned in this channel
How do I make my collider ignore other players so we cant stack and etc in photon
Use layermask
so, I'm finding that Netcode for Gameobjects works well in engine, and most of the time well in build, but I have an intermittent problem where the NetworkEarlyUpdate duration increases steadily, eventually taking more than a second per frame (and ultimately beyond that the player crashes and I can't log further). When that happens I see things like this in the profiler:
I also get a console full of these (999+)
and it appears to start after this cryptic error, which has absolutely no stack trace info or any other context beyond this message:
My game is on Steam. When it starts up, Windows asks if you want to allow it to access the network. Is there a way to automatically allow this during installion?
The problem is that this question is asked when the game goes fullscreen and it seems as if it's hanging.
The game is slow in Windowed mode and the cursor will cause issues if it leaves the window.
AFAIK, this happens to other games as well. I still see "Allow firewall rules" exception whenever I launch a new game.
Is it a bad idea to use animation events in a mulitplayer game? I have an attack that i wish to add a hit effect at specific time of the animation, i know that i can hard code it but it's alot easier in case i want to add a modifier to the animation speed
how can I get photon to handle the View ID automatically?
What do you mean by that?
You can call methods directly within animations
I forget whatās itās called, kind of like a key frame but for calling methods
good idea ill try it
Animation events
In photon sometimes in my FindRoom function, it dosent show the room that was created
But when im in the editor instead of the actual build it lets me create a room that others can find
But its different in the build
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.IsWriting)
{
stream.SendNext(health);
}
else if (stream.IsReading)
{
health = (float)stream.ReceiveNext();
}
}```
I have this code and I am making a 2d shooter game
so when I shoot the player it's health decreases but when I click on the other player in the editor and go back to that player it's health goes back to 100
and the health doesn't update in the other player's screen
(ping me)
I get these errors when I click on the Network Manager while the game is running. I have tried re-importing the Netcode for GameObjects Package already.
Anybody got an idea on how to fix this?
Hey I get this error in** Photon Pun 2 **
So bassically when im in the room by myself I can send messages
but as soon as another player joins the messaging dosent work
It may be because of this
What's your guys opinion on Fishnet vs Mirror?
fishnet is new and relatively unprooven, mirror is used by many completed projects in production and at scale
hello there, i am working on a 2d online multiplayer game called yarnball does anyone know how to make physics smooth in multiplayer š¤ and update the score across network, i am using photon with unity 2021.2.8f1 thank you for your time in advance
how do I access the ServerGameNetportal in netcode
can you help me to know why when a local player connects to my world through riptide it generates player 2 but when it connects externally by public address with the port open, it only connects and does not generate the object (I get the message that you have connected correctly in the console and others)
some idea what is wrong?
Using mirror, how can I ensure that the object will self create on the client side? E.g. I spawn an item, a client joins, but now how do I make the client "sees" the item I created. Does Mirror handle this process automatically when joining the hosts?
yes
Anytime you spawn an object that you want visible on all clients, do NetworkServer.Spawn
Can we see the code
Apparently this doesn't work, it would complain that there's mismatched gameobjects id
Does anyone have a good resource as to where to start with networking, I know nothing about it, don't know what would be considered the beginning
Read mirror documentation, all of it. Or whatever networking solution you will use
Is that in the unity api? Or just Google mirror networking?
Mirror is a community solution, Netcode for GameObjects is the new official Unity solution
Definitely shop around and compare different solutions
help pls someone know why is this error or how can fix it?
Isn't HLAPI deprecated ?
Anyway this error tells you something wrong with the signature of the method
Presumably wrong number of params
Oh wait is this used in mirror also ?
Uhm this looks valid in mirror. If I understand well in earlier versions you were supposed to register the callback but now it's suppose to just work if you directly override the method.
Just to make sure, your CustomNetworkManager does implement NetworkManager, right ?
I'm just researching some networking options and curious: has anyone here ever worked with DotNetty (or any of its up-to-date forks) for the base of their networking on the server side?
It looks interesting. I'm really just curious if its considered performant enough generally for games
ask yourself, what exact problem is Netty designed to solve, what is its primary concern? And then compare that concern to the primary concern of your networking needs. If they differ, its probably a bad idea to use it unless you can explain exactly why not.
Sorry, I'm really just looking for feedback about experience with DotNetty in a game networking context.
I've found a very small amount of talk about it through google-fu but not enough to know if its worth the time to pursue it further for games. Code-wise, it looks like it should work fine
do you know of any game using it as its primary network library?
Not that I know of but thats not a very helpful metric lol
I pretty sure one of the threads I seen some talk about it was a unity forum thread so hoping to maybe get some feedback from the community in here
I would say use in production games would be a very useful metric as to whether it is performant enough in games?
If no game uses it, perhaps they thought it was dogshit for use in games
I meant weather I'm aware of it or not means nothing. Otherwise I wouldn't be asking lol Its not that difficult guys, If you have knowledge or experience with it I'd love to hear about it, otherwise its probably not the feedback I'm looking for
You'll just have to wait and hope then, but in all my time here I have never seen it mentioned before
And maybe, don't be an arsehole
That's exactly what I was expecting lol it's the Internet, people start nonsense over the most mundane things
is it possible to exit scene and join scene in a photon room
[using photon]
I have two players join the room, they both have a player script that has something like
if (!photonView.IsMine)
{
cam.SetActive(false);
}
This is to prevent having multiple cameras active at the same time.
However, when the 2nd player join, your own local player's camera becames unactive. Which makes no sense. How come when a new player joins, your own player's camera become unactive when IsMine is true for you?
as you guys can see I don't have any problem on client's view
but RemotePlayer is flickering
How can i solve this problem?
Im using PUN
Are you sure they are referencing different cameras?
Yeah, when I clicked on the referenced camera on the script(s), they point each player's individual cameras
Hey folk
Is it a good practice to put a JSON file into a varchar field of a relational database table instead of using NoSQL
so we get the data as raw json and deserialize in the client side.
and make the changes and send as json string to the same place.
thank you
In dire need of some backend assistance from a masterful wizard with Unity and Node.js server stuff! A discord call where we go through some basic things would be amazing and I'd definitely tip the person with atleast a coffee.
I am new to networking
And i am not sure what to use
Pun Or mirror
What would be beginner friendly?
I saw some videos on yt
But most vids are old and the comments were suggesting newer alternatives
So asking here
I began with Pun. Begin with Pun. Pun is fun. Fun is Pun š and free.
im having problem with using trigger in photon
i have a trigger in the game which activates a canvas. the trigger is accessible by any player. but the problem is if any player triggers the canvas the canvas is being shown on everyone screen instead of the player who triggered the canvas
You should also note that mirror and netcode are using a server client architecture, while there is no server in pun. So choosing between them also needs to account for what kind of game you are making. E.g. you cant have dedicated servers in pun. Pun and mirror are best for beginners because of the amount of tutorials there are and the size of their communities, you can join their discords for help too, links to them are pinned here in the channel. Netcode is still lacking tutorials, but if you are fine with trying out stuff on your own and reading documentation you will be fine with it too. Their community is small but the devs help a lot on the netcode discord.
I would use PUN if you want to make any mobile game.
If you need dedicated servers use mirror or netcode.
If you plan to release on steam/epic games store or another store that provides a free relay use mirror or netcode (then you get a free relay instead of paying for it like you do with PUN)
If your game doesnt care about cheating and is not releasing on a store that is giving you a free relay use PUN.
Its not a goo practice, it breaks the first normalization rule. If you do need to use it most databases have a json type which performs better than varchar, but I wouldnt recommend it.
Which one is the best between netcode for gameobject or mirror?
read the message above
So I want to have p2p so people can host their own servers and doesn't need to open a separate file to host a server
Can netcode have p2p?
what exactly do you mean by P2P?
there is no game networking middleware that uses P2P as a fundamental architecture
it is generally viewed as a dead end architecture as it does not scale well
Ok so maybe its not p2p
But like in mirror
You can just click host and a server is hosted without a separate file opening
if you mean an architecture that does not require a dedicated server, all of them can do that
no
its called "host based networking"
it is still server/client, where a client that is also the server is called the "host"
Ok so both mirror and netcode support host based networking
yes
Ok so now I gotta check out the features of both to figure out which one to choose
Is there a sample project for netcode?
Well if there is some kind of server list that would be nice
And a lobby system before the game starts
thats not really a core part of a network library, but mirror comes bundled with a few simple sample-components to make prototyping discovery and a lobby easier
Yeah I used mirror for a bir
for discovering other remote servers you need to build/subscribe to an external relay/discovery service
Or maybe using a code system
Liek among us each lobby has a code and you can enter it to join
that is a part of the game design and hard to generalize, so any lobby solution you might find in a networking library will only ever be an example
I see
Thanks for helping
I will be testing both solution and see which one is the best for my need
they can both get you to where you want to go, unless you want to build a MMO, in which case no middleware library can really help you š
gawd it's going to take me weeks just to decide on a networking package... MLAPI or Mirror
Remember MLAPI is now known as Netcode for GameObjects
For Netcode for GameObjects Is there an example for using server authoritative movement with like an FPS type game? Something using continuous movement I mean
the tutorials contain a section on network transforms, what else are you looking for?
Im using Photon Pun 2 - I have a persistent scene containing my loading screen. When a player connects to someones room and loads their level via PhotonNetwork.LoadLevel() it destroys my loading screen screen. I wanna do the photon equivalent of SceneManager.LoadScene("Loading", LoadSceneMode.Additive) does anyone have any insight?
Hello.
I am making a OTP system and wondering if I should OTP as an attribute in the User table, or a seperate table stores both the OTP and metadata with it.
What happens if I had 1 million records at the end of the day for just authentication system.
does this decrease the performance of finding the phone-otp key pair.
Or should I delete upon after the authentication is done?
@frosty crystal You can use managed services for common use case stuff like these
I'd use playfabs authentication
It's supposed to distributed systems for managing infinite users at the same time
If you wanna do it yourself, maybe you can try to build it over a distributed database service online
I made it in a way that the OTP is generated and gets stored in a table. and an SMS service sends the code to the user.
user enters it and I check if it matches, he gets the access token.
@high night
Our system is little bit different. I do not know what to do.
@frosty crystal I just suggested a little something for 1 million user situations
That'd probably require your logic and data running in cloud
š
With netcode for gameobjects When I use network rigidbody and network transform on my players. The host seems to have much higher gravity than the clients. Meaning he falls way faster. Any ideas?
Hey, so I have a problem where Mirror will throw an exception:
OnChangeOwner: Could not find object with netId 8
This is caused by me transferring client authority away from an object (using RemoveClientAuthority) to another object (using AssignClientAuthority) and then destroying the object I transferred away from within the same frame (using NetworkServer.Unspawn or NetworkServer.Destroy). At some point then the client will receive a OnChangeOwner message for the old object that no longer exists.
So far the only way I've found to deal with this is to delay the actual object destruction by a frame (so I just mark it as 'dead' and clean it up later in LateUpdate).
But finally the question, is there some proper way of doing what I'm trying to do above or perhaps a different approach that would solve the problem or is the solution just delaying like I did?
Maybe it's a Mirror bug, but I wanted to see what others thought of it
try tag MrGadget in mirror discord, he's the authority guy
actually I think he's here too @gray pond
how do I create a singleton script in Unity .. guess i'm not familiar enough with how the framework instantiates scripts
Oh, never noticed Mirror had a specific discord for some reason
Youāre not showing the code that changes the scene
When I remove Send() call this starts work
But I can show
One sec
Oh fuck
I called OnStartHost in OnStartServer
Yeah that looks weird
I donāt think itās the problem though
Do you get any error messages?
No
Idk why but in editor all works fine
But in builded game all brokes
What part breaks
Thatās when you build the game for the client or server?
The client appears at the host and disconnects after a while
Thatās because when you join as a client, OnStartServer doesnāt get called
OnStartServer is a server callback, not a client callback
Mirror automatically sync client and server online scene
Youāre right itās ServerChangeScene
Hereās the thing
You are more than likely getting errors, Iād assume a Client ready problem or something of the sort
But you donāt see them in the built version
I recommend getting Parrel sync
Then you wonāt have the build the game every 10 seconds
I send this network message when client is ready
???
Just trust me and get parrel sync
I don't understand you. Sorry
Itās a unity extension you can get on GitHub
Oh understand
It will create a clone of youāre project that will automatically update as you change the main one
I have opened ports
It lets you test stuff without building the game
You can just connect to my host
Oh okay. One sec
I will try install it
Itās very quick and easy
And the clone editor will show all the errors, warnings, and logs so you know whatās wrong
Did you create a clone?
In process
Okay
Always test everything on just a client
Lots of things will work when youāre hosting but not on a client
ready
Open it in a new editor
ready
Start host on one and join as client on other
Check the console on the client for errors
We have identified that itās a server build problem
Hm
I use docker containers for unity log files so im not too sure what you should do
But look up how to get log files for a server build
Oh
I find one error on serverside
But she is not paired with client connect
but maybe paired
There is already a player for this connection.
Then I trying to register player more than once
Okay wait
You said it works when you do it just in the editor?
That doesnāt make sense
yes
Youāre server is changing the scene before the client even joins
I can see it working on the host in the editor but not on the client
So it doesnāt work on the client in the editor?
What happens when you start host in editor and join in the other editor
One sec
If I changed code I should clone again?
The clone will automatically update
Thereās no way it works if the server changes the scene in OnStartServer
Where do you change the scene now?
I highly recommend not using the NetworkManager default offline scene and online scene
Itās seems like you may want to use a NetworkRoomManager and NetworkLobbyManager
At least donāt use the online scene
I don't understand how work with this classes
And don't understand difference between NetworkManager
Between Room, Lobby and host
Or how it works
Read documentation
How I understand this is one of the network manager versions
That includes network rooms system
You understand now?
I did not fully understand the meaning of the rooms and their principle of operation
I've heard of Photon, Mirror, Riptide and other Unity Networking solutions. Which one did they use in recent multiplayer FPS sample? Is it still the best one to start with right now in terms of the amount of UDP features?
the official unity networking samples? they used their own netcode of course
(netcode for gameobjects, aka MLAPI)
there's the networking samples, and then there's a separate FPS sample where they employed 15+ various Overwatch-Level UDP techniques like Rollback Networking. I want to use the bleeding edge of professional UDP optimization. I'm interested in whichever one has most of these features built-in.
Is the FPS sample from 2018 still the best one in that aspect?
Take an in-depth look at how the netcode of a fast-paced multiplayer shooter like Unity's FPS Sample works. Learn about snapshot generation and compression, client-side prediction and lag compensation. See how the game code has been structured into server and client parts to enable a small, dedicated server to run the game.
The FPS Sample is i...
if you want rollback and easy prediction id recommend photon fusion
they have all that stuff pretty much turnkey
They used DOTS Netcode for it, it has some features like prediction built in, but DOTS itself is only on version 0.5 and not production ready, so I would not recommend it yet
I am also not sure what you mean with "professional UDP optimization" overwatch did not modify UDP their networking code is just built on top of UDP.
Hey, who is expert in photon pun networking??
Use photon fusion or quantum. Itās currently the best turnkey solution for fps networking. Netcode on the level of an actual competitive game will always be custom and require a large dedicated team.
Got it. Thanks, all
Hey i'm setting up a simple multiplayer game test with mirror but i'm having a problem with the camera every time a new player join the network no one can move their cameras, am i doing something wrong, should the camera also have a network id and be connected to each player or something ?
One camera, have the local player āgrabā it in each client
so I have online steamworks & mirror lobbies setup and working thanks to a tutorial on YouTube. Soo I have a local play board game, if it's an online lobby, I basically set a variable "isOnlinePlay" , and if so it'll change a few things.
I have a few questions:
For things like syncing a random dice roll, I use a command, and then use a ClientRpc to send the roll to all the clients. Is this a good practice, should I do it for other things such as selecting a pawn to move?
Secondly, how can I give the pawns networkidentity? If I do that, they do not appear in offline/local play. Can I give them one manually after online starts? Worth noting all the pawns are pre-set in the world, they are prefabs but aren't being instatiated, they're in the world. It's not really giving me any issues the way I have it setup.
And is all this above good/fine practice? thanks
Is there a tip on how to do that with script ?
Show us youāre script, it all depends on how your get the camera and how you move the camera
anyone know why when i connect to my photon server the playerobject gameobject always gets deleted from players that arent ticked with IsMine in photonview?
!mute 911573495908032552 7d It's your only activity here. Spam.
Akarsh jain#1773 was muted
I have a question: i know games where players can play without any server, where one of players is server-client. How it can be realised? I know that without network settings, an Internet provider and a firewall, it is impossible to make a network interaction where others connect to one of the players via the port, or am I mistaken?
This is usually achieved by using a relay server. A relay server allows clients to connect to each other while skipping the firewall. Most Unity networking solutions have a way to support connections like that and often you don't need to set up your server but can just use an existing relay service. Another technique for this is NAT punchthrough but that one does not always succeed.
how do you sync scale in mirror?
Check the box
Try fishnet
!kick 739274312195899463 if you're here being an intentional troll, don't come back
Jamz#0001 was kicked
Anyone know why I have my build set for windowed mode but on my mac the client tries to read my mouse input in the game even when my mouse is outside the window for my game? Iām trying to test@multiple clients connected in my@mutltiplayer game and this is making it hard
bro how does normcore work
Honestly if you look at benchmarks and features, fishnet is the way to go atm, only downside is not many tutorials rn but the dev is active
Ok thank you i don't know how i did not see that
does anyone know of a simple networking library? like... really simple. Something where I can just create a server just by doing something like "listen port(7777);"
HLAPI seemed like it was perfect for me, but now it's deprecated and doesn't work š¦
enet?
server = new Host();
Address serversAddress = new Address();
serversAddress.Port = port;
server.Create(serversAddress, 10);
like this?
HLAPI has been replaced by "Netcode for GameObjects" which works in a very similar way. In Addition there is a community fork of HLAPI called Mirror which is quite popular.
mirror. Itās actually not hard
check documentation
and especially quick start project
for something like vrchat what should i use?
VRChat is using Photon. Would recommend a look into Fusion for new projects.
isn't fusion for state syncing multiplayer?
photon pun would probably suit better for vrchat
and it'd be easier
Afaik Fusion replaces PUN. PUN and Bolt are both marked as legacy.
Oh, interesting
LiteNetLib is a C# UDP library
I've built a physics-state syncing implementation with rollback using that.
fusion has a shared mode which pretty much replaces pun, and pun2 is getting phased out so id just use fusion instead
Im using Mlapi , any one know hof i can connect between players outside the local network
Hey guys, new to multiplayer.
I was wondering if anyone had a good tutorial to start with. I'm making a 4vs1 player game and I was wondering what the best workflow would be. First make the 5 players with each there scripts, models, animations,... and then script multiplayer
or first script multiplayer and then make the 5 players?
I was thinking of using steamwork.net since I want to put the game on steam.
is this a channel to ask questions about netcode for gameobjects?
yeah I checked out Mirror, FishNetworking, MLAPI, etc. I just... don't know how to read any of their documentation. All they show are a bunch of functions, not how to use them. I was hoping in the documentation to find a tutorial showing how to set up a barebones listening server, but none of them had any. Also, all tutorials seemed to be based around dragging/dropping refererences into a NetworkManager GameComponent, and I just didn't understand what was going on. I needed a high-level API, and HLAPI was it but now it doesn't work š¦
Just use Mirror, documentation is easy and it comes with sample scenes + you will find lots of external tools that have mirror examples
The creator made some tutorials for basic stuff. I can feel how it can be really confusing, and mirror does have a lot of tutorials. Fish-Networking and mirror and very similar in how you use them, but right now fishnet might not be the easiest to learn just because of lack of community tutorials. I'd reccomend following Dapper Dino or Firstgeargames's mirror tutorials and learning, then switching to fishnet.
do I have to use the NetworkManager gameobject? All I want to do is send text message between server and client, so i was looking for a simple API that would let me code that
I would say using any of the above you mentioned will let you do that, relatively easily. I believe there are examples (Mirror has a chat example) which is probably the closest to what you want. What you need is simple, and achievable by just using a transport. But to do that, it's going to be even more low level that I would suggest using any of the above networking tools.
is mirror a better alternative (at the moment) to netcode for gameobjects?
what if.... i use a realtime database instead of a disk database..HMM
here are my thoughts. UnityEngine.Networking, while mostly broken, still works if you want receive/send data to a webpage/PHP script.
What if, on the server, I have something like MySQL database, but living in memory instead of disk (so I/O is much faster), and the DB has two tables: a master table, and a change table.
All clients update their state by pulling info from the master table, but submit any state changes to the change table.
The server verifies/denies entries in the change table, and the ones that it approves are sent to the master table. All clients then update their state with the new master table.
@velvet sonnet I don't know if there's more context to this but how about something like this?
client -> server verifies/denies request -> memory cache database (redis perhaps) -> disk database (can be mysql)
and the server won't ever know the disk database
all the server will know is the memory database which is redis cache
pages of the cache could be saved the disk by least recently used principle
If you like this, there's probably premade solutions for this so you don't have to worry about doing all the cache management stuff
yeah that works too, but the reason why I was thinking client -> change DB -> server was because idk how to create a connection (via code) between the client and game server, but I do know how to create a connection between client and my webserver/DB.
Issue I have now is I can't get json parsing to work on Unity! I think... I'll just have to learn Mirror, at least to get the client/server connection working.
Then I can just learn how to send JSON/text message between the two with Mirror, but use my own method for syncing/validating
@velvet sonnet parse them from strings
Create a dto
data transfer object
that's the same shape as your json file structure
your json serializer library will have something like this:
JsonDeserialize<T>(jsonstring)
I'd try to maintain some layers, set up some boundaries between the connections between the modules
.
I think this might be a good general solution for all needs:
1- client <-> tcp/udp based comm <-> game server (for the realtime game)
2- client -> http -> backend (login, see my profile, friend requests)
3- server -> http -> backend (on game finished exp distribution and other authorative stuff)
4- backend -> http -> redis -> http -> persistent db (for backends persistence needs)
4 might be pretty easy if you wanna use some cloud services
You can get a cached database as managed service, they give you a nice API endpoint and you don't have to worry about anything
PUN is also syncing state. Both tie in to the usual MonoBehaviour workflow. Fusion just does it better and can achieve better results.
I was thinking fusion would had rollback stuff by default while pun wouldn't
Hi, may I ask a question does unity web request support already SSL/encryption or I need to implement some code or plug if so do you have any suggestion that can help me? thanks already for the response I try to search but i don't find anything
Tutorial, help and docs wise yes, but both can achieve the same right now feature wise.
hey how do i have to change the camera settings so that every player gets their own camera that also follows him but since i implemented my game to a multiplayer game there is only one camera that is stuck on one position. The camera script has a target so it should follow the char but it wont . Thats the camerafollow script https://gdl.space/oqabimahog.cs and the spawnplayers script https://gdl.space/bupubareye.cpp also i use photon 2 pun free
You want to only have one camera in the game for the local player, remote players do not need any cameras. Just make sure that the follow script is following the local player.
You dont need to have a camera prefab that you spawn, easiest way is to make the camera part of the player prefab but deactivated and then you turn the camera on the local player on.
ok
but how do i make the main cam a part of the char prefab?
Open the prefab and then select GameObject in the top menu then select Camera which will create a camera in your prefab
wait i cant see no select gameobject in the prefab top menu
its in the inspector right? or u mean just creating a child gameobject??
Camera would be a child object, its not a component
shouldnt i just put in the main cam prefab? it creates a new cam
when i click on camera
Either create a new camera and delete the main camera or move the main camera in, it both achieves the same
u said not to convert the main camera into a prefab but does it matter if its a prefab or not ??
all i do rn is that i create a prefab of the camera each time a player join
which is wrong i guess