diff --git a/MiraAPI/Roles/CustomRoleConfiguration.cs b/MiraAPI/Roles/CustomRoleConfiguration.cs index de02f57..a11ddc0 100644 --- a/MiraAPI/Roles/CustomRoleConfiguration.cs +++ b/MiraAPI/Roles/CustomRoleConfiguration.cs @@ -1,5 +1,6 @@ using AmongUs.GameOptions; using System; +using Il2CppInterop.Runtime.Attributes; using MiraAPI.Patches.Freeplay; using MiraAPI.Utilities.Assets; using UnityEngine; @@ -77,16 +78,19 @@ public record struct CustomRoleConfiguration /// /// Gets or sets the Sprite used for the Role Options menu screenshot. /// + [HideFromIl2Cpp] public LoadableAsset? OptionsScreenshot { get; set; } = null; /// /// Gets or sets the Sprite used for the Role Icon. /// + [HideFromIl2Cpp] public LoadableAsset? Icon { get; set; } = null; /// /// Gets or sets the Intro sound for the Role. /// + [HideFromIl2Cpp] public LoadableAsset? IntroSound { get; set; } = null; /// diff --git a/MiraAPI/Roles/CustomRoleManager.cs b/MiraAPI/Roles/CustomRoleManager.cs index 922765e..0bbf4eb 100644 --- a/MiraAPI/Roles/CustomRoleManager.cs +++ b/MiraAPI/Roles/CustomRoleManager.cs @@ -89,15 +89,22 @@ public static class CustomRoleManager foreach (var roleType in roles) { - ClassInjector.RegisterTypeInIl2Cpp(roleType); - - var role = RegisterRole(roleType, pluginInfo); - if (role is null) + try { - continue; - } + ClassInjector.RegisterTypeInIl2Cpp(roleType); - pluginInfo.InternalRoles.Add((ushort)role.Role, role); + var role = RegisterRole(roleType, pluginInfo); + if (role is null) + { + continue; + } + + pluginInfo.InternalRoles.Add((ushort)role.Role, role); + } + catch (Exception ex) + { + Error($"Failed to register role type {roleType.Name}: {ex}"); + } } pluginInfo.PluginConfig.Save();