Search Unity

How to use UnitySendMessage in tizen.

Discussion in 'Tizen' started by Rohit_Sijwali, Sep 24, 2015.

  1. Rohit_Sijwali

    Rohit_Sijwali

    Joined:
    Aug 17, 2015
    Posts:
    30
    How can i use UnitySendMessage in tizen.What header file i have to include.How to link to that function.
     
  2. Masterfalcon

    Masterfalcon

    Unity Technologies

    Joined:
    Dec 29, 2014
    Posts:
    364
  3. Rohit_Sijwali

    Rohit_Sijwali

    Joined:
    Aug 17, 2015
    Posts:
    30
    I have declared UnitySendMessage in a header file in tizen native as
    void UnitySendMessage(char *gameObject,char *methodName, char *message);
    But while calling this method this is giving me linking error.
     
  4. Masterfalcon

    Masterfalcon

    Unity Technologies

    Joined:
    Dec 29, 2014
    Posts:
    364
    The prototype for UnitySendMessage should be

    void UnitySendMessage(const char *gameObject, const char *methodName, const char *message);

    See if that makes a difference.
     
  5. Rohit_Sijwali

    Rohit_Sijwali

    Joined:
    Aug 17, 2015
    Posts:
    30
    Its not the compiling error its linking error. It doesnt make any difference.
     
  6. Masterfalcon

    Masterfalcon

    Unity Technologies

    Joined:
    Dec 29, 2014
    Posts:
    364
    When are you getting this linking error? Could you post some logs? And with which version of Unity?
     
  7. Rohit_Sijwali

    Rohit_Sijwali

    Joined:
    Aug 17, 2015
    Posts:
    30
    Actually the linking error is in building the shared library in Tizen IDE,
     
  8. Masterfalcon

    Masterfalcon

    Unity Technologies

    Joined:
    Dec 29, 2014
    Posts:
    364
    Oh, that is a very different situation. Here is an example project of a very simple dynamic library that includes UnitySendMessage for the Tizen IDE. https://oc.unity3d.com/index.php/s/Q9JOKmB2NCxDam3
     
  9. Rohit_Sijwali

    Rohit_Sijwali

    Joined:
    Aug 17, 2015
    Posts:
    30
    Thanks for the project. But there is no UnitySendMessage. I am able to create dynamic library, but for callback i want to implement UnitySendMessage.
     
  10. Masterfalcon

    Masterfalcon

    Unity Technologies

    Joined:
    Dec 29, 2014
    Posts:
    364
    Ok, so here is the issue.

    At some time in the past the linker flag -Wl,--no-undefined was added by default to shared library projects. You cannot disable it. Because of this you must define all functions in the library. So until we find a workaround it seems that UnitySendMessage will not work in Unity plugins.
     
  11. Masterfalcon

    Masterfalcon

    Unity Technologies

    Joined:
    Dec 29, 2014
    Posts:
    364
    Just thought of one option. You compile a library from the command line. From there you can control the compile and link options.
     
  12. Rohit_Sijwali

    Rohit_Sijwali

    Joined:
    Aug 17, 2015
    Posts:
    30
    Can you give me a sample.
     
  13. Masterfalcon

    Masterfalcon

    Unity Technologies

    Joined:
    Dec 29, 2014
    Posts:
    364
    Of a Makefile? I don't have one at the moment but you can find thousands of examples and documentation about them online.
     
  14. Rohit_Sijwali

    Rohit_Sijwali

    Joined:
    Aug 17, 2015
    Posts:
    30
    I want a example project of a very simple dynamic library which include UnitySendMessage for the Tizen IDE.
     
  15. Masterfalcon

    Masterfalcon

    Unity Technologies

    Joined:
    Dec 29, 2014
    Posts:
    364
    Unfortunately at this time you cannot create a Tizen IDE dynamic library project that will build when using UnitySendMessage.

    As I said before, this is due to the default linker flags in the IDE that cannot be changed. I have spoken to Samsung about this and they are investigating.

    For now your only option is to compile and link your library from the command line.
     
  16. Rohit_Sijwali

    Rohit_Sijwali

    Joined:
    Aug 17, 2015
    Posts:
    30
    I have removed -Wl,--no-undefined option and compile it through command line. But i cannot get callback in unity by calling
    UnitySendMessage.
     
  17. Masterfalcon

    Masterfalcon

    Unity Technologies

    Joined:
    Dec 29, 2014
    Posts:
    364
    Do you get any errors in the log?
     
  18. Rohit_Sijwali

    Rohit_Sijwali

    Joined:
    Aug 17, 2015
    Posts:
    30
    Ok sorry its working. I think i give wrong gameObjectname.
     
  19. nicolasjr

    nicolasjr

    Joined:
    Mar 12, 2014
    Posts:
    11
    hey Rohit, can you share what commands you used to change the linking flags?
     
  20. Rohit_Sijwali

    Rohit_Sijwali

    Joined:
    Aug 17, 2015
    Posts:
    30
    I have created a makefile.txt which includes all the environmental variable.I m sharing it with you. I have included this makefile.txt in makefile and removed "-Wl,--no-undefined" option in this makefile. To create makefile.txt you need to go to project ->properties->C/C++ Build->Environment and copy paste all the environment variable. You can then build the makefile.
     

    Attached Files:

  21. Rohit_Sijwali

    Rohit_Sijwali

    Joined:
    Aug 17, 2015
    Posts:
    30
    To use the UnitySendMessage just declare it on the header file as
    void UnitySendMessage(char *gameObject,char *methodname,char *messageToSend);

    The makefile i m talking about is same as in release folder.