30 lines
818 B
C#
30 lines
818 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace BITKit.Mod
|
|
{
|
|
public class UnityModService : MonoBehaviour
|
|
{
|
|
[SerializeReference,SubclassSelector] private IReference[] referencedAssemblies;
|
|
private void Start()
|
|
{
|
|
foreach (var x in referencedAssemblies)
|
|
{
|
|
var dllName = x.Value.Contains(".dll") ? x.Value : $"{x.Value}.dll";
|
|
#if UNITY_EDITOR
|
|
var dll = System.IO.Path.Combine(Environment.CurrentDirectory, "Library", "ScriptAssemblies",dllName);
|
|
|
|
#else
|
|
var dll = System.IO.Path.Combine(Environment.CurrentDirectory,$"{Application.productName}_Data", "Managed", dllName);
|
|
#endif
|
|
BITSharp.ReferencedAssemblies.Add(dll);
|
|
}
|
|
ModService.Initialize();
|
|
destroyCancellationToken.Register(ModService.Dispose);
|
|
}
|
|
}
|
|
}
|
|
|