Tips
Unsubscribe to events
Remember to unsubscribe -= to your events. Forgetting to do so can cause memory leaks 🤯
public class MyLevelModule : LevelModule
{
public override IEnumerator OnLoadCoroutine() {
EventManager.onCreatureKill += EventManager_onCreatureKill;
EventManager.onPossess += EventManager_onPossess;
EventManager.onUnpossess += EventManager_onUnpossess;
}
public override void OnUnload()
{
EventManager.onCreatureKill -= EventManager_onCreatureKill;
EventManager.onPossess -= EventManager_onPossess;
EventManager.onUnpossess -= EventManager_onUnpossess;
}
}
To get custom weapons to sit properly on a weapon rack
Create a second HolderPoint
(Transform) like in the pictures below. Then add an additional HolderPoint
on the item script named HolderRackTopAnchor for the weapon rack and HolderRackTopAnchorBow for the bow rack and reference your new HolderPoint
.
Use regions in C# code to collapse regions of code together
public class MyLevelModule : LevelModule {
#region onLoadlogic
public override IEnumerator OnLoadCoroutine() {
return base.OnLoadCoroutine();
}
#endregion
}