Place objects via Python code

Hi guys I am a beginner in Unity3d.

For now i want to place simple objects (e.g. Cubes) with a Python script.
My Python program prints Vectors like the follwowing: (x, y , r) r = rotation
(The height z is always 0)

Is there any way to place Objects automatically based on the resulting Vectors of my Python program?

Greetings! :slight_smile:

You’d have to do something like write your vectors to a file in python, then read the file in Unity to place the cubes. Really it’d be much simpler to just rewrite your python script in C# within Unity.

1 Like

What are you using? Any Python external to Unity will require what PraetorBlue says above: you would need to write C# code in Unity to digest the output from a file your Python program writes, which makes it silly: just learn C#.

Alternately there is a Python module available in Unity for Editor-only use:

https://docs.unity3d.com/Packages/com.unity.scripting.python@2.0/manual/index.html

Disclaimer: I have not used it.

1 Like