Using existing Java code and creating a UI onto that code in Unity

Hi everyone, I really searched a lot to find a similar topic to mine but I couldn’t find any. Is there someone who can show me some directions about this question?

To be more precise; we have a small code that works, alright, which has about 6-7 classes in separate files. I was going to create the UI with NetBeans, but I really don’t like the outcome.

So I decided to use Unity, maybe even with a 3D interface, 2D is totally fine if I can make it anyways.

My question would be where to start? How can I import these codes? Should I just create the project and paste the files under the scripts? And create a UI on them? And how can I start creating the UI with regard to the code so that the UI would use the code implemented in the scripts?

I’m very new to this, so please be patient. I am thankful to any help as well.

You can’t import them. Unity doesn’t support Java.

Unity’s Learn section.

Specifically.

Learn game development w/ Unity | Courses & tutorials in game design, VR, AR, & Real-time 3D | Unity Learn - covers the actual editor
Learn game development w/ Unity | Courses & tutorials in game design, VR, AR, & Real-time 3D | Unity Learn
Learn game development w/ Unity | Courses & tutorials in game design, VR, AR, & Real-time 3D | Unity Learn

1 Like

Hmm, thanks for the reply.

Any idea where I can create a GUI using this existing code? I already have Unity and thought I could make something great without changing the existing code. I wish I could turn it into C# to be able to use Unity. I don’t want to use NetBeans to be honest.

And thanks for the links ^^ I already have a Roll-a-Ball game hehe :stuck_out_tongue:

No. Unity uses a WYSIWYG approach to UI. Plus the existing code wouldn’t be compatible with Unity since it is intended for a completely different language and framework. There will likely be things that simply cannot be converted over identically so an automatic process would at best only handle part of it.

1 Like

So should I use NetBeans for this particular project since the written code isn’t mine it’ll take forever for me to convert it to C#. Or are there any other programs meant to do this and is better than NetBeans?

Netbeans is just a Java IDE. You’ll have to learn to code in Java in order to make a fully functional UI in Netbeans that interfaces with your 3rd party code you already have.

If you’re going to learn Java though you’re probably better off learning C# instead and just reimplementing your existing code in Unity from scratch. At least you’d be working with an actual game engine for your game. If this project actually isn’t a game, then maybe learning Java and using Netbeans is the right approach though.

1 Like

Good thing is I already know Java and not C#, so you’re suggesting that I should code it? :frowning:

I was trying to find ways to avoid writing code to be honest :smile: well, I’ll go with the old ways for this project. I will be learning Unity for my game project later on.

Thanks for the replies everyone! ^^

If you want to use Unity you cannot use Java or Java kits. If that doesn’t work for you then don’t use Unity for this.