示例#1
0
        private void Start()
        {
            var modLabObj = SingleReferenceHandler.GetScript <ModLabObject>();
            var sampleMod = modLabObj.GetMod("Sample Mod");
            var behaviour = sampleMod?.PostGenClasses["SampleBehaviour"];

            DebugText.text = sampleMod?.Scripts["SampleBehaviour"];
            gameObject.AddComponent(behaviour?.Type);
            DebugRecompileButton.onClick.AddListener(() =>
            {
                modLabObj.RecompileScript("Sample Mod", "SampleBehaviour", DebugCodeText);
            });
        }
        private void Awake()
        {
            Debug.Log(this.GetType().Assembly.FullName);
            _single = this;
            _loadedMonobehaviours = new List <Component>();
            _loadedObjects        = new List <object>();

            foreach (var script in Scripts)
            {
                _loadedMonobehaviours.Add(gameObject.AddComponent(script.GetType()));
                Debug.Log("Added MonoBehaviour: " + script.GetType().Name);
            }

            // normal scripts
            _loadedObjects.Add(new ModLabObject());
        }