#How can i add a delay in my scripts?

61 messages · Page 1 of 1 (latest)

little seal
#

u can click play in my game and itl ask you if u want to host be a client or singleplayer, if u choose host it does indeed host, and it brings you to the game scene

#

but the issue is it doesnt create a player prefab, netcode for unity already does that tho, but in my active scene, so rn whats happending its creating a player prefab in the main menu scene then it transports me into my game scene

#

i was thinking to maybe add a delay to the host? or maybe have a bool in the other scene to check if im hosting. singleplayer or a client, so when i click singleplayer and the bool singleplayer is true i can start a player prefab with no isseus, and if its multiplayer then make it so it hosts in the game and not dirrectly in the scene

marble oar
#

how many cameras

little seal
#

ohhh

#

same thing with canvas right?

marble oar
#

yes LOL

little seal
#

how do i even do that?

#

once the game starts it checks for only 1 player prefabs then insta parents a camera?

#

but my cam has some stuff related to it

little seal
#

but is it even a good way?

#

make like a player prefab of the camera once game starts it gets the player prefab then parents it to it and once it does that then i can make it so it never does it againț

marble oar
#

it's alright. not going to cause you major problems. ideally you won't parent so that the camera and player can move slightly free of each other. like if you want camera smoothing

marble oar
little seal
#

then what else can i rlly do?

marble oar
#

anything that depends on timing is pretty easy to break

little seal
#

i know why its wrong and i think i know how to do it

marble oar
#

imagine if the server lags a bit more

little seal
#

huh?

#

no thats the thing

#

instead of hosting the game with a button it just turns a bool to true and once the game starts it checks if that bool is true then it hosts it

#

like a bool multiplayer;

if buttonpressed Multiplayer == true;

marble oar
#

there should be a "proper" way to do this using netcode

little seal
#

then in the game it would be smth like

void start
if multiplayer = true;
Network.singleton.hostStart();

little seal
#

thats im currently using none of them are doing what i need

marble oar
little seal
#

by the looks of it this does the thing i ned too

little seal
marble oar
#

Name one person

little seal
#

no one said this from this server but alot of em said em from enardos server

marble oar
#

lol

little seal
#

Smth
larry
Smelly
Enardo
Throat
Concryo
Seppe
Pus*y (odd name i know)

#

the list goes on and on

#

you can join the server and check the names if u dont believe me

marble oar
#

well i think they might be a bit mistaken on how easy it is

little seal
#

question is do i add lobbies and stuff? i dont think the game will be popular, all i can think of is maybe like a pregame lobby where u can see the id or maybe put the server ID in the corner

little seal
#

it has a ingame thing

#

it asks if u want to host in the game scnee

marble oar
#

maybe you should start another question

#

and have a very clear explanation in the question body

little seal
little seal
marble oar
#

no the exact question you had was adding a delay in your scripts

little seal
#

saying "how to add multiplayer" is kinda not the thing im looking for

little seal
marble oar
#

Describe specifically your problem

little seal
#

thats mostly it

#

i dont rlly know how the phrase it differently

#

connecting a clinet in the game and not in the main menu?

#

that seems vague