© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
3 replies
SneakySquid

❔ Serial Communication

Hi. Nothing is being printed to the console and I have no idea why.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO.Ports;

public class ArduinoController : MonoBehaviour
{
    SerialPort serial;

    void Start() //called once when the program is run
    {
        serial = new SerialPort("COM3", 9600);
        serial.Open();
    }

    void Update() //called once every frame
    {
        string data = serial.ReadLine();
        Debug.Log(data);
    }
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO.Ports;

public class ArduinoController : MonoBehaviour
{
    SerialPort serial;

    void Start() //called once when the program is run
    {
        serial = new SerialPort("COM3", 9600);
        serial.Open();
    }

    void Update() //called once every frame
    {
        string data = serial.ReadLine();
        Debug.Log(data);
    }
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,828Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Serial reading
C#CC# / help
4y ago
❔ Real time communication
C#CC# / help
3y ago
Unity Script Communication
C#CC# / help
3y ago