• 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 cchpackers1 · Apr 01, 2019 at 05:56 PM · appcommunicationbundletcppython

Combining python and Unity 3D

To make this short and simple. I have TCP socket in my unity project that receives communication from a python script (in a separate python app, using Spyder right now). Is it possible to somehow combine these two programs into one concise app?

I am pretty sure Unity does not have this capability built in (if it does please let me know). Is there a work around? Am I able to create like an umbrella app using different software to start up both programs.

Comment
Add comment · Show 3
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 xxmariofer · Apr 01, 2019 at 06:23 PM 0
Share

if its a mobile app you can export to android studio / xcode. may i ask why are you using 2 different editors/ languages?

avatar image cchpackers1 xxmariofer · Apr 01, 2019 at 09:10 PM 0
Share

The python program access cameras and searches for codes, people and so on, then transmits information to unity and unity reacts to the information and displays what is needed. The python was written separately because unity does not have support python code (or at least enough of the functions of python to be effective). So would android studios allow me to combine my python and unity into a bundled app?

avatar image Magso · Apr 01, 2019 at 09:27 PM 0
Share

You could have two dependant builds such as having the python build write the info to a .txt or .json file then have the unity standalone read it.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Cornelis-de-Jager · Apr 02, 2019 at 03:49 AM

Unfortunately there is no easy way to do this. The reason other languages like JavaScript works in the same Dev environment as Unity is due to both being supported by DotNet. Python is not supported on dotnet.

However, there is a way to communicate between the applications. This still won't be one application, but rather they are just in the same folder. The way to do this is through PowerShell. Send and receive information to and from powershell using C#. PowerShell by extension can call and recieve inputs and outputs from Python.

its not an easy thing to do but it is possible.

Comment
Add comment · Show 1 · 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 cchpackers1 · Apr 02, 2019 at 04:28 PM 0
Share

I figured this wouldn't be easy, I am just looking for some leads on where to start. So in theory could I use powershell to orchestrate opening both the python script and Unity app in the order I need them to? Does powershell work on phones?

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

105 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

WebPlayer TCPClient connect C# TCPServer app in localhost, posible? 1 Answer

when i build an app bundle, my AR cam doesnt recognize the image 0 Answers

How can I receive UDP messages or similar in WebGL? 1 Answer

Unity as a simulation environment - how to delay the Update() loop while big calculation is performed 1 Answer

Unity tcp_client only working on localhost 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges