Make YOUR OWN Multiplayer FPS (2023 - Unity, Photon PUN 2)

Поделиться
HTML-код
  • Опубликовано: 20 июн 2024
  • DOWNLOAD PACK & MOUSE LOOK SCRIPT
    drive.google.com/file/d/1j-92...
    OR AS A ZIP FILE
    drive.google.com/file/d/1mv2Y...
    ▶︎ Links
    Photon PUN 2 on the asset store:
    assetstore.unity.com/packages...
    Photon Dashboard:
    dashboard.photonengine.com/
    Try out the game that I'm teaching you to make! (steam: bit.ly/3urlRUJ)
    ▶︎ Description
    Howdy everyone! I’ve decided to make a brand new series on how to make your own networked multiplayer FPS game in Unity. This is based on my own Steam game.
    In this tutorial, we're setting up Photon PUN 2, making our multiplayer room manager script and syncing some player bean movement over the network.
    ▶︎ Social Media:
    Discord: / discord
    Twitter: / _bananadev
    ▶︎ Similar Videos:
    How We Remade CSGO in 7 Days | Multiplayer | Unity | Steam - • How We Remade CSGO in ...
    MAKING YOUR FIRST FPS in Unity with FPS Microgame! - • MAKING YOUR FIRST FPS ...
    ▶︎ Timestamps:
    (0:00) - Intro
    (0:15) - Creating Project
    (0:37) - Setting up Server
    (2:10) - Room Manager Script
    (5:36) - Setting up our Player
    (6:10) - Player Movement
    (11:53) - Making it First Person!
    (13:00) - Syncing players over the network
    (15:00) - Testing & outro
    ▶︎ About Me:
    I'm bananadev and I'm an indie game dev! I make tutorials and devlogs about how to make games in Unity.
    Thanks a lot for watching 💜
    #madewithunity #indiedev #devlog

Комментарии • 214

  • @bananastutorials
    @bananastutorials  11 месяцев назад +6

    The mouse look script is here :)
    drive.google.com/file/d/1j-92b6X5cLxszYKdZb_BAyJx0xuxhVmA/view?usp=sharing

    • @arnaudloche2725
      @arnaudloche2725 11 месяцев назад

      Couldn't you at least show on Video the script? I just wanted to see how you did it and now I must download the scripts 🙁

    • @decode_script
      @decode_script 10 месяцев назад +1

      can u make the RoomManager im having trouble with it

    • @lucksthedev
      @lucksthedev 5 месяцев назад

      plz
      @@decode_script

    • @scorpiogaming27
      @scorpiogaming27 3 месяца назад

      @@arnaudloche2725bro where did u get the scripts im not able to get that too

    • @jafizz6505
      @jafizz6505 2 месяца назад

      Help needed NullReferanceException: Object reference not set to an instance of an object

  • @theWiseWordsCentral
    @theWiseWordsCentral 8 месяцев назад

    SO HELPFUL, Definitely underrated channel

  • @Un4GivNX
    @Un4GivNX Год назад +8

    Using the Resources folder is creating a tech dept for the future. Use addressables.

  • @d0c_dev
    @d0c_dev Год назад +8

    Im currently using riptide for my fps, i may check photon later, your channel seems to be awesome nice production quality excited to see nore of you

  • @dominiclashombo
    @dominiclashombo Год назад +2

    dude this is gonna be awsome ooooo

  • @toxiq5295
    @toxiq5295 Год назад +5

    ok honestly, I do not feel rdy yet to make my own mutliplayer game, but damn I will still watch your vids.

  • @cashenuts
    @cashenuts Год назад +2

    yooo good as alway

  • @susgofres
    @susgofres Год назад

    I hope this tutorial continues because this helps me a lot...

  • @shubhampatel8193
    @shubhampatel8193 Год назад +10

    Continue this tutorial broo its awesome :)))

  • @4lfinity
    @4lfinity 11 месяцев назад +1

    underrated channel dude

  • @Yumari_544
    @Yumari_544 5 месяцев назад +3

    you basically just made a free course and only have 1.3k subs. Bro deserves better 🥺🥺

    • @fabexl5898
      @fabexl5898 5 месяцев назад

      Who else is watching this now

  • @quocbaovo7488
    @quocbaovo7488 8 дней назад

    Hii !! Your video is amazing and i want to ask that if i use Character Controller instead of Rigibody then what Photon view should i use ???

  • @tboxfinn
    @tboxfinn 8 месяцев назад +1

    you got any idea on how I can make each player have its own camera in unity multiplayer?

  • @chanceblevins3842
    @chanceblevins3842 6 месяцев назад

    Question. I used another script to allow scoping in for my sniper. wanted to change the sense but when i tried to change the sense in the script by grabing the component and setting that = new vector2 (1, 1) instead it didnt work. how should i get the sense to slow down?

  • @lime_68
    @lime_68 10 месяцев назад +1

    Wow, thanks dude! Awesome tutorial. Can I use PUN for the mobile?

  • @user-zl6tb4rl1s
    @user-zl6tb4rl1s 5 месяцев назад

    cool video)

  • @kingmase6502
    @kingmase6502 Месяц назад

    Love these tutorials but the RoomManager code has errors for me in Microsoft visuals and i was wonder what you are using for the code and how i may download it?

  • @Ocer.
    @Ocer. 7 месяцев назад

    At 04:45, how do you actually get those black boxes?

  • @kenneth2hip
    @kenneth2hip Месяц назад

    Hiya, new game dev here! I'm trying to make a competitive third person mobile game and I was wondering if I should go for PUN 2 or Fusion 2. Which one would work best in my case?

  • @bogoid
    @bogoid Месяц назад

    jetbrains user... instant subscribe

  • @thelostnomad09
    @thelostnomad09 Год назад

    Hey @bananastutorials i love the vid so far but am wondering if you know to to fix my problem?
    when i added the mouse look script it doesnt let me look up or down. Thanks!

    • @bananastutorials
      @bananastutorials  11 месяцев назад

      Try this new script, maybe your camera is rotated wrong?
      drive.google.com/file/d/1j-92b6X5cLxszYKdZb_BAyJx0xuxhVmA/view?usp=sharing

  • @XGameR593
    @XGameR593 Год назад +1

    When i try to type Vector3 CalculateMovement(float _speed) it gives me a error saying not all code paths return a value
    do you know how to fix it?

    • @Byteezexe
      @Byteezexe Год назад +1

      continue the code it will get fixed by itself

  • @Xpl13r
    @Xpl13r 14 дней назад +3

    can i use my own movment script?

  • @MUSKETPENGUIN3000
    @MUSKETPENGUIN3000 Год назад +1

    Hi, This has been very helpful so far, but I was wondering if I could just put the player in a prefab folder? Thanks alot by the way!

    • @calok
      @calok Год назад +1

      You cant because Photon wont recognize it as a object that wants to be synced.

    • @MUSKETPENGUIN3000
      @MUSKETPENGUIN3000 Год назад +1

      @@calok Ik, I just found out a few weeks ago. Thank you anyway!

    • @calok
      @calok Год назад +1

      @@MUSKETPENGUIN3000 someone else might also stumble on this issue and see replies :)

    • @MUSKETPENGUIN3000
      @MUSKETPENGUIN3000 Год назад +1

      @@calok yep, that's nice :)

    • @2ksnakenoodles
      @2ksnakenoodles 3 месяца назад

      Actually, sorry for the late response, but you can set a path for it in the script itself.@@MUSKETPENGUIN3000

  • @Guyiscoole
    @Guyiscoole 11 месяцев назад +2

    you forgot to show how to add the onjoinedroom thing

  • @hussainabidi1043
    @hussainabidi1043 Год назад +2

    you're getting like 50 subs per day now :))

  • @rameezsafdar6563
    @rameezsafdar6563 2 месяца назад

    Where do i get the wallpaper you have on your PC??

  • @juicemanjohn9700
    @juicemanjohn9700 Год назад +3

    The Mouse Look Script is not contained in the in the pack nor is anything else. What happened???

    • @bananastutorials
      @bananastutorials  11 месяцев назад +1

      Thanks for letting me know!
      Posted it here:
      drive.google.com/file/d/1j-92b6X5cLxszYKdZb_BAyJx0xuxhVmA/view?usp=sharing

  • @yepshu
    @yepshu 7 месяцев назад +1

    Hello, i tried to launch the game, and the camera started to fall underneath the plane? (if that makes sense). I need help

    • @JoskeVR
      @JoskeVR 4 месяца назад

      you probably put your rigidbody on top of the camera, make sure its on the bean (player) and if you still fall trough the ground make sure that there's a collider on the floor and maybe put your player a little higher above the ground

  • @AaronAsherRandall
    @AaronAsherRandall Год назад +2

    Thanks for the video! I keep getting this error:
    Can not Instantiate before the client joined/created a room. State: Joining
    Should the Instantiation be in another method? Or maybe it is trying to Instantiate too quickly - before the client joined/created a room?

    • @AaronAsherRandall
      @AaronAsherRandall Год назад +4

      Actually, I just fixed this by looking at some forums. I added the Instantiate to the OnJoinedRoom() method instead of the OnJoinedLobby as you had it in the video. Why won't mine work the way yours works though?
      public override void OnJoinedRoom()
      {
      base.OnJoinedRoom();
      GameObject _player = PhotonNetwork.Instantiate(player.name, spawnPoint.position, Quaternion.identity);
      }

    • @bananastutorials
      @bananastutorials  Год назад +1

      Awesome thanks for sharing!!

    • @gamedevguy54
      @gamedevguy54 9 месяцев назад

      @@AaronAsherRandall i got the same error and tried your code and i dont spawn in can you help me pls?

    • @user-vb7of4nh5v
      @user-vb7of4nh5v 9 месяцев назад

      @@gamedevguy54 same

    • @PoggerFishW
      @PoggerFishW Месяц назад

      @@gamedevguy54 same

  • @ErikGodoi
    @ErikGodoi Год назад

    Hi
    We need another link for your packages, the one that is in the description doesn't have anything in it

    • @bananastutorials
      @bananastutorials  11 месяцев назад

      Thanks for letting me know!
      Posted it here:
      drive.google.com/file/d/1j-92b6X5cLxszYKdZb_BAyJx0xuxhVmA/view?usp=sharing

  • @YourFavoriteGoober
    @YourFavoriteGoober 2 месяца назад +1

    My Visual Studio never changes the color of the Photon related code and then whenever i reopen my project it askes me if i want to open in safe mode and gives me tons or errors. if i delete the room manager script it clears all the errors can i please have help

    • @bananastutorials
      @bananastutorials  2 месяца назад

      You provably have an error, check the console window for errors :)

  • @itsgabeplays
    @itsgabeplays 5 месяцев назад

    how do you get it to autofill photon commands?

  • @richsombie
    @richsombie 11 месяцев назад +1

    I'm getting the error : "JoinOrCreateRoom failed. Client is on MasterServer (must be Master Server for matchmaking)but not ready for operations (State: Joining). Wait for callback: OnJoinedLobby or OnConnectedToMaster.
    UnityEngine.Debug:LogError (object)".
    When I click play it seems like it runs fine but I also get an error in the console.

    • @bananastutorials
      @bananastutorials  11 месяцев назад +1

      Maybe wait a bit before pressing the join button

    • @byt3shift
      @byt3shift Месяц назад

      void Start()
      {
      Debug.Log("Connecting");
      PhotonNetwork.ConnectUsingSettings();
      }
      public override void OnConnectedToMaster()
      {
      base.OnConnectedToMaster();
      Debug.Log("Connected to Server");
      PhotonNetwork.JoinLobby();
      }
      public override void OnJoinedLobby()
      {
      base.OnJoinedLobby();
      PhotonNetwork.JoinOrCreateRoom("test", null, null);
      Debug.Log("We are in the Lobby");
      }
      public override void OnJoinedRoom()
      {
      base.OnJoinedRoom();
      Debug.Log("We are connected and in a room");
      GameObject _player = PhotonNetwork.Instantiate(player.name, spawnPoint.position, Quaternion.identity);
      _player.GetComponent().IsLocalPlayer();
      }

  • @rafaeldossantos1998
    @rafaeldossantos1998 10 месяцев назад +1

    i cant make the room manager script
    tthere are issues

  • @WinstonAnthony777
    @WinstonAnthony777 5 месяцев назад +2

    hey man thanks for the tutorials! I am still learning the ropes with programming and I keep on getting this error (Can not Instantiate before the client joined/created a room. State: Joining UnityEngine.Debug Joining Engine.Debug Joining
    UnityEngine.Debug:LogError (object))
    which is preventing me from spawning my player. any help would be greatly appreciated. Thanks

    • @biotest05
      @biotest05 5 месяцев назад

      i guess your trying to instantiate a prefab in the network while joining a room, try doing a while loop after the join room function thats something like while(!PhotonNetwork.InRoom) but make it empty, its gonna run the rest of the code if your gonna be in a room. after the while loop add the instantiate method. (idk i really dont use the tut, it may work tho!)

  • @itsepic11_
    @itsepic11_ 10 месяцев назад

    why does the player deletes itself few seconds later in play mode

  • @user-mf4ui7qi9l
    @user-mf4ui7qi9l 3 месяца назад

    plz fix me this Error Can not Instantiate before the client joined/created a room. State: Joining

  • @chiragsharma5138
    @chiragsharma5138 Год назад +2

    I am Having an error that Multiple precompiled assemblies with the same name websocket-sharp. Dll included oon the current platform. Only one assembly with the same name is allowed per platform.

    • @bananastutorials
      @bananastutorials  Год назад

      Reimport into another project, see if that helps

    • @jafizz6505
      @jafizz6505 2 месяца назад

      @@bananastutorialsit says join lobby not called because client is not connected or not ready yet

    • @jafizz6505
      @jafizz6505 2 месяца назад

      @@bananastutorialsnvm thanks

  • @HT-lp9kz
    @HT-lp9kz 3 месяца назад

    So new to this, how do you pull up that script editor for the room manager script?

  • @kvzmo2x
    @kvzmo2x День назад

    @bananadev2 i dont have all the assembly csharp things in my visual studios idk what to do

  • @itsgabeplays
    @itsgabeplays 5 месяцев назад

    How do you autofill Photon Commands?

  • @StarStruckClothing
    @StarStruckClothing 7 дней назад

    It says it, "Can not Instantiate before the client joined/created a room state: joining" what does this mean it wont let me join the room or anything how do I fix this?

  • @MuhammadHosny0
    @MuhammadHosny0 Год назад

    Hey Alex, I'm CodeMaster Muhammad Hosny, nice to meet you.

  • @graysononVR
    @graysononVR 7 месяцев назад +1

    When i build the game, i go into unity and my pc build. If i move one character, the other one moves as well.

    • @zxdelt3015
      @zxdelt3015 4 месяца назад

      try enabling the movement script for player only when player is instantiated

  • @hawk2691
    @hawk2691 10 месяцев назад

    Hi, I'm a beginner and I just got acquainted with this environment and I don't know how to code message: I will use what you use. If possible, please introduce any source that can help me❤❤❤❤❤😮

  • @poring1026
    @poring1026 3 месяца назад

    Hello, how to enable those "black boxes" in the code editor and it will show the data types and variables when you type a certain code.

    • @OskarSharns
      @OskarSharns 3 месяца назад

      Rider program, or Rider Extension for Visual Studio

  • @lunark202
    @lunark202 2 месяца назад

    Hey there! I'm developing a multiplayer soccer game using PUN2 and Unity. Currently, I can create rooms, allow players to join and leave rooms, and as the room host, I can start the game and send all players to the 'game' screen. Additionally, all players can walk, run, and jump, and everyone can see these actions. However, there's an issue: Since it's a soccer game, I've added a 'ball' object in the middle of the field, and within my PlayerController script, I'm using OnCollisionEnter to apply strong contact to the ball, thus altering its position-a basic soccer mechanic. My 'ball' object includes components like Sphere Collider, Rigidbody, Photon View, Photon Transform View, and Photon Rigidbody View. While other players can interact with the ball smoothly, the host of the room cannot see other players changing the ball's position; the ball only moves when the host touches it, and then other players can see its movement. How can I resolve this? Thanks!

    • @lunark202
      @lunark202 2 месяца назад +1

      Code:
      using Photon.Pun;
      using System.Collections;
      using System.Collections.Generic;
      using Unity.VisualScripting;
      using UnityEngine;
      public class PlayerController : MonoBehaviour
      {
      [SerializeField] float mouseSensitivity, sprintSpeed, walkSpeed, jumpForce, smoothTime;
      [SerializeField] GameObject cameraHolder;
      float verticalLookRotation;
      bool grounded;
      Vector3 smoothMoveVelocity;
      Vector3 moveAmount;
      Rigidbody rb;
      PhotonView pv;
      private void Awake()
      {
      rb = GetComponent();
      pv = GetComponent();
      }
      private void Start()
      {
      if (!pv.IsMine)
      {
      Destroy(GetComponentInChildren().gameObject);
      Destroy(rb);
      }
      }
      private void Update()
      {
      if (!pv.IsMine)
      return;
      PlayerLook();
      PlayerMove();
      PlayerJump();
      }
      private void PlayerLook()
      {
      transform.Rotate(Vector3.up * Input.GetAxisRaw("Mouse X") * mouseSensitivity);
      verticalLookRotation += Input.GetAxisRaw("Mouse Y") * mouseSensitivity;
      verticalLookRotation = Mathf.Clamp(verticalLookRotation, -90f, 90f);
      cameraHolder.transform.localEulerAngles = Vector3.left * verticalLookRotation;
      }
      void PlayerMove()
      {
      Vector3 moveDir = new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical")).normalized;
      moveAmount = Vector3.SmoothDamp(moveAmount, moveDir * (Input.GetKey(KeyCode.LeftShift) ? sprintSpeed : walkSpeed), ref smoothMoveVelocity, smoothTime);
      }
      void PlayerJump()
      {
      if (Input.GetKeyDown(KeyCode.Space) && grounded)
      {
      rb.AddForce(transform.up * jumpForce);
      }
      }
      public void SetGroundState(bool _grounded)
      {
      grounded = _grounded;
      }
      private void FixedUpdate()
      {
      if (!pv.IsMine)
      return;
      rb.MovePosition(rb.position + transform.TransformDirection(moveAmount) * Time.fixedDeltaTime);
      }
      private void OnCollisionEnter(Collision collision)
      {
      if (collision.gameObject.CompareTag("Ball"))
      {
      Rigidbody ballRb = collision.gameObject.GetComponent();
      if (ballRb != null)
      {
      ballRb.AddForce(transform.forward * 1f, ForceMode.Impulse);
      }
      }
      }
      }

  • @fouresh
    @fouresh 8 месяцев назад +1

    Can not Instantiate before the client joined/created a room. State: Joining
    UnityEngine.Debug:LogError (object)

    • @mistersquido
      @mistersquido 4 месяца назад

      same i dont know how to fix it

  • @viktorkhomenko7798
    @viktorkhomenko7798 7 месяцев назад +1

    Hey, man, realy like your tutorials, thanks for sharing :) But if you could send a link to the entire project, it would greatly simplify the learning process ) Can you send, please ? :)

  • @playman047
    @playman047 День назад

    Voice is noisey, please have a good mic. Difficult to understand your voice properly. I am your new subscriber

  • @gamedevguy54
    @gamedevguy54 9 месяцев назад

    When I made the spawnpoint it doesn't work, it says can not instaniate before client joined/created a room and stops the game pls help me

    • @norththeval
      @norththeval 5 месяцев назад

      i have a same problem

  • @zettrazetta5310
    @zettrazetta5310 Год назад +1

    From where can i find the mouse look script ?

    • @bananastutorials
      @bananastutorials  11 месяцев назад +1

      Posted it here:
      drive.google.com/file/d/1j-92b6X5cLxszYKdZb_BAyJx0xuxhVmA/view?usp=sharing

  • @gummyow3059
    @gummyow3059 Год назад +4

    So I got everything working, and I am experiencing a lot of jitter and lag. Was wondering if there was anything I could do to make the connection super smooth.
    Note: I am using the free version and am not sure if that would have any affect.

    • @bananastutorials
      @bananastutorials  Год назад +2

      In your rigidbody settings on the player, set the interpolation dropdown to interpolate :)

    • @atharvasarfare5340
      @atharvasarfare5340 9 месяцев назад

      @@bananastutorials I did it but its not working

  • @SHADOW11SAMURAI
    @SHADOW11SAMURAI Месяц назад

    Is it compatible with webgl build?

  • @bexony
    @bexony 11 месяцев назад +2

    Help please, I have a big problem "Operation JoinLobby (229) not called, client state: ConnectingToMasterServer error. Help😢

    • @bananastutorials
      @bananastutorials  11 месяцев назад +1

      hey man, it’s hard to tell with the little info I have, make sure to copy my room manager code exactly tho

    • @bananastutorials
      @bananastutorials  11 месяцев назад +1

      The error "Operation JoinLobby (229) not called, client state: ConnectingToMasterServer" suggests that the JoinLobby operation is not being called, and the client state is still in the process of connecting to the master server.
      Double-check your code to ensure that the JoinLobby operation is being called correctly. Look for any potential issues such as incorrect method calls, missing callbacks, or improper timing of the JoinLobby operation.

    • @byt3shift
      @byt3shift Месяц назад

      void Start()
      {
      Debug.Log("Connecting");
      PhotonNetwork.ConnectUsingSettings();
      }
      public override void OnConnectedToMaster()
      {
      base.OnConnectedToMaster();
      Debug.Log("Connected to Server");
      PhotonNetwork.JoinLobby();
      }
      public override void OnJoinedLobby()
      {
      base.OnJoinedLobby();
      PhotonNetwork.JoinOrCreateRoom("test", null, null);
      Debug.Log("We are in the Lobby");
      }
      public override void OnJoinedRoom()
      {
      base.OnJoinedRoom();
      Debug.Log("We are connected and in a room");
      GameObject _player = PhotonNetwork.Instantiate(player.name, spawnPoint.position, Quaternion.identity);
      _player.GetComponent().IsLocalPlayer();
      }

  • @SzxVex
    @SzxVex 10 месяцев назад +1

    The RoomManager script is not working pls help or link the roommanager code

    • @JSRCU13
      @JSRCU13 4 месяца назад

      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using Photon.Pun;
      public class RoomManager : MonoBehaviourPunCallbacks
      {
      // Start is called before the first frame update
      void Start()
      {
      Debug.Log("Connecting...");
      PhotonNetwork.ConnectUsingSettings();
      }
      public override void OnConnectedToMaster()
      {
      base.OnConnectedToMaster();
      Debug.Log("Connected to Server");
      PhotonNetwork.JoinLobby();
      }
      public override void OnJoinedLobby()
      {
      base.OnJoinedLobby();
      PhotonNetwork.JoinOrCreateRoom("test", null, null);
      Debug.Log("We're connected and in a room now");
      }
      }

  • @OfficialDragha
    @OfficialDragha 7 месяцев назад +1

    can you post all scripts in the comments?

  • @AaaaRndom
    @AaaaRndom Год назад

    It says Vector 3, Vector2, Rigidbody, and MonoBehaviour can not be found, how could I fix this?

    • @bananastutorials
      @bananastutorials  11 месяцев назад

      I think you’re not deriving from monobehavour or you deleted some of the using statements at the top of your script

  • @diegopoveda4762
    @diegopoveda4762 10 месяцев назад +1

    Thank you very much, first of all, I went through the whole process step by step, but I don't understand why I get this error.
    Can not Instantiate before the client joined/created a room. State: PeerCreated
    UnityEngine.Debug:LogError (object)
    I hope you can help me

    • @tegbx3619
      @tegbx3619 9 месяцев назад +10

      Hey i had the same error and here is the fixed version : (Thank me later :D)
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using Photon.Pun;
      public class RoomManager : MonoBehaviourPunCallbacks
      {
      public GameObject player;
      public Transform spawnPoint;
      // Start is called before the first frame update
      void Start()
      {
      Debug.Log("Connecting...");
      PhotonNetwork.ConnectUsingSettings();
      }
      public override void OnConnectedToMaster()
      {
      base.OnConnectedToMaster();
      Debug.Log("Connected to Server");
      PhotonNetwork.JoinLobby();
      }
      public override void OnJoinedLobby()
      {
      base.OnJoinedLobby();
      PhotonNetwork.JoinOrCreateRoom("test", null, null);
      Debug.Log("We're connected and in a room now");
      }
      public override void OnJoinedRoom()
      {
      base.OnJoinedRoom();
      Debug.Log("Joined a room");
      GameObject _player = PhotonNetwork.Instantiate(player.name, spawnPoint.position, Quaternion.identity);
      }
      }

    • @resurrectiondailuz9450
      @resurrectiondailuz9450 7 месяцев назад

      @@tegbx3619 Thank i love you

    • @OfficialDragha
      @OfficialDragha 7 месяцев назад

      thank i had the same error
      @@tegbx3619

    • @furkanwhogod
      @furkanwhogod 6 месяцев назад

      @@tegbx3619 you are the real hero in my heart

    • @hexag0n777
      @hexag0n777 5 месяцев назад

      @@tegbx3619 thx so much bro

  • @obinnajames
    @obinnajames 8 месяцев назад

    I get 3 errors:
    1) 'Vector2' is an ambiguous reference between 'UnityEngine.Vector2' and 'System.Numerics.Vector2'
    2) 'Vector3' is an ambiguous reference between 'UnityEngine.Vector3' and 'System.Numerics.Vector3'
    3) 'Input' is an ambiguous reference between 'UnityEngine.Input' and 'UnityEngine.Windows.Input'
    Please how do I resolve these?

    • @maxii974
      @maxii974 7 месяцев назад

      Hi,
      You import this library System.Numerics when you code. Be careful to use only Vector2 from UnityEngine.
      To resolve your problem, delete the "using System.Numerics" on the top.

  • @zenpresentt
    @zenpresentt 10 месяцев назад

    My movement has no counter movement and i just slip off my plane. I have already finished eps 2. I was wondering if you can help

    • @bananastutorials
      @bananastutorials  10 месяцев назад

      ?

    • @zenpresentt
      @zenpresentt 10 месяцев назад

      uhhh never mind i just used a different movement and it’s okay!👌

  • @Fatty_Chicken
    @Fatty_Chicken Месяц назад

    I have the room manager script copied 1 to 1 and mine doesnt work and doesn't tell me what is wrong is it because i use visual studio or what

  • @mrpago15
    @mrpago15 8 месяцев назад

    i couldnt write the code correct
    i followed your steps but couldnt make it same
    like if your line is 17 mine would be 12 or 13
    can you please give the whole code as a zip or googledrive
    please

    • @JoskeVR
      @JoskeVR 4 месяца назад

      doesn't matter on what line the code is, just needs to be correct

  • @Bricky_cK
    @Bricky_cK 8 месяцев назад

    does someone have the movement script?

  • @Neo_lol
    @Neo_lol 8 месяцев назад

    Hey when i hit play my player isnt spawning but i dont get any errors except
    Can not Instantiate before the client joined/created a room. State: Joining
    UnityEngine.Debug:LogError (object)

    • @mrmirchi3647
      @mrmirchi3647 7 месяцев назад

      Same

    • @byt3shift
      @byt3shift Месяц назад

      void Start()
      {
      Debug.Log("Connecting");
      PhotonNetwork.ConnectUsingSettings();
      }
      public override void OnConnectedToMaster()
      {
      base.OnConnectedToMaster();
      Debug.Log("Connected to Server");
      PhotonNetwork.JoinLobby();
      }
      public override void OnJoinedLobby()
      {
      base.OnJoinedLobby();
      PhotonNetwork.JoinOrCreateRoom("test", null, null);
      Debug.Log("We are in the Lobby");
      }
      public override void OnJoinedRoom()
      {
      base.OnJoinedRoom();
      Debug.Log("We are connected and in a room");
      GameObject _player = PhotonNetwork.Instantiate(player.name, spawnPoint.position, Quaternion.identity);
      _player.GetComponent().IsLocalPlayer();
      }

  • @fraiva22
    @fraiva22 7 месяцев назад

    Can not Instantiate before the client joined/created a room. State: Joining

    • @JoskeVR
      @JoskeVR 4 месяца назад

      it says that it can only spawn the player after it connected to the server, make sure you put the instantiate line in the roommanager on the correctline. so check your script and see if everything is the same

  • @NightGuardBaylan
    @NightGuardBaylan 3 месяца назад

    My Mouse Look Thing Is Allowing Me To Look Down Or Up Only Left Or Right

  • @Carmello_1
    @Carmello_1 13 дней назад

    Is it still for 2024

  • @Gamers-Taste
    @Gamers-Taste 3 месяца назад

    can you please add copy and paste on the script

  • @TheRadioactiveEngineer
    @TheRadioactiveEngineer Год назад

    How about photon fusion?

    • @bananastutorials
      @bananastutorials  11 месяцев назад

      Pun is much simpler and its what I use for my game with 300K + downloads, fusion is good but a lot more work, might make a tutorial on it in a couple months

  • @minima_studios
    @minima_studios 9 месяцев назад

    in light of recent events u better remove that text at 0:07 XD 200k installs

  • @deflandon2931
    @deflandon2931 Год назад

    A , D, W, and S keys are flipped. Please help.

    • @bananastutorials
      @bananastutorials  11 месяцев назад

      Maybe you have a negative sign somewhere in your movement script

  • @playman047
    @playman047 2 дня назад

    make more unity tutorials

  • @NyctoHiding
    @NyctoHiding 9 месяцев назад

    How do you get the scripting part?

  • @monkey199vr
    @monkey199vr 2 месяца назад

    pls tell me what software your useing

  • @user-yj1tl2rd4g
    @user-yj1tl2rd4g 2 месяца назад

    Could you share the script for the Room Manager?

    • @Comprobrain
      @Comprobrain 28 дней назад

      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using Photon.Pun;
      public class RoomManager : MonoBehaviourPunCallbacks
      {
      public GameObject player;
      public Transform spawnPoint; // The player's respawn point
      void Start()
      {
      Debug.Log("Connecting...");
      PhotonNetwork.ConnectUsingSettings();
      }
      public override void OnConnectedToMaster()
      {
      base.OnConnectedToMaster();
      Debug.Log("Connected to the server");
      PhotonNetwork.JoinLobby();
      }
      public override void OnJoinedLobby()
      {
      base.OnJoinedLobby();
      Debug.Log("Joined the lobby");
      // Attempt to join or create a room named "test"
      PhotonNetwork.JoinOrCreateRoom("test", null, null);
      // Debug.Log("We've joined a room");
      // GameObject _player = PhotonNetwork.Instantiate(player.name, spawnPoint.position, Quaternion.identity);
      }
      public override void OnJoinedRoom()
      {
      base.OnJoinedRoom();
      Debug.Log("Joined the room");
      // Ensure this call is made when the client is the master client of the room
      if (PhotonNetwork.IsMasterClient)
      {
      // Instantiate the player object
      GameObject _player = PhotonNetwork.Instantiate(player.name, spawnPoint.position, Quaternion.identity);
      }
      }
      }
      by a random person in comments

  • @Exxkap
    @Exxkap 6 месяцев назад

    Can you use just any movement script?

    • @JoskeVR
      @JoskeVR 4 месяца назад +1

      yes

    • @Exxkap
      @Exxkap 4 месяца назад

      @@JoskeVR yeah figur3d that out 2 months ago

  • @Team_Battle_Pro
    @Team_Battle_Pro 4 месяца назад

    Movement not working

  • @user-mf4ui7qi9l
    @user-mf4ui7qi9l 3 месяца назад

    hi, I need Source Code PLZ

  • @richsombie
    @richsombie 11 месяцев назад

    whenever i test out the player movement, I move in both the x and z axis at the same time (when I press w or s).

    • @richsombie
      @richsombie 11 месяцев назад

      Never mind, I got it to work. All I did was change the walk speed from 4 to 5, and back to 4.

  • @lixq7r
    @lixq7r Год назад +2

    it says "Can not Instantiate before the client joined/created a room" on console how can i fix it

    • @bananastutorials
      @bananastutorials  Год назад +1

      make sure the room manager script is exactly how i’ve done it :)

    • @bananastutorials
      @bananastutorials  Год назад +1

      that’s where it’s from best of luck

    • @lixq7r
      @lixq7r Год назад

      @@bananastutorials i tried it several times but the errror is not solved

    • @dominiclashombo
      @dominiclashombo Год назад +1

      @@lixq7r here is ep 1 just change what has to be changed if eny thing ( using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using Photon.Pun;
      public class RoomManager : MonoBehaviourPunCallbacks
      {
      // Start is called before the first frame update
      void Start()
      {
      Debug.Log(message:"[Connectomg....") ;
      PhotonNetwork.ConnectUsingSettings();
      }
      // Update is called once per frame
      void Update()
      {

      }
      public override void OnConnectedToMaster()
      {
      base.OnConnectedToMaster();
      Debug.Log(message: "Connected to Server");
      PhotonNetwork.JoinLobby();
      }
      public override void OnJoinedLobby()
      {
      base.OnJoinedLobby();
      PhotonNetwork.JoinOrCreateRoom(roomName: "test", roomOptions: null, typedLobby: null);
      Debug.Log(message: "Were connected and in a room now");
      }
      }

    • @AaronAsherRandall
      @AaronAsherRandall Год назад +1

      @@bananastutorials I have got everything set up exactly as you and I am getting the same error...

  • @NightGuardBaylan
    @NightGuardBaylan 3 месяца назад

    Could you put the movement in the Comments Im Having Trouble

  • @faded87
    @faded87 11 месяцев назад +1

    It keeps saying
    NullReferenceExeption: Object reference not set to an instance of an object
    How do I fix this please

    • @bananastutorials
      @bananastutorials  11 месяцев назад +2

      something is not referenced in the inspector

  • @RangerPeeps
    @RangerPeeps Год назад +2

    Is anyone else getting the error “All compiler errors have to be fixed before you can enter play mode”?
    Edit: This is when setting up the Room Manager Script, I haven’t even started on the rest of the video.

    • @graphicsxoff
      @graphicsxoff Год назад +1

      bro i can give u a new script if u want. it works

    • @graphicsxoff
      @graphicsxoff Год назад +1

      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class MoveMents : MonoBehaviour
      {
      private CharacterController controller;
      private Vector3 playerVelocity;
      private bool groundedPlayer;
      private float playerSpeed = 2.0f;
      private float jumpHeight = 1.0f;
      private float gravityValue = -9.81f;
      private void Start()
      {
      controller = gameObject.AddComponent();
      }
      void Update()
      {
      groundedPlayer = controller.isGrounded;
      if (groundedPlayer && playerVelocity.y < 0)
      {
      playerVelocity.y = 0f;
      }
      Vector3 move = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
      controller.Move(move * Time.deltaTime * playerSpeed);
      if (move != Vector3.zero)
      {
      gameObject.transform.forward = move;
      }
      // Changes the height position of the player..
      if (Input.GetButtonDown("Jump") && groundedPlayer)
      {
      playerVelocity.y += Mathf.Sqrt(jumpHeight * -3.0f * gravityValue);
      }
      playerVelocity.y += gravityValue * Time.deltaTime;
      controller.Move(playerVelocity * Time.deltaTime);
      }
      }

    • @RangerPeeps
      @RangerPeeps Год назад +1

      @@graphicsxoff Thanks

  • @user-uw5qj1rp1y
    @user-uw5qj1rp1y 9 месяцев назад

    Resources

  • @suuuur-xh2mr
    @suuuur-xh2mr 9 месяцев назад

    script
    ples

    • @stealthycat9253
      @stealthycat9253 7 месяцев назад

      using System;
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class Movement : MonoBehaviour
      {
      public float walkSpeed = 4f;
      public float maxVelocityChange = 10f;
      private Vector2 input;
      private Rigidbody rb;

      // Start is called before the first frame update
      void Start()
      {
      rb = GetComponent();
      }
      // Update is called once per frame
      void Update()
      {
      input = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
      input.Normalize();
      }
      void FixedUpdate()
      {
      rb.AddForce(CalculateMovement(walkSpeed), ForceMode.VelocityChange);
      }
      Vector3 CalculateMovement(float _speed)
      {
      Vector3 targetVelocity = new Vector3(input.x, 0, input.y);
      targetVelocity = transform.TransformDirection(targetVelocity);
      targetVelocity *= _speed;
      Vector3 velocity = rb.velocity;
      if (input.magnitude > 0.5f)
      {
      Vector3 velocityChange = targetVelocity - velocity;
      velocityChange.x = Mathf.Clamp(velocityChange.x, -maxVelocityChange, maxVelocityChange);
      velocityChange.x = Mathf.Clamp(velocityChange.z, -maxVelocityChange, maxVelocityChange);
      velocityChange.y = 0;
      return (velocityChange);
      }
      else
      {
      return new Vector3();
      }

      }
      }

  • @andreicristianfigula9961
    @andreicristianfigula9961 Год назад

    code pls

    • @fraiva22
      @fraiva22 11 месяцев назад +1

      you are so lazy

  • @NurbolNygmanov
    @NurbolNygmanov 21 день назад

    lol very small pack

  • @cinarbugra
    @cinarbugra Год назад

    can you give the projetc or code

    • @bananastutorials
      @bananastutorials  Год назад +2

      It'll take a few weeks for me to finish this series. & then I'll release the final project

    • @bananastutorials
      @bananastutorials  Год назад +1

      I'd recommend you follow along though so you actually get the chance to learn the skills and can add new features to your game :)

    • @cinarbugra
      @cinarbugra Год назад

      @@bananastutorials will it free

    • @dominiclashombo
      @dominiclashombo Год назад +4

      @@cinarbugra omg lol just type it out its not hard not everthing in life is free if he wanted to make it 10 bux he could if he makes it free its hes choice.........😂

  • @eleuzeratya
    @eleuzeratya 3 месяца назад

    There is a small error that I cannot solve:
    When I delete the "Player" and try to start the "game" I get this error:
    "Cannot be made immediately before the client has joined/created a room. Status: Joining UnityEngine.Debug:LogError (object)"
    and:
    "Can not Instantiate before the client joined/created a room. State: Joining
    UnityEngine.Debug:LogError (object)
    Photon.Pun.PhotonNetwork:Instantiate (string,UnityEngine.Vector3,UnityEngine.Quaternion,byte,object[]) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:2477)
    RoomManager:OnJoinedLobby () (at Assets/RoomManager.cs:38)
    Photon.Realtime.LobbyCallbacksContainer:OnJoinedLobby () (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:4455)
    Photon.Realtime.LoadBalancingClient:OnOperationResponse (ExitGames.Client.Photon.OperationResponse) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2944)
    ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback (ExitGames.Client.Photon.StreamBuffer) (at D:/Dev/photon-sdk-dotnet/PhotonDotNet/PeerBase.cs:877)
    ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands () (at D:/Dev/photon-sdk-dotnet/PhotonDotNet/EnetPeer.cs:577)
    ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands () (at D:/Dev/photon-sdk-dotnet/PhotonDotNet/PhotonPeer.cs:1777)
    Photon.Pun.PhotonHandler:Dispatch () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:232)
    Photon.Pun.PhotonHandler:FixedUpdate() (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:152)"
    Both Player and Spawn Point are set in RoomManager.
    All log's link: drive.google.com/drive/folders/1PFJDolQU74QU3W_Ljd65OnxgSF-zNi_E?usp=sharing

    • @bananastutorials
      @bananastutorials  3 месяца назад

      Just wait a bit longer before clicking the join buttons, I might make a video addressing it specifically soon

  • @TSAR_BOMBA_100
    @TSAR_BOMBA_100 11 месяцев назад +2

    I keep getting this error
    Error CS0029 Cannot implicitly convert type 'float' to 'UnityEngine.Vector3' Assembly-CSharp D:\Multiplayer FPS\Assets\Movement.cs 45 Active
    here is my code
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class Movement : MonoBehaviour
    {
    public float walkSpeed = 4f;
    public float maxVelocityChange = 10f;
    private Vector2 input;
    private Rigidbody rb;
    // Start is called before the first frame update
    void Start()
    {
    rb = GetComponent();
    }
    // Update is called once per frame
    void Update()
    {
    input = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
    input.Normalize();
    }
    private void FixedUpdate()
    {
    rb.AddForce(CalculateMovement(walkSpeed), ForceMode.VelocityChange);
    }
    Vector3 CalculateMovement(float _speed)
    {
    Vector3 targetVelocity = new Vector3(input.x, 0, input.y);
    targetVelocity = transform.TransformDirection(targetVelocity);
    targetVelocity *= _speed;
    Vector3 velocity = rb.velocity;
    if (input.magnitude > 0.5f)
    {
    Vector3 velocityChange = targetVelocity - velocity;
    velocityChange = Mathf.Clamp(velocityChange.x, -maxVelocityChange, maxVelocityChange);
    velocityChange = Mathf.Clamp(velocityChange.z, -maxVelocityChange, maxVelocityChange);
    velocityChange.y = 0;
    return (velocityChange);
    }
    else
    {
    return new Vector3();
    }
    }
    }
    someone please help me

    • @bananastutorials
      @bananastutorials  11 месяцев назад +1

      New fixed lines
      velocityChange.x = Mathf.Clamp(velocityChange.x, -maxVelocityChange, maxVelocityChange);
      velocityChange.z = Mathf.Clamp(velocityChange.z, -maxVelocityChange, maxVelocityChange);

    • @bananastutorials
      @bananastutorials  11 месяцев назад +1

      The error "Operation JoinLobby (229) not called, client state: ConnectingToMasterServer" suggests that the JoinLobby operation is not being called, and the client state is still in the process of connecting to the master server.
      Double-check your code to ensure that the JoinLobby operation is being called correctly. Look for any potential issues such as incorrect method calls, missing callbacks, or improper timing of the JoinLobby operation.

    • @TSAR_BOMBA_100
      @TSAR_BOMBA_100 11 месяцев назад +1

      Thanks, I missed that part.

  • @DriftyFn322
    @DriftyFn322 Месяц назад

    HELP! I get this error Can not Instantiate before the client joined/created a room. State: Joining
    UnityEngine.Debug:LogError (object)
    Photon.Pun.PhotonNetwork:Instantiate (string,UnityEngine.Vector3,UnityEngine.Quaternion,byte,object[]) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:2477)
    RoomManager:OnJoinedLobby () (at Assets/Scripts/RoomManager.cs:31)
    Photon.Realtime.LobbyCallbacksContainer:OnJoinedLobby () (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:4455)
    Photon.Realtime.LoadBalancingClient:OnOperationResponse (ExitGames.Client.Photon.OperationResponse) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2944)
    ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback (ExitGames.Client.Photon.StreamBuffer) (at D:/Dev/photon-sdk-dotnet/PhotonDotNet/PeerBase.cs:877)
    ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands () (at D:/Dev/photon-sdk-dotnet/PhotonDotNet/EnetPeer.cs:577)
    ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands () (at D:/Dev/photon-sdk-dotnet/PhotonDotNet/PhotonPeer.cs:1777)
    Photon.Pun.PhotonHandler:Dispatch () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:232)
    Photon.Pun.PhotonHandler:FixedUpdate () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:152)

    • @yewenysupreme
      @yewenysupreme Месяц назад

      I also get this error, but I select it.
      You can look this!
      Possible Issues:
      Instantiating the player object within the OnJoinedLobby method might be premature, as at this point the client has only entered the lobby and has not yet joined or created a specific game room.
      The call to PhotonNetwork.Instantiate may occur before the client successfully joins a room.
      Solution:
      Move the instantiation code to the correct callback: You should instantiate the player object within the OnJoinedRoom or OnCreatedRoom callback methods. These methods are invoked after the client has successfully joined or created a room.
      Modify the script: Move the instantiation code from OnJoinedLobby to OnJoinedRoom or OnCreatedRoom.
      Here is an example of the modified RoomManager script:
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using Photon.Pun;
      public class RoomManager : MonoBehaviourPunCallbacks
      {
      public GameObject player;
      public Transform spawnPoint; // The player's respawn point
      void Start()
      {
      Debug.Log("Connecting...");
      PhotonNetwork.ConnectUsingSettings();
      }
      public override void OnConnectedToMaster()
      {
      base.OnConnectedToMaster();
      Debug.Log("Connected to the server");
      PhotonNetwork.JoinLobby();
      }
      public override void OnJoinedLobby()
      {
      base.OnJoinedLobby();
      Debug.Log("Joined the lobby");
      // Attempt to join or create a room named "test"
      PhotonNetwork.JoinOrCreateRoom("test", null, null);
      // Debug.Log("We've joined a room");
      // GameObject _player = PhotonNetwork.Instantiate(player.name, spawnPoint.position, Quaternion.identity);
      }
      public override void OnJoinedRoom()
      {
      base.OnJoinedRoom();
      Debug.Log("Joined the room");
      // Ensure this call is made when the client is the master client of the room
      if (PhotonNetwork.IsMasterClient)
      {
      // Instantiate the player object
      GameObject _player = PhotonNetwork.Instantiate(player.name, spawnPoint.position, Quaternion.identity);
      }
      }
      }
      Please note the following points:
      Ensure that the player object is set up to be network-instantiable and is marked as such in the Photon Network project view.
      The spawnPoint should be a common point in the room for all players to share, or you need to have logic to determine a specific spawn point for each player.
      Make sure the PhotonView component on the player object has a unique view ID that is not zero. With these changes, you should be able to correctly instantiate the player object after the client successfully joins or creates a room.

    • @DriftyFn322
      @DriftyFn322 Месяц назад

      @@yewenysupreme Thanks very much it works

  • @not8533
    @not8533 Год назад +5

    drive.google.com/file/d/1KumgQyqcYDcZGuWJS8gdw7BpzHcHlAn-/view
    for those saying the link for his FPS pack doesnt work