Unity Custom Keybinding Manager

September 29, 2020

Unity

Keybinding Manager


Title: How to Create a Custom Keybinding Handler for your Unity Game – *Improved*
By: Dapper Dino
Youtube – Tutorial
Description: Tutorial for setting up an input manager scriptable object in Unity.


Overview

I was looking for a nicer way to control inputs and controls when setting up a Unity project other than the very basic way of listing out all the specific key codes in the user scripts themselves or using fragile string references when tying it to Unity’s natural input manager. Initially I came across this creator’s first attempt at setting up a keybinding handler (hence the *Improved* tag on the title of this tutorial) but was not as interested in it since they still used strings and I thought an enum implementation would be better, but lo and behold, the same creator had actually improved their system a year later with an enum system like I was imagining.

While maybe not perfect, I do still like this overall implementation better than just using Unity’s natural tools for sure. Adding the enum setup removes the necessity of typing in direct and exact strings in your code which is great for reliability, while also making it easy to change key bindings in the scriptable object itself during develop. Having a system like this is also a good start for a truly accessible product on release that allows users to set their own keybindings, which is standard in many games.

Unity Fixed Update Purpose

September 25, 2020

Unity

Fixed Update


Title: GameDev Stream — What is FixedUpdate For?
By: Infallible Code
Youtube – Information
Description: Quick rundown of the main purpose of using fixed update in Unity.


Overview

This video quickly covers the main purpose of using FixedUpdate in Unity. As most Unity users know this is commonly used for containing physics calculations, but they better describe why that is here. They explain that FixedUpdate is much more consistent as it is inherently time based, whereas Update is tied directly to frame rate, which can vary drastically from computer to computer or user to user. This consistency however is what also makes FixedUpdate bad for uses such as user input because they could basically be entering inputs between the FixedUpdates and they will not be picked up at all, which is obviously extremely bad.

Unity Scriptable Objects Tutorial Updated

September 24, 2020

Unity

Scriptable Objects


Title: Better Data with Scriptable Objects in Unity! (Tutorial)
By: Unity
Youtube – Tutorial
Description: Quick updated rundown by Unity themselves on using Scriptable Objects.


Title: Scriptable Object Unity Documentation
By: Unity
Unity – Documentation
Description: One of the suggested links to follow from the tutorial video that is just the official documentation on scriptable objects.


Title: Making cool stuff with ScriptableObjects
By: Matt Schell
Unity – Blog
Description: Another suggested link to follow from the tutorial video showing some more examples of using scriptable objects.


Overview

I wanted to make a quick reference to this new video as it was just released yesterday (Sep 23, 2020) and I have wanted to explore scriptable objects in Unity and getting recently updated information is always useful.

Scriptable Objects as Data Containers

Scriptable Objects can be useful tools as data containers as is shown in their example using them for cards in a card game. They explain they can be a better option here than a Monobehaviour because Monobehaviours must be attached to a gameobject, where as Scriptable Objects can be used similarly to regular objects in that they do not have this requirement. If data does not belong to an instance, but is more shared amongst game objects, it is better to store it in a scriptable object. This is because when Monobehaviours reference Scriptable Objects they store a reference that points to the scriptable object as opposed to making their own copy of the data.

Scriptable Objects as Enum States

Scriptable Objects can also be used to author extended Enum states. They explain this through an example where they have a Placeable Data scriptable object which has Enum options for their Attack Type and their Target Type. This appears to just mean they support Enum lists which then allow for an easy dropdown option in the Inspector (similar to how Enums generally work in my experience).

Runtime Data Editing

They expand on the benefits of using scriptable objects as extended Enum states is that they allow for real time data editing (while in play mode). Normally most edits made in the Unity Editor during play mode are not saved so you have to remember them and reapply them if they are changes you want. Scriptable objects however can have their edits during play mode saved on the spot so they will persist even after leaving play mode. This is because scriptable objects are not bound to a scene’s runtime, they exist on a project basis in the Assets folder.

Reference List for Creating State Machines in Unity with Focus on Character Controllers

September 23, 2020

State Machines

Unity and Character Controller Focus


Title: The State Pattern (C# and Unity) – Finite State Machine
By: One Wheel Studio
Youtube – Tutorial #1


Title: How to Code a Simple State Machine (Unity Tutorial)
By: Infallible Code
Youtube – Tutorial #2


Title: Complex Enemy Behavior using Finite State Machines – 2D Platformer – Part 13 [unity]
By: Bardent
Youtube – Tutorial #3


Title: State Machine Setup – 2D Platformer Player Controller – Part 21
By: Bardent
Youtube – Tutorial #4


Title: Movement State Machine – Free download
By: Epitome
Youtube – Tutorial #5


Title: Unite 2015 – Applied Mecanim : Character Animation and Combat State Machines
By: Unity – Aaron Horne
Youtube – Tutorial #6


Overview

I have dealt with using state machines before, but mostly for creating AI systems. I wanted to investigate using a state machine specifically for a player controller, focused on 2D player controllers if possible. With this in mind, I just gathered many resources on more general state machine concepts and design with a mix of more player controller focused examples when possible.

The quick breakdown is as follows:

  1. Tutorial #1 – General Finite State Machines
  2. Tutorial #2 – General Finite State Machines
  3. Tutorial #3 – AI Finite State Machines
  4. Tutorial #4 – Player Controller Finite State Machines
  5. Tutorial #5 – Player Controller Finite State Machines
  6. Tutorial #6 – Player Controller/General Finite State Machines

Tutorial #1

This is a great quick tutorial on Finite State Machines and implementing them in general in C# and Unity. It covers the various levels of state machine implementations and the pros/cons of each tier of state machine organization. This is a fantastic starting point for state machines.

Tutorial #2

This tutorial is a more general state machine but it does still have a focus on turn based gameplay. While I was focused on player controller FSMs, I am also interested in how to use these for game states in turn based play so I wanted to record this.

Tutorial #3

This tutorial focuses more on AI FSMs, which I have more experience with, but I still wanted to grab a reference to this as a decent looking tutorial on implementing an FSM in general. I also have another Bardent tutorial that is a player controller focused FSM so I thought this also might help me tie in my prior experience if I followed this approach.

Tutorial #4

As mentioned above, I have two tutorials from the same tutorial set and this is the second. I am hoping there is an overlap in the two systems that I can also take away from by observing what they are able to recycle between them. I also hope this will help make this FSM make more sense since I can tie in my prior AI FSM experience.

Tutorial #5

This is a quick tutorial that directly shows the setup for a player controller FSM. It appears that it might not be the ideal architecture I am looking for, but it could still serve as a good example when starting to design a player controller FSM.

Tutorial #6

This older (from 2015) Unite talk goes a bit more in depth into the combination of character animation and combat state machines. This could be a strong next step for me to look into after focusing on movement for the core of the player controller state machine. I am especially interested in seeing if I can implement their combat combos with their FSM approach in some capacity, as well as if they have an input buffering design I can learn from.

2D Melee Combat Tutorial and Game Kit with Thomas Brush

September 22, 2020

Game Development

2D Melee Combat

How To Make 2D MELEE COMBAT (Unity Tutorial + Free Game Kit!)

Youtube – Link

By: Thomas Brush


Referenced Previous Tutorial
How To Make 2D Platformers (Unity Fundamentals Tutorial)

Youtube – Link

By: Thomas Brush


First Portion

Camera

They start by using a VirtualCamera game object from the Cinemachine package within Unity. This camera object gives a lot of useful camera controls without having to build another from scratch. They mention another tutorial to help with paralaxing, so this may not be included in the virtual camera.

Character Animation

Spine

This seems to be the major animator they used, so this may be something worth looking into as I have come across it a lot now. For animation tips, they suggest strong bouncing effects on the vertical axis (squashing and stretching majorly in the y-axis generally, with some distortion in the other axis). Spine also gives you the option of different skins to provide the same set of animations to similar character type objects.

Animation State Machine

Again they reference a previous tutorial covering this more in depth. They do show how their animation system fires events to help perform certain actions in tandem with the animations without necessarily adding more programming. Examples for this include emitting particles or playing a sound on animation start or end.

Making Fighting Games in Unity

September 18, 2020

Unity

Fighting Games

Create A 3D Fight Game In Unity In One Video | 3D Beat Em Up Unity Tutorial | Fight Game Unity3D

Youtube – Link

By: Awesome Tuts


Hitboxes (Fighter Melee Attack) – Game Mechanics – Unity 3D

Youtube – Link

By: N3K EN


Overview

There is some significant overlap with fighting games and beat ’em ups when it comes to general combat in any 2D platforming game, so it made sense to look to these sources for more inspiration and options for designing a combat system within such a game. Using a fighting game frame system with start up, active, and recovery frames can also be tailored to work with general combat systems, so when looking to be flexible it makes sense to use a system like this that is applicable to many cases.

Neither of these examples specifically get into a specifically frame driven system, but they at least show the basics of tying animations into actions and hitboxes more, as well as exploring combos and possibly input buffering more as well. These options at least help expand some of the more basic combat options I have seen in more platforming focused 2D sources.

Unity Learn Class – Unity Gameplay Programming Fundamentals

September 14, 2020

Unity Learn

Gameplay Programming Fundamentals

Unity Gameplay Programming Fundamentals

Unity Learn – Link

By: Joshua Kinney


Overview

This is just a more advanced Unity programming fundamentals class, which sounds like exactly what I am looking to shore up currently, especially going into another personal project. This even has a focus on player movement scripts and interactive objects, which will fit very nicely with the next project I am looking to work on.

Using Unity Events and Events and Deciding Between Them

September 7, 2020

Unity

Events and Unity Events

Events or UnityEvents?????????

Youtube – Link

By: Jason Weimann


Overview

Events are something I want to utilize more consistently and more effectively in my code setups, so this seemed like a good supporting block to look into to understand their usage better. It also covers the usage and differences between Unity Events and the standard C# Events, so this gives me more options to explore and utilize as well more so than some other sources.

Continuing 2D Melee Combat Research for Unity

September 4, 2020

Unity

2D Melee Combat

Easy 2D Melee Combo System in Unity: Tutorial

Youtube – Source #1

By: ChosenPlay


2D Game Dev Tutorial – Melee Attacking in Unity (Sprites included)

Youtube – Source #2

By: Lost Relic Games


Basic Combat – 2D Platformer Player Controller – Part 9 [Unity 2019.2.0f1]

Youtube – Source #3

By: Bardent


Overview

After finding a decent basic starting point for 2D melee combat in Unity, I wanted to find a few more sources and options to support and develop that further. These sources I found look more into the animation options a lot, as well as some minimal input buffering as well as chaining/comboing, hitbox activation, and state machine implementation.

Source #1

Source #1 uses some transition animations to provide an example how to nicely transfer between various action animations when allowing characters to combo. This option also shows some minimal state machine usage (which seems like a strong candidate as a foundation for these character controllers).

Source #2

Source #2 delves into a large chunk of setting up a character controller with a focus on the melee combat. It explores the animation setup as well as an in depth showing of the programming behind everything. This includes basic character controller work as well as how to perform the combat input and hitbox activation. Most control is done directly through the Update methods here so it works better as a learning tool than a foundation for a proper system.

Source #3

Source #3 is another very basic option that is also in a tutorial set, so it will most likely provide the least information but could still give some helpful options. Being part of a tutorial set also helps me keep track of the entire set in case I wanted to follow it more before or after this specific tutorial.

Unity Melee Combat Basics with Brackeys Tutorial

September 3, 2020

Unity 2019

Melee Combat

MELEE COMBAT in Unity

Youtube – Link

By: Brackeys


Summary

I want to explore making 2D character controllers, so looking to add melee combat as an option is a very common addition that I want to understand better. Being a Brackeys tutorial this is a rather basic approach with very Unity specific options, but it at least provides a good starting point to get something up and running. I would like to look into other options to add to this so I know a few ways to add hitbox generation nicely to characters and agents alike.