Posts

Bug Fixing and Game Over

Game Over Logic (GameManager.cs): Added a CheckGameOver() method that listens for player-death events and displays the endgame UI when one team is eliminated. Team Assignment Storage (ChooseTeam.cs): Introduced AssignTeamToGameManager(int teamId) to pass the local player’s team selection into GameManager for later game-over evaluation. Gun Pickup Mechanic (GunPickup.cs): Created an OnTriggerEnter(Collider other) handler that detects the player collider, shows a “Press E to Pickup” GUI label, and assigns the weapon prefab to the player. Health Notification (Health.cs): Implemented health tracking with a currentHealth field; when it reaches zero, the script calls GameManager.Instance.PlayerDied(playerId) . Mouse-Look Ownership Fix (MouseLook.cs): Wrapped all Input.GetAxis calls inside if(photonView.IsMine) so only the local player’s camera responds to mouse movement. Spawn Script Separation (SpawnIn.cs): Extracted the waiting-room spawn logic into its own SpawnIn.cs , instan...

Animations and Weapons

Placeholder Animations Setup: Assigned a placeholder character prefab and created blend-tree animations driven by BlendV (forward/back) and BlendH (strafe) parameters in Movement.cs , ensuring smooth directional movement. Animation Rigging Integration: Imported Unity’s Animation Rigging package; in  ChangeWeapons.cs , configured TwoBoneIKConstraint components ( leftHand , rightHand ) and updated their targets when swapping weapons, so hands correctly grip each gun . Weapon Change Script: Developed ChangeWeapons.cs to manage an array of weapon GameObjects and corresponding IK targets. Players can cycle weapons with right-click or scroll wheel; on switch, the script deactivates all weapons, activates the selected one, reassigns IK targets, then calls rig.Build() to rebuild the rig . Multiplayer Animation Sync: Leveraged Photon PUN RPCs to broadcast weapon-change events and IK adjustments so all clients update animations and hand poses in real time. // Movement.cs – blend-tre...

1st Stage Completion

Seamless Authentication: Updated LoginManager.cs so that Unity Services initialize before loading saved credentials, guaranteeing autofill and error-free signup/login flows. Improved Spawn Mechanics: Refined GameplaySpawnManager.cs to deterministically assign spawn points based on team and actor order, ensuring consistent player placement every match. Live Model Selection: Leveraged ChangeModels.cs and PlayerModelManager.cs to let players toggle character models at runtime RPC calls propagate changes to all clients in real time. Persistent Team & Model Data: Extended GameManager.cs to store team IDs and clothing masks in Photon CustomProperties, so selections survive across scenes and reconnects. Random Level Selection on Ready: In Ready.cs , once every player’s “Ready” flag is set, the master client picks one of three levels at random and uses PhotonNetwork.LoadLevel(...) to transport everyone simultaneously. Cross-Scene State Preservation: Used DontDestroyOnLoad on i...

Fixes and Account Removal

Objectives: Set up scene navigation, improve account lifecycle flows, and fix initial authentication bugs. Centralized Scene Management: Created LoadLevel.cs to consolidate all scene transitions (ServerSelect, LoginScreen, MainMenu, Lobby, GameLevel1). Account Removal Flow: Added RemoveAccount.cs under the Main Menu UI. On user confirmation, it calls AuthenticationService.DeleteAccountAsync() and then invokes LoadLevel.LoadLoginScreen() Bug Fixes & Refinements: Updated scene manager calls, integrated the account-deletion API, and squashed initial login/signup issues (auto-fill, post-signup flow). Lobby Integration: Enhanced LobbyManager.cs with a dropdown allowing players to select which lobby (room) to join directly from the main menu. // LoadLevel.cs using Photon.Pun; public static class LoadLevel { public static void LoadServerSelect() => PhotonNetwork.LoadLevel(0); public static void LoadLoginScreen() => PhotonNetwork.LoadLevel(1); public static voi...

Login Implementation

Image
Added Login Screen Login Scene Addition: Added a new LoginScene with a UI composed of TMP_InputField s for username/password, a Toggle for “Remember Me,” a Button for login, a Button for signup and a Button for sign-out (ImageAbove).  Cloud Save Integration: Imported the Unity Cloud Save package and initialized Unity Services in LoginManager.cs to support user authentication and persistent data storage. Authentication Flow: In LoginManager.cs , implemented SignupButtonPressed() , LoginButtonPressed() and SignOut() methods using Unity.Services.Authentication for sign-up/sign-in and Unity.Services.CloudSave to store the player’s username on first login. Session Persistence: Used PlayerPrefs to store credentials when “Remember Me” is toggled, and reload them on startup in LoadSavedCredentials() . Scene Transition: After successful login, deferred by 2 s, the script calls PhotonNetwork.LoadLevel(2) to move into the Main Menu (Game scene index 2) // Key portions of Lo...

Basic Implementation

Image
Introduction to the game implementation  1.  Unity Project Creation: Implemented a Unity project named [Game Name] . 2. Scene Structure: Built three core scenes:- Region Select , Main Menu and Game  to separate server choice, UI navigation and gameplay. Networking Integration: Integrated Photon PUN 2 for real-time multiplayer, allowing users to connect across global regions. Region-Select Logic: In SelectServer.cs , added a TMP_Dropdown and Join button so players can choose “Best Server” (auto) or explicit regions (“asia”, “au”, “eu”, “hk”, “in”, “jp”, “us”). 3. Connection Flow: Clicking Join calls PhotonNetwork.ConnectUsingSettings() if no region is selected or PhotonNetwork.ConnectToRegion(selectedRegion) otherwise.  On successful connection, OnConnectedToMaster() logs the region and use  PhotonNetwork.LoadLevel(1) to load the Main Menu (avoiding SceneManager issues). using Photon.Pun; using Photon.Realtime; using UnityEngine; using TMPro; using ...