• 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 eStudent · Feb 24, 2013 at 02:09 PM · plugininitializationosc

A Unity Plugin fails randomly. I'm out of ideas...

Hallo everyone!

I am currently working on a team project at university (without software version control system for several reasons) that amongst many other things includes sending wind zone intensities via OSC messages out of Unity to real wind machines. The OSC plugin I use it called UnityOSC by Jorge Garcia.

The workflow is such that the whole project is updated by one team mate and then send as a whole to the next for further updates. This might sound very convoluted, but for this particular project is works nicely.

Expect for one thing I ran into a couple of updates back:

Sometimes (not with every project update) when I receive an updated project, even one that only has some terrain modifications done, the OSC plugin fails to initialize and says the following:

Exception: Can't create client at IP address 127.0.0.1 and port 5555. UnityOSC.OSCClient.Connect () (at Assets/OSC/OSCClient.cs:80) UnityOSC.OSCClient..ctor (System.Net.IPAddress address, Int32 port) (at Assets/OSC/OSCClient.cs:38) OSCHandler.CreateClient (System.String clientId, System.Net.IPAddress destination, Int32 port) (at Assets/OSCHandler.cs:153) OSCHandler.Init () (at Assets/OSCHandler.cs:96)

I already contacted the author of the plugin, but he couldn't help me. He suspected that Unity and not the plugin is the problem here.

I think his assumption has some merit, because this is what let's me get around the error (although it hardly is a long term solution):

  • Export the whole project as a package

  • Create a new empty project

  • Import the package

OSC Plugin works again!

Do you guys have any idea what might be causing the OSC plugin to fail and why the above mentioned workflow solves the problem? Could it be invalid meta data that gets properly updated upon importing into a new project?

I'm puzzled as to why this happens and I'm feeling deeply uncomfortable to have such an unstable part in a project that fails so unpredictably.

Your help is very much appreciated!!

Thanks a lot!

eStudent

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

5 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by WillNorval · Apr 05, 2016 at 01:30 PM

In case anyone comes across this issue in the future, a solution I found was to set the platform destination as 'PC, Mac & Linux standalone'. Initially my project was set to build for the 'web player' platform. As to why this solved the issue, I have no clue. Perhaps someone can explain?

I also encountered the 'can't connect to client' error message but that was because the client wasn't open and running.

Comment
Add comment · 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
0

Answer by yourulenl · Aug 29, 2014 at 12:09 PM

I got the same exact problem. I found the problem persists in a document in the project/Library folder. After closing the project and renaming the Library folder, it gets rebuild automatically. After this the OSC server is set up again by opening the project. It seems one of the files gets corrupted one way or another, I didn't find out which one it was exactly though.

Comment
Add comment · 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
0

Answer by Emiles · Jun 07, 2014 at 02:41 PM

I encountered an issue where by i'd called OSCHandler.Instance.Init() multiple times. This was due to putting that particular line on a behaviour that was attached to multiple objects. I then got the "can't connect to port " error.

I updated the code to the following so it was only called once. You could equally put this code in another script.

 public static OSCHandler Instance 
     {
         get 
         {
             if (_instance == null) 
             {
                 _instance = new GameObject ("OSCHandler").AddComponent<OSCHandler>();
                 _instance.Init ();
             }
             return _instance;
         }
     }
Comment
Add comment · 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
0

Answer by eStudent · Feb 25, 2013 at 12:08 AM

Thanks Graham. But no, rebooting doesn't help :( I don't think a previous client is blocking the port. I have several project versions on my PC, in some the plugin works in some it doesn't. If something is blocking a port, then even the working versions should fail to create a client. In one and the same Windows session I can do the following:

  • First open a project in which the plugin fails --> client can't be created

  • Afterwards open a project in which the plugin works --> client can be created

  • Open a project with failing plugin again --> client can't be created

That doesn't indicate a blocked port IMO.

Also when I change the script to use a different port than 5555, the plugin still fails.

Comment
Add comment · 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
0

Answer by Graham-Dunnett · Feb 24, 2013 at 08:45 PM

I've never encountered UnityOSC before. The errors you get suggest that the plugin is not able to create a network connection, which might mean that a previous run of Unity has created a client on port 5555 and for some reason that client has never terminated. I'd try a reboot and see if that sorted it. Then start to look and see if there are any apps that can tell you what network ports are in use by which apps. (Something like netstat on a Mac.). There might be an app, or process recorded as using port 5555, in which case figure out a way of ending that process, again, on a Mac I'd use kill.

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 eStudent · Feb 24, 2013 at 11:26 PM 0
Share

Thanks Graham. But no, rebooting doesn't help :( I don't think a previous client is blocking the port. I have several project versions on my PC, in some the plugin works in some it doesn't. If something is blocking a port, then even the working versions should fail to create a client. In one and the same Windows session I can do the following:

  • First open a project in which the plugin fails --> client can't be created

  • Afterwards open a project in which the plugin works --> client can be created

  • Open a project with failing plugin again --> client can't be created

That doesn't indicate a blocked port I$$anonymous$$O.

Also when I change the script to use a different port than 5555, the plugin still fails.

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

13 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

Related Questions

Initialising List array for use in a custom Editor 1 Answer

Run plug-in even if other scripts do not compile 0 Answers

How to add i-ad for android unity game? 0 Answers

Using async/await operators in a WP8 plugin 1 Answer

Android native plugin question 1 Answer


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