🧑💻Setup
Last updated
Last updated
First and foremost you need to add the package to Unity. In Unity navigate to Windows > Package Manager. Then in the top left click the "+" symbol, and select "Add package from git URL".
You will need Git installed if not already.
Next, copy the following URL into the text box that appeared.
If you haven't used the framework before, it is highly recommended to import the samples as they will give you a good idea of how to implement custom effects and create an effect UI. You can add them through the package manager in the samples tab of the Status Effect Framework package.
It isn't required to edit the settings, however it may be useful to add your own groups to effects. You can find the settings at Edit > Project Settings > Status Effect Settings.
Good to know: Make sure to check out Status Effect Settings for more info.
You can create your own custom StatusEffectData by right clicking the project file browser, and navigating to Create > Status Effect Framework > Status Effect Data. There are many settings you can tweak, but the main three you should change are the Comparable Name, Base Value, and the Effects list. Go ahead and add your first effect.
You will need to create your first StatusName and ComparableName. Navigate to Create > Status Effect Framework > Status Name > Float and Create > Status Effect Framework > Comparable Name. You can change the StatusName to be whatever you want, just know that it will only affect a StatusVariable with the same StatusName.
Once they are created, add them into the StatusEffectData. Additionally you can tweak the value modifier depending on what the effect is.
Good to know: Make sure to check out Value Modifier for more info.
It is important to use the base value for something, it doesn't need to be in an Effect (it could be used in a Module) but it should be used somewhere. The value is used to calculate non-stacking behavior so to make our first effect use the base value you can select the checkbox next to Float Value.
Obviously you don't want to completely rewrite your current entities or characters or whatever they may be just to implement simple status effects. Luckily its as easy as implementing an interface! As long as your class inherits from IStatus and MonoBehaviour its ready to use Status Effects!
Check out an example implementation here:
IStatusNext just add any StatusVariables that need to be effected by StatusEffects, add in the StatusName and you're good to go! You can tweak the base value to your liking too.
All you need to do to add or remove StatusEffects is call the extension methods. That's it!
Again it is recommended to check out the samples, as they show a rough idea of how to get started. If you want more customized effects you may also want to check out Modules.
If you encounter any issues or would like to make a pull request feel free to do so I am open to feedback!
You can also reach out to me on Discord if you have any questions.