Behaviour (GEB)
OnInstant(GameplayEffect ge) // OnInstant is only triggered from Instant/Periodic GEs. Meanwhile, the other methods are only triggered from Duration/Infinite GEs.
OnAddThis(GameplayEffect ge) // When the effect with this GEB applies on the ASC. e.g. Mind control, switch the movement controller here.
OnRemoveThis(GameplayEffect ge) // When the effect with this GEB is removed on the ASC. e.g. Mind control, return the original movement controller here.
OnAnyGameplayEffectApplied(GameplayEffect ge) // When any GE is added.
OnAnyGameplayEffectRemoved(GameplayEffect ge) // When any GE is removed.
OnAnyGameplayEffectsChanged(List<GameplayEffect> ges) // When any GE is applied or removed. e.g. Ability Cooldown Modifying GEB, recalculate the ability cooldown duration here.
OnAttributeChanged(AttributeName attributeName, float oldValue, float newValue, GameplayEffect ge)
SerializeAdditionalData() //Multiplayer serialization
DeserializeAdditionalData() //Multiplayer serializationpublic class ApplyEffectOnRemoval : GameplayEffectBehaviour {
[ReadOnly] public AbilitySystemComponent targetASC;
public GameplayEffectSO geSO;
public string geSO_Name;
public override void SerializeAdditionalData() {
geSO_Name = geSO.name;
}
public override void DeserializeAdditionalData() {
geSO = GameplayEffectSOLibrary.Instance.GetByName(geSO_Name);
}
public override void OnAddThis(GameplayEffect ge) {
targetASC = ge.target;
}
public override void OnRemoveThis(GameplayEffect ge) {
targetASC.ApplyGameplayEffect(targetASC, targetASC, geSO.ge.Instantiate(), ge.applyGUID);
}
}
Last updated