I made a sample project where I have a DLL that contains a class that creates a GameObject and adds a script component to this game object.
This is the code I'm packing into a DLL:
using UnityEngine;
public class DLLTest : MonoBehaviour {
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
public static void Initialize()
{
Debug.Log("INITIALIZE");
var go = new GameObject(typeof(DLLTest).FullName);
go.AddComponent();
}
// Use this for initialization
void Start () {
Debug.Log("STARTING");
}
// Update is called once per frame
void Update () {
}
}
In the editor when I play the scene the game object is created and the Start method is executed. But when I build the project for the iOS platform, nothing happens. Am I doing something wrong? Can I really use a C# DLL in the iOS build?
↧