Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 DaveA · Feb 18, 2012 at 01:30 AM · pluginxcodesendmessagebundle

Can I send a message from a plugin into Unity?

I'm writing a Mac bundle plugin, which runs its own thread (is that ok?). I need to have it signal back to Unity sometimes. If only to print a string to the console ('print' is not doing it for me). Is this possible?

Comment
Add comment · Show 2
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 rabbitfang · Feb 18, 2012 at 01:32 AM 1
Share

$$anonymous$$ulti-threading is fine. Just make sure to not touch the Unity API outside of the main thread (where scripts are normally run). I would stay away from printing a string to console as that might be logged to a file and might reveal information that should not normally be revealed to the end user. You will need to use some intermediary that is thread safe and that can run Unity functions/other stuff for you.

avatar image DaveA · Feb 18, 2012 at 01:51 AM 0
Share

I'm only having to do this because XCode4 doesn't want to run Unity so I can debug my plugin. If I try to attach to a running Unity, it says it's 'running Unity' but then stops saying that. No breakpoints can be set.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Dreamora · Feb 18, 2012 at 06:56 PM

You can not attach native code debuggers to managed code and unity runs managed or more precisely mixed code.

you can only attach the debugger to players built but even then, you can not set any breakpoints, again as its not native but mixed code. But at least you get a callstack when it crashes which might give you an idea.

To debug code running in unity, use monodevelop and attach the debugger to the unity process or the player process (you need to build the player as development - remote debugging enabled)

Comment
Add comment · Show 7 · 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 DaveA · Feb 19, 2012 at 03:11 AM 0
Share

I should have mentioned, I'm building this as standalone $$anonymous$$ac (not iOS). I take it UnitySend$$anonymous$$essage is not supported except for iOS? What I'm REALLY looking for is the proper way to initialize a Cocoa class there.

avatar image Dreamora · Feb 19, 2012 at 03:24 AM 1
Share

Thats correct. Standalone builds have no way to easily or directly call back into unity at all beside accessing the $$anonymous$$ono layer itself.

Question is if you really need it at all as I don't see how initializing a class is related to call back into Unity as sendmessage can not send them through anyway.

avatar image DaveA · Feb 19, 2012 at 03:40 AM 0
Share

I'm just trying to debug my plugin, and the old examples have it using 'print' to print to the console, which it doesn't. Not having a debugger, the only thing I can think is to essentially Debug.Log all over the place. So my code doesn't work, I need to know, did it initialize, where did it fail, what does it think it's doing, all that.

avatar image DaveA · Feb 19, 2012 at 03:42 AM 0
Share

Ugg. Sick thought. I could log such things to a file. Joy.

avatar image Dreamora · Feb 19, 2012 at 03:49 AM 0
Share

For debugging the native plugin, you best drop it into another native code shell and test run it there with XCode static analysis and unit test if you want to go all out. Unity has no impact on the behavior of the plugin so this is a very simple solution :)

Show more comments

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.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

how do I make a .dll after making a .bundle? 0 Answers

How to debug your Mac bundle(Plugin) for Unity via Xcode 0 Answers

Why doesn't my bundle build for Mac OS X using Xcode 4.5? 1 Answer

iOS build is including Mac OSX .bundle files into Xcode Project 2 Answers

Undefined symbols for Unity Plugin written in C++ when compiled to XCode 0 Answers


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