numPlayers challenge extension a little set up to fail

Now i went a completely different route as i had no clue about the numPlayers.
Although we opened the NetworkManager script a few times there probably needs to be an insert on the challenge slide to the effect of

“If you are opting for the extended challenge of adding the number of players to your log message then searching the NetworkManager may help you there.”

It just gives a lead in as its not obvious.

Most newbies will probably do what i did and instinctively created a variable and incremented it as a player connects with the intention of de-incrementing (not a word but i am going with it!), them if they disconnect. Which i think would work but is a very long way of doing things comparatively.

Also at 18:29 approx you state that its better practise to use $ over the old + method.
I would probably have avoided this and stated “You may have been used to using + to do this and thats okay when you are learning but i find this method to be better practise.”
The reasoning is at present the beginner courses only use the + method and so its indirectly saying the beginner courses use bad practises. (Unless these are to be changed or highlighted)

(Note:- only first tea of the day and kids around so if i missed a hint please ignore!)

I’m not sure I’d say the beginner courses had bad practices, per se, @Marc_Carlyon. At the time of the beginner courses, the $"{variable}" approach was a new thing to Unity (actually for the 2017 stuff, it wasn’t even IN Unity, I believe). The feature was added in C#6, but Unity didn’t catch up with that standard until late 2017/early 2018 versions, and they never really pushed it in their documentation.

I think at this point, as courses remaster, we should probably be teaching it.

One interesting note: When I ask students to add Debugs in specific places in their codes in the RPG course to track down their issues, I always give them $"" formatted debugs, and not once has any student said “You want me to type what??” In fact, I even see them later posting code using it. :slight_smile:

I havent done the beginner courses in a while and those are not the issue.
Stating the way it was in this lecture is basically stating its bad practise to use the older method.
I think i didnt clarify my post in brackets which didnt help!, “(Unless these are to be changed or highlighted)”, This referred to changes that may be made in the future to the beginner courses.

Note :- This was the first time i had seen this method over catanation and i have been here a while :wink:

Going to patch this now by changing my wording from “better practice” to something like “the more common way now is to…” and I’ll also add 1 extra part onto the slide about numPlayers

1 Like

Privacy & Terms