BepInEx / Il2CppInterop

A tool interoperate between CoreCLR and Il2Cpp at runtime
GNU Lesser General Public License v3.0
185 stars 59 forks source link

injected scripts in asset bundles don't preserve #137

Open dashadowofcat opened 1 month ago

dashadowofcat commented 1 month ago

i followed this documentation https://github.com/BepInEx/Il2CppInterop/blob/master/Documentation/Injected-Components-In-Asset-Bundles.md but it did not keep the component on the gameobject in the bundle

i have this script in both the unity project and the mod:

namespace BundleInfo
{
    public class Information : MonoBehaviour
    {

    }
}

then i inject the type and load the bundle

public override void OnApplicationStart()
{
    ClassInjector.RegisterTypeInIl2Cpp<Information>();

    bundle = Il2CppAssetBundleManager.LoadFromFile("location/to/bundle");
}

afterward i load the gameobject

GameObject Root = bundle.LoadAsset<GameObject>("prefab root");

but it simply does not have the scripts i put in the editor

if anybody has any idea why this could be happening help will be appreciated

ds5678 commented 1 month ago

From what you've said, everything seems fine. Are you still encountering the problem?