A Unity-based shared AR experience that detects cups in real-time and shares their positions across multiple devices using ConjureKit.
- Real-time cup detection using ML Kit
- Cross-device position sharing via ConjureKit
- Smooth animations and visual effects
- Works on both iOS and Android
- Debug UI for monitoring system status
- Optimized for mobile performance
- Unity 2021.3 or newer
- ConjureKit account and credentials
- iOS 13+ or Android API Level 24+
- AR-capable device (ARKit for iOS, ARCore for Android)
-
Create Unity Project
- Create a new 3D Unity project
- Switch platform to iOS or Android
- Enable Version Control in Project Settings
-
Install Required Packages Add the following to your project's
manifest.json:{ "dependencies": { "com.google.mlkit.vision.objects": "0.6.0", "com.unity.nuget.newtonsoft-json": "3.0.2", "com.dbrizov.naughtyattributes": "2.1.4", "com.google.external-dependency-manager": "1.2.169", "com.unity.xr.arfoundation": "5.0.7", "com.unity.xr.arkit": "5.0.7", "com.unity.xr.arcore": "5.0.7" }, "scopedRegistries": [ { "name": "Google MLKit", "url": "https://registry.npmjs.org", "scopes": ["com.google"] } ] } -
Project Structure Create the following folder structure:
Assets/ ├── Materials/ ├── Prefabs/ ├── Scenes/ └── Scripts/
- Create a new scene named "MainScene"
- Add AR components:
- Create AR Session object
- Create AR Session Origin object
- Add AR Camera under Session Origin
- Add required AR managers:
- AR Plane Manager
- AR Raycast Manager
- AR Camera Manager
-
Create Cup Material:
- Create new material in Materials folder
- Name it "CupMaterial"
- Set shader to "Standard"
- Configure properties:
- Albedo: Semi-transparent blue (0, 0.5, 1, 0.6)
- Metallic: 0.5
- Smoothness: 0.8
- Rendering Mode: Transparent
-
Create Cup Prefab:
- Create empty GameObject "CupPrefab"
- Add cylinder as child
- Scale cylinder to cup shape (e.g., 0.1, 0.15, 0.1)
- Add Box Collider
- Add CupVisual script
- Apply CupMaterial
- Save as prefab in Prefabs folder
-
On AR Session Origin:
- Add CupDetectionManager component
- Configure references:
- AR Camera Manager
- AR Raycast Manager
- AR Camera
- Set detection settings:
- Detection Threshold: 0.5
- Detection Interval: 0.5
-
Add CupVisualizationManager:
- Assign Cup Prefab
- Set Cup Lifetime: 5.0
- Enable Show Debug UI
- Player Settings > iOS:
- Set Bundle Identifier
- Enable ARKit
- Add Camera Usage Description
- Set target iOS version (13+)
- Architecture: ARM64
- Player Settings > Android:
- Set Package Name
- Enable ARCore
- Min API Level: 24
- Target API Level: 33
- Scripting Backend: IL2CPP
- Add Camera Permission
-
Get ConjureKit credentials:
- Register at Auki Labs
- Obtain API Key and Secret
-
Update CupDetectionManager:
- Replace "YOUR_APP_KEY" with your API key
- Replace "YOUR_APP_SECRET" with your API secret
-
Starting the App
- Launch on AR-capable device
- Grant camera permissions when prompted
- Wait for AR plane detection (white dots will appear)
-
Detecting Cups
- Point camera at cups
- Hold device steady for best detection
- Detected cups will appear with visual effects
- Positions are automatically shared with other users
-
Debug Information
- Top-left shows active cups count
- Shows total detections
- Displays connection status
Common issues and solutions:
-
No Cup Detection
- Ensure good lighting
- Hold device steady
- Check debug UI for connection status
- Verify camera permissions
-
Poor Performance
- Reduce detection interval
- Close background apps
- Check device temperature
- Ensure device supports AR
-
Sharing Issues
- Verify internet connection
- Check ConjureKit credentials
- Confirm all users on same version
- Verify ConjureKit service status
-
Detection Settings
- Adjust detection interval based on device capability
- Modify confidence threshold for accuracy vs. speed
- Consider reducing visual effects on lower-end devices
-
Memory Management
- Stale cups are automatically removed after 5 seconds
- Texture memory is properly disposed
- Camera frames are processed efficiently
- Fork the repository
- Create feature branch
- Commit changes
- Push to branch
- Create Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Auki Labs for ConjureKit
- Google for ML Kit
- Unity for AR Foundation