Appearance
Unity
Popular cross-platform game engine.
Overview
Unity is a cross-platform game engine developed by Unity Technologies, widely used for creating 2D, 3D, VR, and AR games.
Features
- Cross-platform development
- C# scripting
- Visual scripting with Bolt
- Asset Store
- Physics engine
- Rendering pipeline
Getting Started
csharp
// Create new 3D project in Unity
// Create C# script
// PlayerController.cs
using UnityEngine;
public class PlayerController : MonoBehaviour
{
public float moveSpeed = 5f;
public float rotateSpeed = 100f;
private Rigidbody rb;
void Start()
{
rb = GetComponent<Rigidbody>();
}
void Update()
{
// Rotation
float horizontalInput = Input.GetAxis("Horizontal");
transform.Rotate(Vector3.up, horizontalInput * rotateSpeed * Time.deltaTime);
// Movement
float verticalInput = Input.GetAxis("Vertical");
Vector3 movement = transform.forward * verticalInput * moveSpeed * Time.deltaTime;
rb.MovePosition(transform.position + movement);
}
}Basic Example
csharp
// GameManager.cs
using UnityEngine;
using UnityEngine.UI;
public class GameManager : MonoBehaviour
{
public Text scoreText;
private int score = 0;
public void AddScore(int points)
{
score += points;
UpdateScoreText();
}
private void UpdateScoreText()
{
scoreText.text = "Score: " + score.ToString();
}
void Start()
{
UpdateScoreText();
}
}PAPER-CODE Integration
PAPER-CODE provides:
- Unity project templates
- Script patterns
- Component structures
- Build configurations