QUICK TUTORIAL - Netcode for GameObjects + Starter Assets Third Person Character Controller - UNITY

  Рет қаралды 9,816

Tauntastic Game Developer

Tauntastic Game Developer

Күн бұрын

QUICK TUTORIAL - Netcode for GameObjects + Starter Assets Third Person Character Controller - UNITY
*** IF YOU WANT YOUR GAME IN WINDOW MODE ***
Go to EDIT - PROJECT SETTINGS
Then, got to PLAYER - RESOLUTION AND PRESENTATION
On the Resolution section, Fullscreen Mode, choose Windowed and set the resolution you want
Intro: 00:00
Install Required Packages: 00:17
Scene Setup: 01:13
Setup Network Player: 01:24
Create/Edit NetworkPlayer Scripts: 02:03
Setup NetworkManager: 05:26
Setup NetworkUI Script: 05:59
Install TextMeshPro Package: 07:43
Create and Set NetworkUI Buttons: 07:53
Third-Person Camera Shoulder Y Offset set: 09:14
Build Project: 09:21
Test: 09:45
Outro: 10:18
Socials
Discord: / discord

Пікірлер: 70
@exhit-gamedeveloper9971
@exhit-gamedeveloper9971 Жыл бұрын
There's a small but very important bug in the code a viewer pointed out (thanks Stefan RIZEA). At 5:20, instead of using _cinemachineVirtualCamera.Follow = transform, use _cinemachineVirtualCamera.Follow = transform.GetChild(0) or transfom.Find("PlayerCameraRoot") or even cache the PlayerCameraRoot's transform and set cinemachineVirtualCamera.Follow equals to this variable! Then, you can go to the CinemachineVirtualCamera component in PlayerFollowCamera, go to Body > Rig > Shoulder Offset and set Y to 0.
@nilsmuller-cleve6769
@nilsmuller-cleve6769 Жыл бұрын
The camera root object is already assigned in the variable CinemachineCameraTarget.
@ImTheMrFoxman
@ImTheMrFoxman 5 ай бұрын
This video was a godsend! So many tutorials just go over a single camera view. This was amazing, espcially since I'm building off of the unity standard assests. Thank you!
@exhit-gamedeveloper9971
@exhit-gamedeveloper9971 Жыл бұрын
** IF YOU WANT YOUR GAME IN WINDOW MODE ** Go to EDIT - PROJECT SETTINGS Then, got to PLAYER - RESOLUTION AND PRESENTATION On the Resolution section, Fullscreen Mode, choose Windowed and set the resolution you want
@NastyCat
@NastyCat 11 ай бұрын
Thank you very much for your tutorial, it saved my homework project! :) Also great job at figuring out Networking with these exact Starter Asssets, my nerves wouldn't have lasted that long...
@gabrielcampos295
@gabrielcampos295 Жыл бұрын
Exactly what i needed good job!
@salmaanmoosa3103
@salmaanmoosa3103 Жыл бұрын
Awesome tutorial! Would be awesome to see more netcode for game object tutorials. Like server authoritative networking?
@maxit0x
@maxit0x Жыл бұрын
Bro good one! Works 100% Thanks for share.
@lewis931
@lewis931 Жыл бұрын
This video is amazing! Quick and easy to understand so thank you.
@perspectives2202
@perspectives2202 Жыл бұрын
Were you be able to succeed it with third person controller for both host and client?
@lewis931
@lewis931 Жыл бұрын
@@perspectives2202 Yeah
@fabianobersovszky6987
@fabianobersovszky6987 Жыл бұрын
great tutorial!
@nilsmuller-cleve6769
@nilsmuller-cleve6769 Жыл бұрын
I could not figure out how to get the controls properly working, thanks a lot for this!
@Tajdang
@Tajdang 6 ай бұрын
Thank you so much. u r the best!!!
@Roozbehchief98
@Roozbehchief98 Жыл бұрын
I have an issue with adding the animator to my Client Network Animator script. It is only showing available animators in the scene, and the animator is not available in the scene(is removed from the scene). Therefore when I run the project I get the error "The variable m_Animator of ClientAnimatorTransform has not been assigned.". I added a line so that it picks the animator from the gameobject after it instantiates, but the error still happens for a few frames and I cannot get a build successfully. Any thoughts?
@FarSam25
@FarSam25 10 ай бұрын
thank you so much
@zbeb118
@zbeb118 Жыл бұрын
How would I be able to change the rotation of the prefab? I changed the prefab's position and rotation and assigned the prefab it in the Network Manager script, when I click host, the prefab spawns at the correct position, but not the rotation, any ideas?
@aswinsriram4778
@aswinsriram4778 Жыл бұрын
Thanks bro
@moisebattello1110
@moisebattello1110 Жыл бұрын
thank bro you are smart
@JimboS1ice999
@JimboS1ice999 Жыл бұрын
amazing tutorial anyway you can add a physics simulation to this project? where the simulated physics on both clients are sent to the server and whicherver has more potential "velocity" or "force" etc would be the result displayed and sent back to both clients in a dedicated server setting?
@thepursuer7872
@thepursuer7872 Жыл бұрын
Following the tutorial i cant move the character, or camera, jump or sprint using the screen UI, how can i fix? i wanna build for android
@Mjoao2006
@Mjoao2006 Жыл бұрын
I need help I did everything right but when executing and clicking on the host button nothing happens and if you try it with the skin in the scenario it doesn't do anything it doesn't move the camera doesn't turn anything if you could help me thanks
@YONYSVERA
@YONYSVERA Жыл бұрын
I was able to do everything and I have it functional, but the only detail that I find in my project is that in one window the animations of all the characters are perfectly visible, but in the others the other player is displayed without the animation of walking . Who could help me..
@TheCloucs
@TheCloucs Жыл бұрын
Hey, first of all I would like to thank you for the video. Helped me to get started with a multiplayer prototype for my game. There is one big issue I'm still facing. The Unity Input System always assigns the Xbox Controller control scheme to the 2nd player, even over the network. Any tips with that? Did somebody else figure out how to disable that?
@user-ch6ww4qy9h
@user-ch6ww4qy9h Жыл бұрын
Having the same issue. I tried disabling input system but when i try with 2 different characters it doesnt work.
@qwertz3813
@qwertz3813 Жыл бұрын
you can set default control scheme in input component on player to use keyboard + mouse by default
@SergKoshelev
@SergKoshelev Жыл бұрын
how can i integrate unity lobby in this setup?
@what8586
@what8586 Жыл бұрын
great tutorial the camera was glitchy when walking up stairs and how would i get the joystick and buttons work
@StefanRIZEA_
@StefanRIZEA_ Жыл бұрын
Hello! Check out my comment. I managed to fix it.
@exhit-gamedeveloper9971
@exhit-gamedeveloper9971 Жыл бұрын
Sorry I'm late! Been super busy :( The fix is in the pinned comment.
@madamutzsar
@madamutzsar Жыл бұрын
This tutorial worked great, but I'm having a weird problem. If the character is in the scene before it starts, the camera works just fine. However, if I spawn the character into the scene, the character does not go in the direction the camera is facing and movement becomes unpredictable. Any idea what the problem could be? 'cause I'm stumped ;o;
@madamutzsar
@madamutzsar Жыл бұрын
Nvm, I solved the mystery. It was finding the wrong main camera x)
@perspectives2202
@perspectives2202 Жыл бұрын
It says, detected the host is sending itself animation updates please report this isssue. Also it can not be controlled by other player as soon as I connect with a client, host can not play the game
@mabialakienda
@mabialakienda Жыл бұрын
Very nice content, so Im getting error Assets/StarterAssets/ThirdPersonController/Scripts/ThirdPersonController.cs(109,17): error CS0246: The type or namespace name 'CinemachineVirtualCamera' could not be found (are you missing a using directive or an assembly reference?)
@exhit-gamedeveloper9971
@exhit-gamedeveloper9971 Жыл бұрын
Have you installed Cinemachine?
@mtarikan
@mtarikan Жыл бұрын
@@exhit-gamedeveloper9971 Assets\Scripts\ThirdPersonController.cs(161,30): error CS0115: 'ThirdPersonController.OnNetworkSpam()': no suitable method found to override Assets\Scripts\ThirdPersonController.cs(111,17): error CS0246: The type or namespace name 'CinemachineVirtualCamera' could not be found (are you missing a using directive or an assembly reference?) Cinemachine is installed and I'm getting the same error.
@mtarikan
@mtarikan Жыл бұрын
I found a solution. Adding "using Cinemachine" at the start of the script to libraries solved my second problem. Also getting Multiplayer Samples Utilities from git link solved my first problem.
@litember1104
@litember1104 Жыл бұрын
@@mtarikan Bro can you please tell me how you solved onnetworkspawn() error?
@soytet365
@soytet365 4 ай бұрын
I can't import Unity.Netcode; I think maybe thirdpersoncontroller script difference located file from Netcode packages anyone met this issue?
@johnoyaxi3363
@johnoyaxi3363 2 ай бұрын
same,dont kown how to fix it
@JezzGT
@JezzGT 13 күн бұрын
If you move the file from its location within the imported asset to root asset folder it should work fine. You will also need to fix the compiler errors relating to editor scripts, if you don't want or need the editor buttons just delete the script.
@closet_games
@closet_games Жыл бұрын
I noticed that when holding "S" to move back, the character starts spinning, are You having the same issue?
@StefanRIZEA_
@StefanRIZEA_ Жыл бұрын
Hello! Check out my comment. I managed to fix it.
@exhit-gamedeveloper9971
@exhit-gamedeveloper9971 Жыл бұрын
The fix is in the pinned comment.
@closet_games
@closet_games Жыл бұрын
Thanks, appreciated 😊
@tarchinstudios
@tarchinstudios 11 ай бұрын
Everything is perfect on the host server, but the clients cannot move. Why?
@viktorportman2736
@viktorportman2736 11 ай бұрын
If you have multiple control schemes in your input system then the host will take the first control scheme then the client will take the next to fix the problem just remove all control schemes but keyboard, happy developing!
@GamingWithMitOfficial
@GamingWithMitOfficial 6 ай бұрын
You like this same add to the server (Photon), As I am at school and my friend is at home, we can play together For example Pubg, ValoRant, Gta Online
@StefanRIZEA_
@StefanRIZEA_ Жыл бұрын
Do you know how we could make the mouse work aswell? With this solution, we can only use WASD to look around.
@StefanRIZEA_
@StefanRIZEA_ Жыл бұрын
I'm also having the same problems @what8586 and @shino3257 are having. The camera moves very close to the player when walking up the stairs and the players spins when trying to walk backwards.
@StefanRIZEA_
@StefanRIZEA_ Жыл бұрын
I managed to fix it. I changed this: _cinemachineVirtualCamera.Follow = transform; To this: _cinemachineVirtualCamera.Follow = transform.GetChild(0).transform; It fixed all the problems. You don't need the Y offset anymore.
@closet_games
@closet_games Жыл бұрын
@@StefanRIZEA_ Even after applying your suggested fix, the character still spins when trying to walk backwards. I debugged and checked which Child it fetched by your command, and it is Player CameraRoot indeed. Do You have any other ideas on how I could fix it?
@fabianobersovszky6987
@fabianobersovszky6987 Жыл бұрын
3:22 Why is ClientNetworkAnimator not good for competitive games?
@StefanRIZEA_
@StefanRIZEA_ Жыл бұрын
Correct me if i'm wrong but I belive the server always trusts the client to change it's own position.
@exhit-gamedeveloper9971
@exhit-gamedeveloper9971 Жыл бұрын
In competitive games, you can't trust the client to be responsible for its own changes without parsing on the server side. It enables cheating.
@haraldgundersen7303
@haraldgundersen7303 Жыл бұрын
Very nice content. Could do without background music but content very useful...
@exhit-gamedeveloper9971
@exhit-gamedeveloper9971 Жыл бұрын
Music helped settle the mood for me. But I'll keep your comment in mind. Thank you 🙏
@MASTONGAMES
@MASTONGAMES Жыл бұрын
how to make a shooting game with netCode, here's the question...
@StefanRIZEA_
@StefanRIZEA_ Жыл бұрын
Brackeys has a great playlist with tutorials. They are using the old uNet architecture, but the steps should be the same, 90% of the time.
@perspectives2202
@perspectives2202 Жыл бұрын
@@StefanRIZEA_ Can you share the playlist please
@StefanRIZEA_
@StefanRIZEA_ Жыл бұрын
@@perspectives2202 kzfaq.info/get/bejne/i7FlatSV1sXQkZ8.html
@perspectives2202
@perspectives2202 Жыл бұрын
@@StefanRIZEA_ thanks for your quick reply, appreciate it!
@GamingWithMitOfficial
@GamingWithMitOfficial 6 ай бұрын
This is Tutorial Is not Working Please Solve My Issue
@gorkem9324
@gorkem9324 11 ай бұрын
Hello, I have everything working except when the client jumps I got this error on the host side and client kinda stuck in the air. ----- [Netcode] [DestinationState To Transition Info] Layer (0) does not exist! UnityEngine.Debug:LogError (object) Unity.Netcode.NetworkLog:LogError (string) (at Library/PackageCache/com.unity.netcode.gameobjects@1.4.0/Runtime/Logging/NetworkLog.cs:34) Unity.Netcode.Components.NetworkAnimator:UpdateAnimationState (Unity.Netcode.Components.NetworkAnimator/AnimationState) (at Library/PackageCache/com.unity.netcode.gameobjects@1.4.0/Components/NetworkAnimator.cs:1181) Unity.Netcode.Components.NetworkAnimator:SendAnimStateServerRpc (Unity.Netcode.Components.NetworkAnimator/AnimationMessage,Unity.Netcode.ServerRpcParams) (at Library/PackageCache/com.unity.netcode.gameobjects@1.4.0/Components/NetworkAnimator.cs:1261) Unity.Netcode.Components.NetworkAnimator:__rpc_handler_4140764492 (Unity.Netcode.NetworkBehaviour,Unity.Netcode.FastBufferReader,Unity.Netcode.__RpcParams) Unity.Netcode.RpcMessageHelpers:Handle (Unity.Netcode.NetworkContext&,Unity.Netcode.RpcMetadata&,Unity.Netcode.FastBufferReader&,Unity.Netcode.__RpcParams&) (at Library/PackageCache/com.unity.netcode.gameobjects@1.4.0/Runtime/Messaging/Messages/RpcMessages.cs:70) Unity.Netcode.ServerRpcMessage:Handle (Unity.Netcode.NetworkContext&) (at Library/PackageCache/com.unity.netcode.gameobjects@1.4.0/Runtime/Messaging/Messages/RpcMessages.cs:117) Unity.Netcode.MessagingSystem:ReceiveMessage (Unity.Netcode.FastBufferReader,Unity.Netcode.NetworkContext&,Unity.Netcode.MessagingSystem) (at Library/PackageCache/com.unity.netcode.gameobjects@1.4.0/Runtime/Messaging/MessagingSystem.cs:541) Unity.Netcode.MessagingSystem:HandleMessage (Unity.Netcode.MessageHeader&,Unity.Netcode.FastBufferReader,ulong,single,int) (at Library/PackageCache/com.unity.netcode.gameobjects@1.4.0/Runtime/Messaging/MessagingSystem.cs:414) Unity.Netcode.MessagingSystem:ProcessIncomingMessageQueue () (at Library/PackageCache/com.unity.netcode.gameobjects@1.4.0/Runtime/Messaging/MessagingSystem.cs:434) Unity.Netcode.NetworkManager:OnNetworkEarlyUpdate () (at Library/PackageCache/com.unity.netcode.gameobjects@1.4.0/Runtime/Core/NetworkManager.cs:1443) Unity.Netcode.NetworkManager:NetworkUpdate (Unity.Netcode.NetworkUpdateStage) (at Library/PackageCache/com.unity.netcode.gameobjects@1.4.0/Runtime/Core/NetworkManager.cs:1375) Unity.Netcode.NetworkUpdateLoop:RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage) (at Library/PackageCache/com.unity.netcode.gameobjects@1.4.0/Runtime/Core/NetworkUpdateLoop.cs:185) Unity.Netcode.NetworkUpdateLoop/NetworkEarlyUpdate/c:b__0_0 () (at Library/PackageCache/com.unity.netcode.gameobjects@1.4.0/Runtime/Core/NetworkUpdateLoop.cs:208)
@SinhtUpthereal
@SinhtUpthereal 11 ай бұрын
Hey Thanks for the great tutorial!! but i have an issue i can host an instance but i can not move or turn my camera these are my logs: Parameter 'Hash 0' does not exist. UnityEngine.Animator:SetBool (int,bool) StarterAssets.ThirdPersonController:JumpAndGravity () (at Assets/StarterAssets/ThirdPersonController/Scripts/ThirdPersonController.cs:312) StarterAssets.ThirdPersonController:Update () (at Assets/StarterAssets/ThirdPersonController/Scripts/ThirdPersonController.cs:176) Parameter 'Hash 0' does not exist. UnityEngine.Animator:SetBool (int,bool) StarterAssets.ThirdPersonController:JumpAndGravity () (at Assets/StarterAssets/ThirdPersonController/Scripts/ThirdPersonController.cs:312) StarterAssets.ThirdPersonController:Update () (at Assets/StarterAssets/ThirdPersonController/Scripts/ThirdPersonController.cs:176) NullReferenceException: Object reference not set to an instance of an object StarterAssets.ThirdPersonController.JumpAndGravity () (at Assets/StarterAssets/ThirdPersonController/Scripts/ThirdPersonController.cs:322) StarterAssets.ThirdPersonController.Update () (at Assets/StarterAssets/ThirdPersonController/Scripts/ThirdPersonController.cs:176) NullReferenceException: Object reference not set to an instance of an object. StarterAssets.ThirdPersonController.CameraRotation () (at Assets/StarterAssets/ThirdPersonController/Scripts/ThirdPersonController.cs:215) StarterAssets.ThirdPersonController.LateUpdate () (at Assets/StarterAssets/ThirdPersonController/Scripts/ThirdPersonController.cs:185)
@SinhtUpthereal
@SinhtUpthereal 11 ай бұрын
never mind tryed again with a fresh project and it worked, thx !
@leonhardfloh5902
@leonhardfloh5902 Жыл бұрын
Hi Great Video It Helped a lot!! I still have Errors with the audio: Following 2 Errormessages get displayed: NullReferenceException: Object reference not set to an instance of an object StarterAssets.ThirdPersonController.OnFootstep (UnityEngine.AnimationEvent animationEvent) (at Assets/Scripts/Player/ThirdPersonController.cs:408) and NullReferenceException: Object reference not set to an instance of an object StarterAssets.ThirdPersonController.OnLand (UnityEngine.AnimationEvent animationEvent) (at Assets/Scripts/Player/ThirdPersonController.cs:417) Can someone please help me to fix those? Thanks in advance
@leonhardfloh5902
@leonhardfloh5902 Жыл бұрын
Fixed it: If you have this problem take out followin functions from the startmehtode and place them in the OnNetworkSpawnMethod ( above owner varification) _hasAnimator = TryGetComponent(out _animator); _controller = GetComponent(); _input = GetComponent();
THIRD PERSON MOVEMENT in Unity
21:05
Brackeys
Рет қаралды 1,4 МЛН
Getting started with Unity Multiplayer
19:36
Carl Boisvert Dev
Рет қаралды 10 М.
КАРМАНЧИК 2 СЕЗОН 7 СЕРИЯ ФИНАЛ
21:37
Inter Production
Рет қаралды 493 М.
터키아이스크림🇹🇷🍦Turkish ice cream #funny #shorts
00:26
Byungari 병아리언니
Рет қаралды 29 МЛН
1 or 2?🐄
00:12
Kan Andrey
Рет қаралды 38 МЛН
Making MULTIPLAYER Games has never been EASIER!
12:49
Code Monkey
Рет қаралды 75 М.
Starter Assets overview | Unity
8:49
Unity
Рет қаралды 302 М.
Unity Netcode First and Third Person player camera tutorial
12:23
Usume Jovi-Usude
Рет қаралды 1,3 М.
How To Make A Game With Unity Multiplayer Netcode | Player Controller
40:00
Unity/Mirror Multiplayer Networking Tutorial
35:22
BioRebellion
Рет қаралды 10 М.
How To Make A Unity Multiplayer Character Selection Menu - Part 1
32:22
КАРМАНЧИК 2 СЕЗОН 7 СЕРИЯ ФИНАЛ
21:37
Inter Production
Рет қаралды 493 М.