Unity & Libraries some question before I start!

First of all, Hello everybody, :slight_smile: I am new in this forum, new with unity and yes, new about programming!

To be honest I did something simple for iOS some years ago, It was something more than “copy/paste”.

To spend our spare time, my friend and I were thinking about a (very) small project with Arduino communicating with an Android Device via bluetooth… but this is something I won’t even think by now.

Well this is my question, hoping I can explain enough with my poor english & programming skills

Let’s say for instance I write a library on my own that picks a random (myRandomNumber) number. Will It be possible to “#include” this library in an Unity project calling then just the function?

int a = myRandomNumber
int b = myRandomNumber

Will it be possible to write and then use that library in Unity itself? And … how could I try if It works?

I am asking this because I had a lot of headaches when I tried to do something similar for iOS.
By this time I don’t mind “how to code this” but … just if Unity itself will let me do this!

For the code part … I will bother you Soon! :smile:

If by “library” you mean some code written in C/C++, then yes, you can do that; it’s known as writing a plug-in. Certainly not a beginner-level topic, but doable.

If by “library” you mean a C# class (or collection of classes), then that’s even easier. Instead of “#include” in C# you’d use “#using”, but otherwise the concept is pretty much the same.

Thank You Joe!
Well I think I will know It when I will start my test/learning process but yes, I think I meant a class … I will start with my “Hello World” that is always a touch a button then generate a random number! :slight_smile: I think I will be back in this forum very soon! In the meanwhile … thanks really much! :smile:

That sounds like a great first project.

Be sure to make use of the Learn section (see the link at the top of this page). It’s full of all sorts of great stuff that will save you a lot of time.

For your first project, you really only need UI — to sketch it out, you’ll throw a Canvas into the scene, put a Button and a Text inside the canvas, and then write a little script with a public method and a Text property. When this method is invoked, it generates a random number, converts it to a string, and stuffs it into the text. Then you’ll invoke this method via the Button action event.

All that probably doesn’t make much sense to you now, but after you’ve been through a UI tutorial or two, it should all be clear. If you get stuck, don’t hesitate to ask for help!