Posts

Showing posts from February, 2025

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