0

I'm implementing an Android application that draws a 3D object on screen (over camera view). The objects are in FBX format, and since it's been several years since the last time I used openGL I decided to do it using Unity and then integrate it in Eclipse. I'm still a beginner in Unity too.

The application works fine, but now I'm facing a problem: I want the user to be able to download FBX objects from my server and decide which one to draw on the view. Is it possible to dynamically change the object being drawn without having to store a whole scene for each object?

Thanks!

PX Developer
  • 8,065
  • 7
  • 42
  • 66

1 Answers1

1

Yes, it is possible to dynamically create objects at runtime.

You can build meshes with vertex and triangle data, set uv coordinates, apply textures, and add components (like AudioSource, MeshCollider) at runtime.

There is no need to change the scene or load anything but the data that composes the object.

Bare in mind there are several ways you can do this, some being built in, some not. Research your options and implement one that works for you.

If you have Unity Pro, you should be able to do this easily with their Asset Bundling: AssetBundles

Nestor Ledon
  • 1,925
  • 2
  • 23
  • 36
  • AssetBundles seems really interesting, I'll look for it. Just one beginner doubt. I wanted to do most part of code in Eclipse since I've developed a lot in Java but I barely used C#, Javascript or Boo. Can I create a function in a Unity script and then call it from an Android activity after the project has been exported to Eclipse? – PX Developer Apr 08 '13 at 19:47
  • I'm pretty certain you could create a .Net/Mono library that includes the Unity3D libs and access methods via any language. Some may need a middle man like C or C++ but I highly advise against this if you are new. I mean no disrespect but you are making it much harder on yourself by using an IDE that isn't optimized to develop using Unity's libraries. I encourage you to use MonoDevelop and program in C#, the language is extremely similar to Java and you will pick it up in no time. I absolutely guarantee that you will have a better learning experience. I program in both Java and .Net(C#) fyi. – Nestor Ledon Apr 09 '13 at 02:54
  • As an addition to the comment about your Java experience, you should check this out: http://stackoverflow.com/questions/15855983/passing-camera-main-in-unity3d-to-android-java-method/15873219#15873219 – Joetjah Apr 09 '13 at 08:03
  • That basically explains a bit on how to build a .JAR file (with Java classes) and use that one in your Unity game. – Joetjah Apr 09 '13 at 08:04