Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by MD_Reptile · Sep 02, 2013 at 11:50 PM · c#javaconversionopen-source

Convert a Java open source project to Unity C#?

I have found a really interesting Java project here:

http://gamedev.tutsplus.com/tutorials/implementation/coding-destructible-pixel-terrain/

and I would love to be able to mess around with this is unity - but problem is of course its written in Java, and has many differences from unity C# (and more so from unityscript) so I am wondering if there is any "best method" of getting from java to C#, and because it rely's on some java methods that work different in C#, is it going to cause a big headache? What are your thoughts on this you unity pro's? Can it be done?

Some parts don't seem too far from unity's C#:

 boolean isPixelSolid(int x, int y) {
     if (x > 0 && x < img.width && y > 0 && y < img.height)
       return img.pixels[x + y * img.width] != color(0,0);
     return false; // border is not solid
   }


Oh and I am not opposed to alternative suggestions to get to the same effect in unity, the Destruction of pixels like demonstrated on that webpage...

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by DESTRUKTORR · Sep 03, 2013 at 12:07 AM

There's actually not that many differences between java and C#... The syntax is almost exactly the same. The biggest differences are the built-in systems (Java has a much better selection of built-in collections classes than C# does, for example).

The best method for this would probably just be to copy/paste each class into a new C# class in Unity and just start going through them, correcting errors. There will likely be a lot, but it shouldn't take too long, considering you're converting languages, lol.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MD_Reptile · Sep 03, 2013 at 12:08 AM 0
Share

Alrighty then, here goes! lol

avatar image DESTRUKTORR · Sep 03, 2013 at 12:08 AM 1
Share

Good luck, kind sir and/or madam!

avatar image clunk47 · Sep 03, 2013 at 04:20 AM 1
Share

$$anonymous$$eep in $$anonymous$$d Java is not Javascript.

avatar image MD_Reptile · Sep 03, 2013 at 12:36 PM 0
Share

Yes, I really felt like it seems more like C# (this is my first time working with Java at all) and that's pretty much the only reason I had thought it might be do-able to convert.

Anyway I have worked out some kinks with a couple scripts, but its gonna take a lot of time to convert this whole project - especially considering its use of some java techniques that work differently in unity, like for instance it creates a var for a "Pimage"... which is what I am trying to figure out right now... I guess this is built into "processing"

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Converting Script from Java to C# 2 Answers

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

c# to compile xml string as code during runtime 1 Answer

how to make Doors or something similar with joints 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges