Skip to content

Tejas2305/Unity_scene

Repository files navigation

Challas Aath - Unity Scene Setup

This Unity project recreates the React-based UI flow for the Challas Aath game lobby in the Varasa heritage app.

๐Ÿ“‹ Project Structure

Assets/
โ”œโ”€โ”€ Scenes/
โ”‚   โ””โ”€โ”€ ChallasAath.unity          # Main scene file
โ”œโ”€โ”€ Scripts/
โ”‚   โ””โ”€โ”€ GameManager.cs             # Core game state management
โ”œโ”€โ”€ Textures/
โ”‚   โ”œโ”€โ”€ back_arrow.png             # Back button icon
โ”‚   โ”œโ”€โ”€ gear.png                   # Settings icon
โ”‚   โ”œโ”€โ”€ user_avatar.png            # Player avatar icon
โ”‚   โ”œโ”€โ”€ divider.png                # Decorative divider line
โ”‚   โ””โ”€โ”€ question.png               # Waiting player indicator
โ””โ”€โ”€ Prefabs/                       # (To be created in Unity Editor)

๐ŸŽฎ Unity Version

This project is designed for Unity 6000.1.14f1 (Unity 6 LTS).

๐Ÿš€ Setup Instructions

Step 1: Open the Project

  1. Open Unity Hub
  2. Click "Open" and select this folder (Unity_scene)
  3. Unity will import all assets

Step 2: Install TextMeshPro

  1. When Unity opens, it may prompt you to import TMP Essentials
  2. Click "Import TMP Essentials" in the prompt window
  3. Or go to: Window โ†’ TextMeshPro โ†’ Import TMP Essential Resources

Step 3: Create the UI in the Scene

The scene requires manual setup in the Unity Editor because the UI is complex. Follow these steps:

A. Open the Scene

  1. In the Project window, navigate to Assets/Scenes/
  2. Double-click ChallasAath.unity

B. Create the Canvas

  1. Right-click in Hierarchy โ†’ UI โ†’ Canvas
  2. Set Canvas properties:
    • Render Mode: Screen Space - Overlay
    • Canvas Scaler:
      • UI Scale Mode: Scale With Screen Size
      • Reference Resolution: 1080 x 1920 (portrait mobile)
      • Match: 0.5

C. Create the Game Manager Object

  1. Find the "GameManager" object in the Hierarchy (should already exist)
  2. If not, create one: Right-click Hierarchy โ†’ Create Empty โ†’ name it "GameManager"
  3. Add the GameManager component:
    • Select GameManager object
    • In Inspector, click "Add Component"
    • Search for "GameManager" and add it

D. Create the UI Panels

Follow this structure exactly:

Canvas
โ”œโ”€โ”€ Header (Panel)
โ”‚   โ”œโ”€โ”€ TitleText (TextMeshPro - Text): "VARASA"
โ”‚   โ””โ”€โ”€ GearButton (Button with gear.png)
โ”‚
โ”œโ”€โ”€ LobbyPanel (Panel)
โ”‚   โ”œโ”€โ”€ GameTitle (TextMeshPro): "CHALLS AATH"
โ”‚   โ”œโ”€โ”€ PlayFriendsButton (Button): "PLAY WITH FRIENDS"
โ”‚   โ”œโ”€โ”€ PlayRandomButton (Button): "PLAY WITH RANDOM PEOPLE"
โ”‚   โ”œโ”€โ”€ Divider (Image + Text "OR")
โ”‚   โ””โ”€โ”€ Subtitle (TextMeshPro): "Re-discover the ancient strategy game."
โ”‚
โ”œโ”€โ”€ FriendsMenuPanel (Panel - initially disabled)
โ”‚   โ”œโ”€โ”€ BackButton (Button with back_arrow.png)
โ”‚   โ”œโ”€โ”€ Title (TextMeshPro): "START A CHALLENGE"
โ”‚   โ”œโ”€โ”€ CreateRoomButton (Button): "CREATE PRIVATE ROOM"
โ”‚   โ”œโ”€โ”€ DividerOR (Text in circle)
โ”‚   โ”œโ”€โ”€ JoinRoomButton (Button): "JOIN PRIVATE ROOM"
โ”‚   โ””โ”€โ”€ JoinRoomPanel (Panel - initially disabled)
โ”‚       โ”œโ”€โ”€ Label (TextMeshPro): "Enter 6-Digit Room ID"
โ”‚       โ”œโ”€โ”€ RoomIdInput (TMP_InputField)
โ”‚       โ””โ”€โ”€ GoButton (Button): "GO"
โ”‚
โ””โ”€โ”€ RoomWaitingPanel (Panel - initially disabled)
    โ”œโ”€โ”€ BackButton (Button)
    โ”œโ”€โ”€ Title (TextMeshPro): "ROOM CREATED"
    โ”œโ”€โ”€ RoomCodePanel (Panel)
    โ”‚   โ”œโ”€โ”€ RoomIDLabel (TextMeshPro): "Room ID"
    โ”‚   โ””โ”€โ”€ RoomCodeText (TextMeshPro): Large display
    โ”œโ”€โ”€ PlayersJoinedText (TextMeshPro): "X/2 PLAYERS JOINED"
    โ”œโ”€โ”€ AvatarRow (Panel)
    โ”‚   โ”œโ”€โ”€ Player1Avatar (Image circle)
    โ”‚   โ”‚   โ”œโ”€โ”€ Player1Icon (user_avatar.png)
    โ”‚   โ”‚   โ””โ”€โ”€ Background (Image - green when ready)
    โ”‚   โ””โ”€โ”€ Player2Avatar (Image circle)
    โ”‚       โ”œโ”€โ”€ Player2Icon (user_avatar.png)
    โ”‚       โ”œโ”€โ”€ Player2Question (question.png)
    โ”‚       โ””โ”€โ”€ Background (Image - gray when waiting)
    โ”œโ”€โ”€ StatusText (TextMeshPro): Status message
    โ””โ”€โ”€ StartGameButton (Button): "START GAME"

๐ŸŽจ Color Palette (Heritage Theme)

Use these colors for UI elements:

  • Background: #FDF5E6 (253, 245, 230) - Warm beige
  • Primary (Buttons): #7B1113 (123, 17, 19) - Deep red
  • Secondary (Accents): #FFC300 (255, 195, 0) - Amber
  • Text Primary: #7B1113 (Deep red)
  • Text Secondary: #FFFBF0 (255, 251, 240) - Cream

๐Ÿ”— Wiring the GameManager

After creating all UI elements:

  1. Select the GameManager object in Hierarchy
  2. In Inspector, you'll see empty references in the GameManager component
  3. Drag and drop the corresponding UI elements from the Hierarchy:
    • Panels Section: Drag LobbyPanel, FriendsMenuPanel, RoomWaitingPanel, JoinRoomPanel
    • Lobby UI Section: Drag playFriendsButton, playRandomButton
    • Friends Menu UI Section: Drag createRoomButton, joinRoomButton, backFromFriendsButton
    • Join Room UI Section: Drag roomIdInput, goButton
    • Room Waiting UI Section: Drag all room waiting components

๐Ÿ“ Detailed UI Layout Instructions

LobbyPanel Styling

  • GameTitle:

    • Font Size: 72
    • Color: Deep Red (#7B1113)
    • Font: Bold, Serif style
    • Alignment: Center
  • Buttons (PlayFriendsButton, PlayRandomButton):

    • Width: Full width (with 40px margins)
    • Height: 120px
    • Font Size: 48
    • Color: Deep Red background, Cream text
    • Border Radius: 24px (use Unity UI Rounded Corners or Image with rounded sprite)
    • Margin: 24px between buttons

FriendsMenuPanel Styling

  • CreateRoomButton:

    • Background: Amber (#FFC300)
    • Text Color: Deep Red
  • JoinRoomButton:

    • Background: Deep Red
    • Text Color: Cream
  • JoinRoomPanel:

    • Background: Light amber/beige
    • Border: 2px Deep Red
    • Padding: 32px
    • Border Radius: 24px
  • RoomIdInput:

    • Font: Monospace style
    • Font Size: 60
    • Max Length: 6
    • Uppercase only
    • Center aligned
    • Border: 2px Red

RoomWaitingPanel Styling

  • RoomCodePanel:

    • Background: Light amber (#FFF5E1)
    • Border: 4px Amber
    • Border Radius: 48px
    • Padding: 60px
  • RoomCodeText:

    • Font Size: 120
    • Font: Monospace, Bold
    • Color: Deep Red
    • Letter Spacing: Wide
  • Player Avatars:

    • Size: 128x128 circle
    • Ready state: Green background (#228B22)
    • Waiting state: Gray background (#C0C0C0)

๐ŸŽฏ Game Flow

  1. Scene 1 - Lobby:

    • User sees "PLAY WITH FRIENDS" and "PLAY WITH RANDOM PEOPLE"
  2. Scene 2A - Play with Friends:

    • Options: "CREATE PRIVATE ROOM" or "JOIN PRIVATE ROOM"
    • If "Join": Shows input field for 6-character room code
  3. Scene 2B - Play Random:

    • Simulates quick match (1.5s delay)
    • Generates random room code
  4. Scene 3 - Room Waiting:

    • Displays room code
    • Shows player count (1/2)
    • Simulates 2nd player joining after 3 seconds
    • "START GAME" button enabled when both players joined

๐Ÿ”ง Troubleshooting

TextMeshPro errors

  • Make sure TMP Essentials are imported
  • Window โ†’ TextMeshPro โ†’ Import TMP Essential Resources

Missing references in GameManager

  • Ensure all UI elements are created and named correctly
  • Drag each element to its corresponding slot in GameManager Inspector

Buttons not working

  • Check that GameManager script is attached to GameManager object
  • Verify all button references are assigned in Inspector
  • Make sure panels are children of Canvas

Scene looks different on different devices

  • Adjust Canvas Scaler settings
  • Use Anchors properly for responsive design
  • Test on different aspect ratios in Game view

๐Ÿ“ฑ Mobile Testing

To test mobile aspect ratio:

  1. In Game view, change aspect ratio to 9:16 or 9:19.5
  2. Or set Free Aspect and manually resize

๐ŸŽฎ Running the Scene

  1. Press Play button in Unity Editor
  2. You should see the Lobby panel
  3. Test the flow:
    • Click "Play with Friends" โ†’ Should show Friends Menu
    • Click "Create Private Room" โ†’ Should show Room Waiting with random code
    • Click Back โ†’ Returns to Lobby
    • Click "Play with Random" โ†’ Simulates quick match
    • In Room Waiting โ†’ Wait 3 seconds โ†’ Second player joins โ†’ Start Game enabled

๐Ÿ“ Additional Notes

  • The GameManager handles all state transitions
  • Room codes are 6 random uppercase alphanumeric characters
  • The UI is designed for mobile portrait orientation
  • Colors and spacing match the heritage theme of the Varasa app
  • All textures are included in the Assets/Textures folder

๐ŸŽจ Customization

To customize the look:

  1. Replace textures in Assets/Textures/ with your own icons
  2. Modify colors in the Unity Inspector for each UI element
  3. Adjust fonts by importing custom fonts and assigning to TextMeshPro components
  4. Modify button sizes and spacing in RectTransform properties

๐Ÿš€ Next Steps

After completing the UI setup:

  1. Implement networking for real multiplayer (e.g., Photon, Mirror, or Unity Netcode)
  2. Connect to actual game scene when "START GAME" is clicked
  3. Add sound effects and animations for better UX
  4. Implement proper back-end for room management
  5. Add more heritage-themed visual effects and transitions

Need Help?

  • Check Unity's TextMeshPro documentation
  • Review Unity UI/Canvas system tutorials
  • See the GameManager.cs script for logic reference

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages