Introduction to Unity Editor & C# Scripting
You should have completed the Editor Interface tutorial
Unity Tall Layout
Bearcat Wheel of Fate
Scene Setup
WheelSpin
using System;
using UnityEngine;
using UnityEngine.InputSystem;
public class WheelSpin : MonoBehaviour
{
private float _rotationSpeed = 0.0f;
// Start is called once before the first execution of Update
void Start()
{
_rotationSpeed = 0.0f;
}
// Update is called once per frame
void Update()
{
// Check if the space bar was pressed this frame
if (Keyboard.current.spaceKey.wasPressedThisFrame)
{
_rotationSpeed = new System.Random().Next(2000, 5000);
}
if (_rotationSpeed > 0)
{
float rotationAmount = _rotationSpeed * Time.deltaTime;
transform.Rotate(0, 0, rotationAmount);
// Decrease rotation speed over time
_rotationSpeed -= 500 * Time.deltaTime;
}
}
}
void Start()
- Called ONCE when GameObject becomes active - Initialization code goes here - Runs before first Update()
void Update()
- Called EVERY frame (30-120+ times/second!) - Game logic and input checking - Performance critical code
Bearcat Jackpot 🎉
You landed big! (good fortune)
Mill Stream Mishap 🦆
Oops, you slipped by the ducks (bad luck)
Star Trees Wish ⭐
Make a lucky wish under the trees
Waller Hall Haunt 👻
Unlucky… you met a campus ghost
Kaneko Lucky Break 🍕
You found free snacks in the lounge
Goudy Gamble 🍽️
Mystery food choice, will it be lucky or not?