Copyright (c) 2020 Me First LLC
Input is an essential part of your game.
📌 Unity just made the Input System a verified package.
📌 The Legacy Input system has always been a pain. With a convoluted setup, developers could find themselves copying input code everywhere when their design wasn't well planned.
📌 Players can now define a series of input actions inside an ActionMap. Individual ActionMaps may be used to control the player, a vehicle, or specialized UI views.
📌 Individual Actions may be mapped to specific input bindings from different devices. This abstracts away the details of what the input binding is firing. Now your game can just check the actions.
📌 Schemes represent different control setups. This is good for device types, like Keyboard&Mouse vs Gamepad.
📌 Your Input settings can easily be exported into an auto-generated C# file. This gives you access to the polling or subscribing to the actions for any given ActionMap.
⭐️ The addition of the Input System was long overdue. The ease of use and modular design of the new system allows you to focus on what really matters, your game.
Meet STU 😈
✅ Potential Game Name: STU - Adventure of Bit
💻 Hi everyone! This is a fantastic clip of the new game I'm working on. Currently in the experimental design and pre-alpha stages. I'm targeting a short story-driven game with unique characters in the digital world.
STU stands for
* Self Aware
* Turing Complete
* Universal Program
🎮 STU is the first truly self-aware artificial intelligence every created. Vast and comprehension, STU's system extend multiple machines across the web. Currently, in conflict with humans, STU creates Bit to assist with the humans.
😈 STU may come off rude and condescending, but STU does not do so intentionally. STU views Bit and humans as inferior, similar to how humans may view a colony of ants. The fact they work together and create amazing colonies is impressive, but when push comes to shove, they can only affect us as a pest.
Unity and other modern game engines offer built-in physics support. Unity specifically, empowers you with colliders and rigidbodies. These simulate physics but also give you the ability to manipulate and apply your own forces.
📌 Rigidbody.AddForce applies a force to any dynamic rigidbody.
📌 The ForceMode passed in allows you to control the type of force given.
📌 ForceMode.Force: Add a continuous force to the rigidbody, using its mass. I like using this for mechanics that push or pull over time, and larger (more massive) rigidbodies are harder to push.
📌 ForceMode.Acceleration: Add a continuous acceleration to the rigidbody, ignoring its mass. This is good for mechanics that push or pull rigidbodies of any size at the same rate.
📌 ForceMode.Impulse: Add an instant force impulse to the rigidbody, using its mass. Use this for pushing the character, where a short burst of force occurs, knocking back you back.
📌 ForceMode.VelocityChange: Add an instant velocity change to the rigidbody, ignoring its mass. I personally enjoy using this inside a character's movement controller. It gives you granular control over a character's velocity and movement while still working within the physics system.
📌 Rigidbody.AddForceAtPosition applies a force at a given position. This can make your explosions even more realistic because torque will be applied at the same time. Watch boxes tumble and fly away.
📌 Rigidbody.AddRelativeForce applies a force relative to the rigidbodies rotation. It's important to not confuse the transform rotation with the rigidbody rotation, which may be updated less frequently than the transform rotation.
💬 Did I miss something? Leave a comment down below ⬇️
Enabling IL2CPP on your Unity builds will significantly boost your performance and help you transform your game into something truly great.
📌 When building a project using IL2CPP, Unity converts IL code from scripts and assemblies to C++, before creating a native binary file (.exe, apk, .xap, for example) for your chosen platform. Some of the uses for IL2CPP include increasing the performance, security, and platform compatibility of your Unity projects.
📌 This is different from the old Mono implementation that uses JIT (just in time) compilation.
📌 Compiling C++ to a native binary is a huge performance advantage from Mono JIT.
📌 There is no warm-up the first time you call a method with IL2CPP. Everything is compiled when the native binary is created.
📌 IL2CPP will cause your binary to be larger, but you can enable code stripping to help mitigate this issue.
📌 Build times with IL2CPP are longer than Mono, however in most cases, it is well worth it when creating a build people will play.
📌 Unity Editor still runs Mono. This is a good thing because it takes less time to recompile your scripts and in most cases, your computer is more powerful than the devices it will run on.
📌 IL2CPP is now a requirement for iOS and is the default for Android builds.
📌 IL2CPP relies on C++ compilers not implemented by Unity. This is a very good thing. Modern C++ compilers very stable and are great at compiler time optimizations.
📌 Reflection in C# causes IL2CPP to generate "metadata" embedded in C++ so that "reflection" can occur in the C++ code. This increases code size and may even lead to the embarrassing "too much code" issue Unity suffers from on mobile platforms.
Here are some super basic tips to increase your game's performance in Unity
📌 Only run code when things change. Instead of constantly polling and checking a state inside Update, try using Events and Actions to trigger code when something changes.
📌 If polling is required, then try only running your code every N frames or after a delay. Your AI code probably does not need to fire every frame.
📌 Move code out of loops when they can be run once, before, or after.
📌 Cache references and values instead of calculating them every time. GetComponent is included.
📌 Pool objects instead of Instantiating everything. Keep GameObjects in a list and when they are no longer needed, disable them. Enable them later as needed.
📌 Never use SendMessage and Camera.main. They are slow.
📌 Do not use FindObjectOfType. Instead, serialize a reference and link it in the Editor. Alternatively, you can create a singleton and use the reference directly.
📌 Avoid Vector3.Distance and Vector2.Magnitude because they use square root calculations. When possible, use Vector3.sqrMagnitude.
📌 Manually call System.GC.Collect() during loading screens or scene transitions.
📌 If you're getting large CPU spikes from garbage collection, then try incremental garbage collection.
📌 Disable/Enable MeshRenderer's using MeshRenderers.enabled. There is overhead activating and deactivating GameObject's with SetActive.
📌 Avoid calling DestroyImmediate.
📌 Store settings inside of ScriptableObjects instead of Prefabs. This avoids redundant variables allocated for prefabs using the same settings.
Can you handle the Truth? Let's break misconceptions and look at some common Game Developer myths.
📌 Making games is like playing games. Eating is not like cooking, the same goes for making games. Game development boils down to problem solving, creativity, blood, sweat, and tears. Understand what you're getting into when you start your game dev career.
📌 Casual games don't matter. The world consists of individuals who are fundamentally different. Some people like hardcore RPGs and some like casual games. Developing a good casual game is extremely difficult and there's a lot of money to be made in the casual space.
📌 People will steal your ideas. Many developers tend to keep their ideas secret for fear of idea-theft. Video game clones do exist, but only after a game becomes very profitable. Theft occurs from time to time but it's commonly blown out of proportion; be smart but let go of the paranoia.
📌 Designing games is easy. Knowing skills like programming, 3d modeling, and photoshop does not make you a good game designer. Great game design comes from practice and experience. Studying and evaluating design in games will help, but the heart of the design is forged in creation, feedback, and having honest evaluations of your own work.
📌 This is implemented with a prefab.
📌 The screen is controlled through a TextSelectorUi script at the root of the prefab.
📌 The controller code must manually call Show() on the TextSelectorUi.
📌 Using a custom script provides a great advantage over hardcoding text in code or in the prefab itself. It allows text changes, prefab reuse, and dynamic population of the title and text fields.
📌 The TextSelectorUi provides an interface that may be expanded upon in the future. This gives us flexibility, which is very important in fast-moving game development.
📌 If the script did not use Show(), but instead started inside OnEnable and ended in OnDisable, then the flexibility and future-proofing of this screen would be severely limited.
📌 The screen appears using a DOTween Fade. This is invoked in code, performant, and easy to implement. However, it is not as flexible as using an Animator for elaborate animations.
📌 If required, this could easily be refactored to use an Animator instead of DOTween. This would be a simple refactor, only requiring changes inside this single prefab.
Unity 2019 LTS is now the latest Unity version with "Long Term Support."
🎮 The focus of the LTS version is stability and will continually receive bug fixes for the next two years.
🎮 Using LTS can help bring long term stability to your game and your development process.
🎮 2019 LTS has the benefit of supporting the Scriptable Render Pipeline, Shader Graph, Nested Prefabs, and much more. Features that 2018 LTS does not support.
➡️ It's common for minor version updates to introduce new bugs with new features.
➡️ The specific version for 2019 is 2019.4.x LTS.
➡️ Early versions for 2019.1x, 2019.2x, and 2019.3x have issues and aren't recommended to launch new games on.
❗️ Constantly upgrading your Unity minor version is a huge headache and can lead to many issues.
❗️ LTS helps us avoid upgrade pains. Although LTS will continually release new hot-fix versions, these are restricted to bug fixes and are much more low risk than typical Unity upgrades.
❗️ Android developers should take notice of LTS since their game will run on many different devices. Android bug fixes can be found in almost every Unity update.
⭐️ Unity 2020 is just around the corner and promises many new toys and "game-changing" features.
⭐️ What is not talked about is Stability. New features and major changes always introduce runtime and Editor issues.
⭐️ After many years with Unity, I highly recommend waiting on the latest releases and jumping onto Unity 2019 LTS to benefit your games and your game development sanity.
The development cycle can require intense periods of grueling work. Here are some tips to keep your sanity and productivity.
📌Manage your time. Time is your most valuable asset. With only 24 hours in every day, reconsider if binging Tiger King is worth the cost.
📌Allocate "me time." Whether it's late at night or early in the morning, a period for you to unwind and destress will help you recover and prepare for work hours.
📌Define clear work hours. Set X amount of hours you'll work in one day and when it's over, close slack, and walk away. With a time limit, it also helps you stay productive at work; less time to goof off.
📌Have a social life. Plan events and activities on the weekend or in the afternoon. If you're a workaholic like me, It'll help you break away from the computer.
📌Become self-aware. When you're body feels unusually tired or you're starting to dislike your work, it's most likely a sign you're working too much.
📌Exercise and go outside. A 30-minute walk outside goes a long way to keep your lizard brain happy.
📌Keep your eye on the prize. Look at the work week ahead of you and make sense of how it fits in with your greater goal. Maybe you're building a website, game, or VR training app for hamsters. Understand every week, day, and hour helps you progress towards the finish line. 💬How do you keep your life - work relationship balanced.
The Unity Animator is an essential tool for making a beautiful game.
🕹 Animators use AnimationController assets. These assets allow you to create keyframe animations directly in the Unity Engine. For most animations, this is much better than trying to animate directly in code. Animations can be previewed as they are being modified, and don't require programming to update.
🕹 Animation Controllers are implemented with state machines. Each state represents an animation and transitions can be created between the states. A transition will blend between two different animations, so your character can transition smoothly from walking to running.
🕹 Animation Controllers are automatically created for models that also have animations. This is common for character models or any FBX that has animations attached. Custom scripts can then reference these animators, play animations, and trigger transitions between the different states.
🕹 The Unity animation system has a performance cost associated with it. In many cases the performance hit is negligible, but consider alternative solutions if you have thousands or hundreds of Animators active at the same time.
🕹 StateMachineBehaviour is a custom script that can be created and attached to a specific state in an AnimationController. Methods for Enter, Update, and Exit may be implemented for each state. This is good for creating or toggling special effects when an animation state is entered. 💬 What do you think about the Unity Animation System?
Copyright (c) 2020 Me First LLC