Skip to content

Helps you make your Character Controllers, Vehicle Controllers, etc more modular.

License

Notifications You must be signed in to change notification settings

Sokka06/ModuleController

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 

Repository files navigation

Module Controller

What is it?

Module Controller helps you piece your Character Controllers, Vehicle Controllers, and others into smaller modular pieces (aka Modules). This helps you keep your scripts more focused and makes it easier to modify and add new features.

Getting started

  1. Clone or download the repository.
  2. Copy ModuleController folder from Plugins folder to your project.
  3. Take a look at the included Demos to see examples of how you can introduce a bit more modularity into your Character Controllers and such.
  4. Done!

Developed in Unity 2020.3.23f1, but I don't see why it wouldn't work in any Unity version.

How To Use

  1. Create new scripts for your Module Controller (named FooModuleController, for example) and your Module base class (named AbstractFooModule, for example).
  2. If your classes are MonoBehaviours, you can inherit from ModuleControllerBehaviour and ModuleBehaviour, which are also MonoBehaviours and include all the needed boilerplate code. Alternatively, you can implement IModuleController and IModule interfaces to customize them further.
  3. In your Module Controller script, add SetupModules(); to your Start function and UpdateModules(Time.deltaTime); to your Update or FixedUpdate function.
  4. Make new scripts for your Modules (named FooBarModule, FooBazModule, etc) and make them inherit from your Module base class. You can override your module's SetupModule function and add Debug.Log($"Hello {GetType().Name}"); to confirm that they are setup.
  5. Make a new GameObject and add your new Module Controller and Module scripts to it.
  6. Press play!

Demos

Basic

A basic FPS Character Controller with modular abilities. Basic Demo

Advanced

3rd Person Character Controller with simple IK. Advanced Demo

Vehicle

Vehicle Controller with multiple Module Controllers and submodules. Vehicle Demo

Notes

  • Modules can also be Module Controllers and have their own submodules. Just implement IModuleController in your Module, add all the necessary boilerplate code and make scripts for its Modules.
  • Adding and removing Modules during runtime is currently not implemented.

Assets

Models

Car Kit Racing Kit 3rd Person Character

Sounds

Engine Skid Impact1 Impact2 Impact3

About

Helps you make your Character Controllers, Vehicle Controllers, etc more modular.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published