- Home /
This question was
closed Dec 10, 2018 at 07:57 AM by
hexagonius for the following reason:
integrating arduino is explained by the vendor of the device. and the web is full of tutorials
Question by
dhritivasu · Dec 09, 2018 at 11:02 PM ·
unity 5inputarduino
Arduino Input to Unity
I want to take input from Arduino and put it in Unity. Here is my Unity Code: using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Version2ImageShow : MonoBehaviour {
[SerializeField] GameObject[] objects;
int index = 0;
void Start()
{
foreach (GameObject go in objects)
go.GetComponent<SpriteRenderer>().enabled = false;
}
void Update()
{
if (Input.GetKeyDown(KeyCode.I)) //change this to whatever you want for input
{
if (index < objects.Length) // to avoid indexing errors
objects[index].GetComponent<SpriteRenderer>().enabled = true;
index += 1;
}
}
} Can anyone walk me through the steps of getting input from Arduino and putting it in Unity? Thank you!!
Comment