using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using Newtonsoft.Json;

public class mqttController : MonoBehaviour
{
    public mqttReceiver _eventSender;
    public TextMeshProUGUI nilaisensor;

    void Start()
    {
        // _eventSender = GameObject.FindGameObjectsWithTag(tagOfTheMQTTReceiver)[0].gameObject.GetComponent<mqttReceiver>();
        _eventSender.OnMessageArrived += OnMessageArrivedHandler;
    }

    private void OnMessageArrivedHandler(string newMsg)
    {
        nilaisensor.text = newMsg + "%";
        Debug.Log("Pesan:" + newMsg);
    }
}