AR Waste Sorting Game is a Unity-based Augmented Reality (AR) project designed to demonstrate interactive AR object placement and a simple garbage sorting game. The project leverages Unity's AR Foundation to support both ARCore (Android) and ARKit (iOS) platforms.
- AR Object Placement:
- Tap on detected surfaces to place virtual objects in the real world using AR Foundation.
- Anchoring support to keep objects fixed in the environment.
- Garbage Sorting Game:
- Drag and drop various garbage items (organic, recyclable, electronic) into the correct bins.
- Score system rewards correct sorting.
- Interactive UI:
- Real-time score display.
- Cross-Platform AR:
- Supports both ARCore and ARKit via AR Foundation.
- Editor Utilities:
- Tools for finding missing references and managing graphics APIs for Android builds.
Assets/- Scripts:
ARTapToPlaceObject.cs,TouchToPlace.cs,AnchorSpawner.cs: Handle AR object placement and anchoring.DragAndDrop.cs: Enables dragging objects in AR.GarbageItem.cs,Bin.cs,ScoreManager.cs: Implement the garbage sorting game logic and scoring.MissingReferenceFinder.cs: Utility to find missing references in the scene.GraphicsApiChecker.cs,ForceGraphicsAPI.cs: Ensure correct graphics API settings for Android.
- Prefabs:
- Garbage items (e.g., AppleCore, battery, newspaper trash, etc.) and bins.
ARPlane.prefab: Used for AR plane visualization.
- Scenes:
ARminimal.unity: Main AR scene.SampleScene.unity: Example or test scene.
- Scripts:
- Unity Version:
- Use Unity 2021.3 LTS or newer (recommended for AR Foundation 5.x compatibility).
- Packages:
- Core AR packages (from
Packages/manifest.json):com.unity.xr.arfoundationcom.unity.xr.arcorecom.unity.xr.arkitcom.unity.xr.management
- UI, TextMeshPro, and other standard Unity modules.
- Core AR packages (from
- Platform Requirements:
- Android (ARCore) or iOS (ARKit) device.
- Editor play mode supports device simulation via Device Simulator.
- Build Settings:
- Set the build platform to Android or iOS as appropriate.
- For Android, Vulkan is automatically removed as a graphics API for compatibility.
- Open the project in Unity.
- Open the
ARminimal.unityscene. - Connect a supported AR device or use the Device Simulator for testing.
- Build and run on your device.
- Tap on surfaces to place objects, drag garbage items to bins, and watch your score update in real time.
- ARTapToPlaceObject.cs: Tap to place a prefab on detected AR planes.
- TouchToPlace.cs & AnchorSpawner.cs: Tap to place anchored objects at detected surfaces.
- DragAndDrop.cs: Drag objects in AR using touch input.
- GarbageItem.cs & Bin.cs: Define garbage types and bin logic for sorting.
- ScoreManager.cs: Singleton pattern for score tracking and UI updates.
- MissingReferenceFinder.cs: Editor utility to find missing references in the scene.
- GraphicsApiChecker.cs & ForceGraphicsAPI.cs: Ensure correct graphics API for Android builds.
This project is for educational and demonstration purposes. Please check individual asset licenses if you plan to use or distribute this project.
Created with Unity AR Foundation. For more information, see the Unity AR Foundation documentation.