Recommended Protections for Unity
Shield provides specialized protection for Unity games, automatically adapting to both Mono and IL2CPP compilation modes.
Core Protections
These protections are essential for Unity games and have minimal performance impact:
{
"protections": {
"rename": {
"rename_public": false,
"rename_arguments": true
},
"constants_encryption": {},
"constants_mutation": {}
}
}
Shield automatically handles Unity compatibility for these protections, ensuring they don't interfere with the Unity engine or your game's functionality.
Advanced Protections
These protections can be added based on your specific needs:
{
"protections": {
"control_flow_advance": {
"intensity": 6
},
"virtualization": {}
}
}
When using these advanced protections:
- Apply Control Flow only to critical game logic methods
- Test Virtualization thoroughly with IL2CPP compilation
- Monitor performance impact, especially on mobile devices
Protection Strategy by Game Component
Game Logic
Protect your core game mechanics and business logic:
- Use Constants Encryption for sensitive values
- Apply Control Flow to critical algorithms
- Use Virtualization for important game systems
Monetization Systems
Secure your payment and premium content systems:
- Constants Encryption for purchase validation
- Control Flow for payment processing
- Memory protection for virtual currency
Anti-Cheat Systems
Implement robust anti-cheat measures:
- Memory protection
- Runtime integrity checks
- State validation
Performance Impact
Each protection has different performance implications:
Protection | Impact | Notes |
---|---|---|
Renamer | None | No runtime overhead |
Constants Encryption | Minimal | Small overhead on string decryption |
Constants Mutation | Minimal | Small overhead on value access |
Control Flow | Variable | Apply selectively to critical methods |
Virtualization | Moderate | Test thoroughly with IL2CPP |
Best Practices
- Start with core protections and add advanced ones gradually
- Test thoroughly on all target platforms
- Monitor performance impact, especially frame rate
- Use selective protection for performance-critical code
- Verify compatibility with your Unity version and compilation mode
Shield automatically adapts its protections to work with Unity's environment. No special configuration is needed - Shield detects the Unity context and applies appropriate protections.
For known limitations, see Known Limitations.