//doesn"t work when instantiate gameObject /* * void Awake() * { * instance = this; * }*/ void Start() { instance = this; Hint h = gameObject.GetComponent <Interactable>().hint; if (h != null) { h.initialise(); } else { Debug.Log("getcomponent not working in HintImage"); } if (r != null) { initRiddle(); } //update sprite im.sprite = h.GetSprite(); playercontrol = GameObject.FindObjectOfType <Move>(); if (playercontrol == null) { Debug.LogWarning("Can't find instance of move script"); } HideHint(); }
private void init() { Hint h = gameObject.GetComponent <Interactable>().hint; if (h != null) { h.initialise(); } //update sprite im.sprite = h.GetSprite(); playercontrol = GameObject.FindObjectOfType <Move>(); if (playercontrol == null) { Debug.LogWarning("Can't find instance of move script"); } HideHint(); }