- Home /
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
push, any answers to this? im trying the same (same reader)
Hi Arilicious,
No, unfortunately, I've finally buy an Arduino with a NFC shield to communicate simply with Unity.
$$anonymous$$adaj
Hey $$anonymous$$adaj,
thanks for your reply, even if you had no success with the ACR122U - imo the SD$$anonymous$$ and their examples.. just dont work properly. I also just ordered the RC522 RFID Reader to use it with an Arduino
Hey @$$anonymous$$adaj ! 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.
Answer by crazyrems · Aug 28, 2019 at 09:02 AM
I managed to make a Unity app that reads a tag from a ACR122U card reader.
My solution relies on a third part dll (https://github.com/g-rad/Lando)
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.
Hi!, i try to make a build too in visual studio, but visual show me two errors in the code and i cant solution it, can you share de dll dynamic library pls? :D
hello, i'm having the same issue to build the dll. Could you share it please ?