170 likes | 217 Vues
Unity Game Development. Unity2D & Advanced Unity features. Class overview. Class 14 Revision Unity2D Spritesheets 2D Movement using Rigidbody2D Animating Sprites 2D Triggers & Collisions 2D Enemy AI Advanced: Extra Features Profiler Performance Optimization Unity Services
E N D
Unity Game Development Unity2D & Advanced Unity features
Class overview • Class 14 Revision • Unity2D • Spritesheets • 2D Movement using Rigidbody2D • Animating Sprites • 2D Triggers & Collisions • 2D Enemy AI • Advanced: Extra Features • Profiler • Performance Optimization • Unity Services • Entity Component System (ECS)
Revision • UNet Mirror • Multiplayer Cameras • NetworkAnimator • [Command] • [ClientRpc] • SyncVar
Unity2D • Unity2D = Intended for 2D games, different features & functionality. • Several components have a 2D version such as: Rigidbody2D, BoxCollider2D, …
Spritesheets • A sprite sheet is a bitmap image file that contains several smaller graphics in a tiled grid arrangement. • Allows applications to use the graphics while only needing to load a single file.
2D Movement using Rigidbody2D • CharacterController is not available in Unity2D, use Rigidbody2D instead. • Calculating movement using input is similar, now using Vector2
Animating Sprites • Name Sprites using Spritesheet Editor • Setup Animator Controller for Player Sprite • Open Animation window and setup Sprites in order
2D Triggers & Collisions • Setup BoxCollider2D around character • Mark as Trigger • Activate during Attack using View Direction • Deactivate after Attack
2D Enemy AI • NavMesh and NavMeshAgent are unavailable in Unity2D • For pathfinding a custom implementation is required (A* pathfinding?) • Movement similar to player Determine Attack Direction & Move Rigidbody2D • On impact change direction
Advanced: Extra Features • Add UI to display player Health • Implement PlayerDeath and PlayerVictory conditions • Implement Audio effects • Setup Sprite Animations • Add Level restart functionality • Controller & Keyboard support
Profiler • Profiler allows you to monitor the performance of your Unity project. • Including CPU Usage, Rendering (with Frame Debug) and Memory.
Performance Optimization • Determine Performance issues using Profiler • Use Static Batching when possible • Reduce & Reuse Textures • Use Culling to reduce Rendered Objects • Optimize objects using LOD • Compress all assets if possible (e.g. lower resolution, lower samplerate, …) • Optimize Physics calculations using LayerMasks • Use simple colliders and don’t overuse Rigidbodies • Cache data instead of re-calculating same results
Unity Services • Use Unity Services to: • Implement Ads • Analyze data • Build in the cloud • Collaborate • Setup in-app purchases • Setup Multiplayer settings
Entity Component System (ECS) • ECS & Job System is a new way of programming massive performance gains
Q&A • Do you have any questions related to the topics mentioned?