using UnityEngine; using Unity.Robotics.ROSTCPConnector; using RosColor = RosMessageTypes.UnityRoboticsDemo.UnityColorMsg; public class RosSubscriberExample : MonoBehaviour { ROSConnection ros; public GameObject cube; void Start() { ros = ROSConnection.instance; ros.Subscribe("color", ColorChange); } void ColorChange(RosColor colorMessage) { cube.GetComponent().material.color = new Color32((byte)colorMessage.r, (byte)colorMessage.g, (byte)colorMessage.b, (byte)colorMessage.a); } }