How may i add a level selection system to a multiplayer game in which it’s user can choose to host a game with his/her map of choice and game type? Would i need a gui page to do so? If so then feel free to move this thread to GUI topics. I was just in rut because i want my users to be able to host a game of their choice and map i have design of their liking. If i were to do this could i make it all in one unity project scene? like have each map in the general grid and it just loads certain sections? OR would each need to have a scene on it’s own?
Thank you!
Hi InUnison,
I’ve had this come up as well. I think that networkLevelLoad from the the networking example might be what you and I need. I’ll be testing it soon, so I’ll say whether it works then!
You could try in the meantime. If you do, I’d love to hear the result. Else, I’ll test it myself.
You will definitely need a GUI script/scene. I would suggest the “scene on its own” option. It would take longer to implement, but would take less time to load.
By the way, I am WAY out of my depth here.
Hope this helps!!!
hahaha thanks man! at least someone is here to help others you know >.< im going to do level design all day so i wont get to that for another couple days. Wish you luck man!
Isn’t it weird that that was all I did the day before I posted?
I’ll post when I’ve tried it.
Oh, one other thing: do you have a lobby system? (Like me).
Where would you put the level chooser? Before or after the lobby?
Just curious.
I’m just about to test the LevelLoad script - I’ll report back soon…
I’ve tested the NetworkLevelLoad script - and it kind of works. Are you using RPCs? If you are it will work. Else (like me) it probably won’t. If I decide to write my own - which is quite likely - I’ll publish it here. Most likely is that I’ll edit my menu script.
Hope I’ve helped!!
hah most likely
havent gotten that far! And lets say people can choose what map they want to play basically.
Yes!!! I’ve got it (sort of).
You have a list of levels somewhere, probably as a GUI feature, then add a text field so that people can choose their level, like so (taken from my own script, but use it as much as you like!):
// code for level selector, by Arthur
var level : String = "";
function OnGUI () {
GUI.BeginGroup (Rect (Screen.width/2-175, Screen.height/2-75-50, 350, 150));
GUI.Box (Rect (0,0,350,150), "Server options");
GUI.Label (Rect (10,80,150,50), "Level");
level = (GUI.TextField (Rect (175,80,160,20), level));
if(GUI.Button (Rect (100,115,150,20), "Play!")){
Application.LoadLevel((level));
}
GUI.EndGroup();
}
If you do use it, please tell me! I’d love to know if you do (this applies to everyone, not just InUnison!!!) ![]()
I am very proud of this, it’s taken from one of the few scripts I’ve written myself. ![]()
Since nobody appears to have used this script, I think that it must be either (a) completely useless or (b) just unneeded. I’m kinda upset about this. ![]()
Still, I’m only posting this to update the thread. Lol.
Bump
You shouldn’t be upset that nobody has noticed the script. You should bear in mind that most Unity users are not actually registered as forum members - they view the forum and use scripts and advice but may not want to register just to say thanks. In any case, it isn’t really appropriate to keep bumping the thread since it can be found by search if anyone needs it.
LOL i dont know what you mean when you say it is useless. I go through the forums for scripts without signing in and i came across this thread thanks for posting that code.
And, of course, Vipers script could easily be modified to make you able to change the levels names on the buttons, and not force them to be the same as their “actual” name:
//scripted by ViperCode
var levels:String[];
var levelname:String[];
function OnGUI () {
if(GUI.Button(Rect(2,30,120,25),levelname[0])){
Application.LoadLevel(levels[0]);
}
if(GUI.Button(Rect(2,60,120,25),levelname[1])){
Application.LoadLevel(levels[1]);
}
if(GUI.Button(Rect(2,90,120,25),levelname[2])){
Application.LoadLevel(levels[2]);
}
}
EDIT: Oh. Just realised that I am 3 months late -.-