// Use this for initialization void Start() { if (eventPublisher != null) { EventPublisherScript script = eventPublisher.GetComponent <EventPublisherScript>(); if (script != null) { script.GameInfo += AddText; } } if (text != null) { text.text = "执行官,欢迎您的到来。"; } }
public static void Publish(string info) { if (script == null) { GameObject obj = GameObject.Find("EventPublisher"); if (obj != null) { script = obj.GetComponent <EventPublisherScript>(); if (script == null) { Debug.LogError("can not find EventPublisher with EventPublisherScript"); } } } if (script != null) { script.AddEvent(info); } }