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

Поділитися
Вставка
  • Опубліковано 18 лис 2024

КОМЕНТАРІ • 258

  • @bananastutorials
    @bananastutorials  Рік тому +6

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

    • @zero-parrot
      @zero-parrot Рік тому +1

      can u make the RoomManager im having trouble with it

    • @lucksthedev
      @lucksthedev 10 місяців тому

      plz
      @@zero-parrot

    • @scorpiogaming27
      @scorpiogaming27 8 місяців тому

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

    • @jafizz6505
      @jafizz6505 7 місяців тому

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

    • @Rotexizm
      @Rotexizm 6 місяців тому

      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:45)
      Photon.Realtime.LobbyCallbacksContainer:OnJoinedLobby () (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:4474)
      Photon.Realtime.LoadBalancingClient:OnOperationResponse (ExitGames.Client.Photon.OperationResponse) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2962)
      ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback (ExitGames.Client.Photon.StreamBuffer) (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/PeerBase.cs:877)
      ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands () (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/EnetPeer.cs:595)
      ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands () (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/PhotonPeer.cs:1778)
      Photon.Pun.PhotonHandler:Dispatch () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:232)
      Photon.Pun.PhotonHandler:FixedUpdate () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:152)

  • @Un4GivNX
    @Un4GivNX 2 роки тому +11

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

  • @toxiq5295
    @toxiq5295 2 роки тому +9

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

  • @d0c_dev
    @d0c_dev 2 роки тому +11

    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

  • @Yumari_544
    @Yumari_544 10 місяців тому +5

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

    • @fabexl5898
      @fabexl5898 10 місяців тому

      Who else is watching this now

  • @LilianCRE
    @LilianCRE 3 місяці тому +1

    thx ! (you have a nice background too)

  • @theWiseWordsCentral
    @theWiseWordsCentral Рік тому +1

    SO HELPFUL, Definitely underrated channel

  • @susgofres
    @susgofres 2 роки тому +2

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

  • @386olivercool
    @386olivercool 3 місяці тому +4

    Movement script: 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.z = Mathf.Clamp(velocityChange.z, -maxVelocityChange, maxVelocityChange);
    velocityChange.y = 0;
    return velocityChange;
    }
    else
    {
    return new Vector3();
    }
    }
    }

    • @eggdogyo
      @eggdogyo 2 місяці тому

      im not one to do this cuz i like codin, but thanks cuz i kept gettin errors with the vector 3 shit

    • @Abubakar-oo3us
      @Abubakar-oo3us 9 днів тому

      Appreciate it brother!

  • @dominiclashombo
    @dominiclashombo 2 роки тому +5

    dude this is gonna be awsome ooooo

  • @Vinn237
    @Vinn237 Рік тому +1

    underrated channel dude

  • @juicemanjohn9700
    @juicemanjohn9700 Рік тому +3

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

    • @bananastutorials
      @bananastutorials  Рік тому +1

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

  • @shubhampatel8193
    @shubhampatel8193 2 роки тому +10

    Continue this tutorial broo its awesome :)))

  • @rafaeldossantos1998
    @rafaeldossantos1998 Рік тому +3

    i cant make the room manager script
    tthere are issues

  • @thunderblitz88
    @thunderblitz88 Місяць тому +1

    Hello I am trying to make the game but it give me a error when I put the spawn code. It says “ cannot instantiate before joining”

  • @sceppzGD
    @sceppzGD 3 дні тому

    when i try to play it stays at display 1 no cameras rendering and the error says: "Can not instantiate before the client joined created a room"

  • @bexony
    @bexony Рік тому +2

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

    • @bananastutorials
      @bananastutorials  Рік тому +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  Рік тому +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 6 місяців тому

      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();
      }

  • @iamrandomhehe
    @iamrandomhehe Рік тому +2

    you forgot to show how to add the onjoinedroom thing

  • @Assem_DEV
    @Assem_DEV Місяць тому

    Photon is very easy, I remember when I was trying to experiment with multiplayer in Godot, I remember that I was building a server from scratch, in contrast in Photon you can connect to your server in Photon, by just calling a function🗿

  • @chiragsharma5138
    @chiragsharma5138 2 роки тому +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  2 роки тому

      Reimport into another project, see if that helps

    • @jafizz6505
      @jafizz6505 7 місяців тому

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

    • @jafizz6505
      @jafizz6505 7 місяців тому

      @@bananastutorialsnvm thanks

  • @hussainabidi1043
    @hussainabidi1043 2 роки тому +2

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

  • @AnimationNation345
    @AnimationNation345 2 місяці тому

    i have the error "Assets\RoomManager.cs(30,1): error CS1022: Type or namespace definition, or end-of-file expected"

  • @fouresh
    @fouresh Рік тому +1

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

    • @mistersquido
      @mistersquido 9 місяців тому

      same i dont know how to fix it

  • @grayr6s
    @grayr6s Рік тому +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 9 місяців тому

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

  • @G7z1Official
    @G7z1Official 8 днів тому

    13:21 but what if i'm not using rigid body?

  • @Xpl13r
    @Xpl13r 5 місяців тому +8

    can i use my own movment script?

  • @Koolfionn
    @Koolfionn 7 місяців тому +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  7 місяців тому

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

  • @LukaUxurgunashvili
    @LukaUxurgunashvili 4 місяці тому +1

    Very Helpful! The character controller was WAY too complicated tho!

  • @yepshu
    @yepshu Рік тому +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 9 місяців тому

      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

  • @richsombie
    @richsombie Рік тому +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  Рік тому +1

      Maybe wait a bit before pressing the join button

    • @byt3shift
      @byt3shift 6 місяців тому

      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();
      }

    • @Sh1vt
      @Sh1vt 2 місяці тому

      here just copy this
      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);
      }
      }

  • @declansupercool8291
    @declansupercool8291 3 місяці тому

    My movement is reversed when i press w i go back ward and s is forward same with a and d

  • @Olson_wrld
    @Olson_wrld 4 місяці тому +1

    can you add script copy and paste pls

  • @bogoid
    @bogoid 6 місяців тому

    jetbrains user... instant subscribe

  • @MuhammadHosny0
    @MuhammadHosny0 2 роки тому

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

  • @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

    • @C0r3_0
      @C0r3_0 4 місяці тому

      late response lol but u have to have it return something every time
      eg:
      return (velocityChange);

  • @lunark202
    @lunark202 7 місяців тому

    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 7 місяців тому +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);
      }
      }
      }
      }

  • @lime_68
    @lime_68 Рік тому +1

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

  • @quocbaovo7488
    @quocbaovo7488 5 місяців тому

    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 ???

  • @blushape
    @blushape Рік тому

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

  • @SzxVex
    @SzxVex Рік тому +1

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

    • @JSRCU13
      @JSRCU13 9 місяців тому

      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");
      }
      }

  • @Sh1vt
    @Sh1vt 2 місяці тому

    Hey having a problem with spawning
    "Can not Instantiate before the client joined/created a room. State: Joining" Idk what to do with it
    pls help

    • @Sh1vt
      @Sh1vt 2 місяці тому

      Hey deep down in the comments ive seen a lot of ppl have the same problem heres the solution
      thx man i forgor ur name but
      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);
      }
      }

    • @powercellgaming4956
      @powercellgaming4956 21 день тому

      well dont instantiate before joining/creating a room

  • @tboxfinn
    @tboxfinn Рік тому +1

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

  • @ThatsCraz3
    @ThatsCraz3 3 місяці тому

    i need help writing the Debug.Log( part because idk how you fade the message part :(

  • @TSAR_BOMBA_100
    @TSAR_BOMBA_100 Рік тому +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  Рік тому +1

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

    • @bananastutorials
      @bananastutorials  Рік тому +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 Рік тому +1

      Thanks, I missed that part.

  • @AaronAsherRandall
    @AaronAsherRandall 2 роки тому +4

    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 2 роки тому +5

      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  2 роки тому +1

      Awesome thanks for sharing!!

    • @ketsueki血液
      @ketsueki血液 Рік тому

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

    • @boogeygobler
      @boogeygobler Рік тому

      @@ketsueki血液 same

    • @PoggerFishW
      @PoggerFishW 6 місяців тому

      @@ketsueki血液 same

  • @chanceblevins3842
    @chanceblevins3842 11 місяців тому

    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?

  • @AaaaRndom
    @AaaaRndom Рік тому

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

    • @bananastutorials
      @bananastutorials  Рік тому

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

  • @NightGuardBaylan
    @NightGuardBaylan 8 місяців тому

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

  • @OmarEssam0
    @OmarEssam0 8 місяців тому

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

    • @statix_n
      @statix_n 4 місяці тому

      did you find a solution, I got the same

  • @kvzmo2x
    @kvzmo2x 5 місяців тому

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

  • @fraiva22
    @fraiva22 Рік тому

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

    • @JoskeVR
      @JoskeVR 9 місяців тому

      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

  • @ketsueki血液
    @ketsueki血液 Рік тому

    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 10 місяців тому

      i have a same problem

  • @poring1026
    @poring1026 8 місяців тому

    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 8 місяців тому

      Rider program, or Rider Extension for Visual Studio

  • @zettrazetta5310
    @zettrazetta5310 Рік тому +1

    From where can i find the mouse look script ?

    • @bananastutorials
      @bananastutorials  Рік тому +1

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

  • @Fatty_Chicken
    @Fatty_Chicken 6 місяців тому

    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

    • @Fatty_Chicken
      @Fatty_Chicken 6 місяців тому +1

      Nevermind I opened it wrong

  • @itsgabeplays
    @itsgabeplays 10 місяців тому

    how do you get it to autofill photon commands?

  • @bigdogediting
    @bigdogediting 3 дні тому

    i have an error,
    Assets/Scripts/Movement.cs(18,10): error CS0111: Type 'Movement' already defines a member called 'Update' with the same parameter types
    Assets/Scripts/Movement.cs(12,10): error CS0111: Type 'Movement' already defines a member called 'Start' with the same parameter types
    Assets/Scripts/Movement.cs(3,14): error CS0101: The namespace '' already contains a definition for 'Movement'
    Not sure how to fix it :/

    • @bigdogediting
      @bigdogediting 3 дні тому

      just having the script exist with nothing in it makes the same error, i'm so confused

    • @bigdogediting
      @bigdogediting 3 дні тому

      nevermind, changed literally nothing and moved it to a new project and it works now sob

  • @Isthat_Will
    @Isthat_Will 5 місяців тому

    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?

    • @statix_n
      @statix_n 4 місяці тому

      did you found a solution, I got the same problem

  • @Darunn-l3h
    @Darunn-l3h 4 місяці тому

    I love you!

  • @WinstonAnthony777
    @WinstonAnthony777 10 місяців тому +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

    • @o2_vr1
      @o2_vr1 10 місяців тому

      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!)

  • @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  Рік тому

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

  • @Neo_lol
    @Neo_lol Рік тому

    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)

    • @mrmirchiTheCodGuy
      @mrmirchiTheCodGuy Рік тому

      Same

    • @byt3shift
      @byt3shift 6 місяців тому

      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();
      }

  • @itsgabeplays
    @itsgabeplays 10 місяців тому

    How do you autofill Photon Commands?

  • @MR.OOFofficial
    @MR.OOFofficial 4 місяці тому

    instead of fps can i use this for cars?

  • @rameezsafdar6563
    @rameezsafdar6563 7 місяців тому

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

  • @JoyousJS
    @JoyousJS 3 місяці тому

    im having issues with GetAxisRaw,, it says its invalid

    • @JoyousJS
      @JoyousJS 3 місяці тому

      and its the same with ForceMode

  • @faded87
    @faded87 Рік тому +1

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

  • @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 9 місяців тому

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

  • @Not_a.H4CK3R
    @Not_a.H4CK3R Рік тому +1

    can you post all scripts in the comments?

  • @lixq7r
    @lixq7r 2 роки тому +2

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

    • @bananastutorials
      @bananastutorials  2 роки тому +1

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

    • @bananastutorials
      @bananastutorials  2 роки тому +1

      that’s where it’s from best of luck

    • @lixq7r
      @lixq7r 2 роки тому

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

    • @dominiclashombo
      @dominiclashombo 2 роки тому +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 2 роки тому +1

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

  • @Ocer.
    @Ocer. Рік тому

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

  • @Carmello_1
    @Carmello_1 5 місяців тому

    Is it still for 2024

  • @AbdulWahabXVI
    @AbdulWahabXVI 4 місяці тому

    is it whole copyrighted, or i can use it in my game freely??

  • @cashenuts
    @cashenuts 2 роки тому +2

    yooo good as alway

  • @deflandon2931
    @deflandon2931 Рік тому

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

    • @bananastutorials
      @bananastutorials  Рік тому

      Maybe you have a negative sign somewhere in your movement script

  • @zenpresentt
    @zenpresentt Рік тому

    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

  • @obinnajames
    @obinnajames Рік тому

    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 Рік тому

      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.

  • @SHADOW11SAMURAI
    @SHADOW11SAMURAI 6 місяців тому

    Is it compatible with webgl build?

  • @playman047
    @playman047 5 місяців тому

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

  • @Bricky_cK
    @Bricky_cK Рік тому

    does someone have the movement script?

  • @playman047
    @playman047 5 місяців тому

    make more unity tutorials

  • @kenneth2hip
    @kenneth2hip 6 місяців тому

    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?

  • @minima_studios
    @minima_studios Рік тому

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

  • @HT-lp9kz
    @HT-lp9kz 9 місяців тому

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

  • @diegopoveda4762
    @diegopoveda4762 Рік тому +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 Рік тому +11

      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 Рік тому

      @@tegbx3619 Thank i love you

    • @Not_a.H4CK3R
      @Not_a.H4CK3R Рік тому

      thank i had the same error
      @@tegbx3619

    • @ultratramp_drfg
      @ultratramp_drfg 11 місяців тому

      @@tegbx3619 you are the real hero in my heart

    • @hexag0n777
      @hexag0n777 10 місяців тому

      @@tegbx3619 thx so much bro

  • @PFL_Tired
    @PFL_Tired 9 місяців тому

    Movement not working

  • @gummyow3059
    @gummyow3059 2 роки тому +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 роки тому +2

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

    • @atharvasarfare5340
      @atharvasarfare5340 Рік тому

      @@bananastutorials I did it but its not working

  • @GriffinMurdoch
    @GriffinMurdoch 10 місяців тому

    cool video)

  • @hawk2691
    @hawk2691 Рік тому

    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❤❤❤❤❤😮

  • @OmarEssam0
    @OmarEssam0 8 місяців тому

    hi, I need Source Code PLZ

  • @dcProGT
    @dcProGT 7 місяців тому

    Could you share the script for the Room Manager?

    • @Comprobrain
      @Comprobrain 5 місяців тому

      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

  • @TheRadioactiveEngineer
    @TheRadioactiveEngineer Рік тому

    How about photon fusion?

    • @bananastutorials
      @bananastutorials  Рік тому

      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

  • @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  Рік тому

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

    • @LandoCali5
      @LandoCali5 28 днів тому

      same thing happened to me. it happened because i added mouselook to the Capsule rather than the Main Camera

    • @superbenjamin63
      @superbenjamin63 24 дні тому

      @@LandoCali5 Same!

  • @Exxkap
    @Exxkap 11 місяців тому

    Can you use just any movement script?

    • @JoskeVR
      @JoskeVR 9 місяців тому +1

      yes

    • @Exxkap
      @Exxkap 9 місяців тому

      @@JoskeVR yeah figur3d that out 2 months ago

  • @NyctoHiding
    @NyctoHiding Рік тому

    How do you get the scripting part?

  • @NightGuardBaylan
    @NightGuardBaylan 8 місяців тому

    Could you put the movement in the Comments Im Having Trouble

  • @liban24-q8s
    @liban24-q8s Рік тому

    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 9 місяців тому

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

  • @Iridium.
    @Iridium. 2 місяці тому

    All good but for a shooter to be viable it must be completely authoritative.

    • @bananastutorials
      @bananastutorials  2 місяці тому

      Not true, I have a game on steam with 750K downloads and i have game dev friends with similar client auth shooters like redmatch 2 and banana game.

    • @TutorialApes
      @TutorialApes 2 місяці тому

      @@bananastutorials Is there anyway you can help me with the movement script or just paste it in comments? Ive been trying and doing it the same way you did but im getting an error and I can't move.

  • @monkey199vr
    @monkey199vr 7 місяців тому

    pls tell me what software your useing

    • @Comprobrain
      @Comprobrain 5 місяців тому

      unity

    • @monkey199vr
      @monkey199vr 5 місяців тому

      @@Comprobrain i mean coding software

  • @richsombie
    @richsombie Рік тому

    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 Рік тому

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