Example #1
0
    public static InfoText SpawnInfoText(Transform parent, string text, Vector2 offset = default(Vector2), InfoTextType type = InfoTextType.Plain)
    {
        InfoText inst = Instantiate(infoText, parent.position, Quaternion.identity).GetComponent <InfoText>();

        inst.text        = text;
        inst.addedOffset = offset;
        inst.type        = type;
        inst.SetParent(parent); //cannot simply pass in parent to Instantiate, as it would follow the rotation as well
        return(inst);
    }
Example #2
0
    public static InfoText SpawnInfoText(Vector2 pos, string text, Vector2 offset = default(Vector2), InfoTextType type = InfoTextType.Plain)
    {
        InfoText inst = Instantiate(infoText, pos, Quaternion.identity).GetComponent <InfoText>();

        inst.text        = text;
        inst.addedOffset = offset;
        inst.type        = type;
        return(inst);
    }