Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I create 3D Object during runtime in Unity by using code or by programmatically?

I am new to unity 3d world. I am making an AR app for android and iOS. I want to use unity to show 3d object in real world which is obviously via mobile camera. I am fetching data from server in the form of JSON via webservice/API. But that’s not the problem, the problem is how can I create 3d object during runtime based on the JSON data. In the data, it will be define coordinates of x, y and z axis where on those I have to show 3D objects and this will change dynamically which is based on the JSON data. I need idea or hint how can I put those via coding with C#.
Thank you.

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

From my point of view you want hint for creating a 3D object using c# during runtime.
For that you can use GameObject.
code snippet:

GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube); //In place of Cube you can use any 3d object like Sphere, Cylinder...
        cube.transform.position = new Vector3(0, 1.9f, 0);

the above code is in start() method.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading