Is there a way to compile arduino code in a unity app?

What I’m looking for is a way to write arduino code in a unity app, compile and send to arduino over bluetooth.

Better do that with the Java IDE furnished for Arduino.
the code is so little, that I doubt you need Mono Develop to write such code.
Or you mean rebuild a new code while your unity App running and send new code to Arduino ?