public static void Awake(HotScriptAdapter adapter) { Type scriptType = Type.GetType(adapter.targetClass); HotScript behaviour = (HotScript)Activator.CreateInstance(scriptType); typeof(HotScript).GetProperty(nameof(HotScript.gameObject) , BindingFlags.Instance | BindingFlags.Public) .SetValue(behaviour, adapter.gameObject); adapter.targetObj = behaviour; foreach (var info in adapter.infos) { var field = scriptType.GetField(info.fieldName); var value = GetFieldValue(field, info); field.SetValue(behaviour, value); } ins.hotScripts.Add(adapter, behaviour); behaviour.Awake(); }
public static void OnDestroy(HotScriptAdapter adapter) { ins.hotScripts[adapter].OnDestroy(); ins.hotScripts.Remove(adapter); }
public static void OnDisable(HotScriptAdapter adapter) { ins.hotScripts[adapter].OnDisable(); }
public static void OnGUI(HotScriptAdapter adapter) { ins.hotScripts[adapter].OnGUI(); }
public static void FixedUpdate(HotScriptAdapter adapter) { ins.hotScripts[adapter].FixedUpdate(); }
public static void LateUpdate(HotScriptAdapter adapter) { ins.hotScripts[adapter].LateUpdate(); }
public static void Start(HotScriptAdapter adapter) { ins.hotScripts[adapter].Start(); }