Connecting an external NFC reader with Unity

Hi all,

After much research on the subject, most solutions are oriented on the Android NFC detection.

However, I’d like connected an external NFC reader (the ACR122U) with Unity to my game publishing on desktop (Windows).

What I found most similar to my project is ShadowRealmVR. But, they use a NFC reader created with Arduino.

Do you have any ideas for just reading the NFC Tag with my external NFC reader into Unity?

Thanks for your help.

Kadaj

I managed to make a Unity app that reads a tag from a ACR122U card reader.

My solution relies on a third part dll (GitHub - glebteterin/Lando: Asynchronous client for ACR contactless smart card readers)

I managed to build that dynamic library from Visual Studio. This gives me the Lando.dll file.

Then I imported the file into my Unity project.

using Lando;

I can use an instance of it

this.cardReader = new Lando.Cardreader();

It works with delegate methods

private void CardReader_CardConnected(object sender, CardreaderEventArgs e)
{
    Debug.Log(e.Card.Id);
}

…and then

this.cardReader.CardConnected += CardReader_CardConnected;

Now your reader can respond to reading a card asynchronously, but you still need to turn on and off the reading.

this.cardReader.StartWatch();
// you can read your tags now!
...
this.cardReader.StopWatch();
// read is over…

Don’t forget to dispose of your card reader so you can use it later in the application lifetime.

this.cardReader.Dispose();

The downside of this library is that I can only read the tag identifiers and not their content. I bypassed that limitation by creating different files the app reads at runtime to identify the nature of the IDs.


You may need to change the C# subset from the player settings.

Hey @Kadaj ! we’re trying to do the same thing. Did you find a solution?

thanks!

Hi @wildbytesDev ! Unfortunately no… I finally took an Arduino with a NFC shield.