Search Unity

Plugin not properly working as standalone

Discussion in 'Editor & General Support' started by simo5951, Jul 3, 2018.

  1. simo5951

    simo5951

    Joined:
    Feb 28, 2018
    Posts:
    3
    I would like to apologize if this is not the correct section, but I wasn't sure about which was the most appropriate.

    I am currently developing a GUI connected via ROS to a robot and a camera using Unity 2018.1.0b8 on Ubuntu 16.04. My problem is the following:

    As long as I execute the project from within the Editor everything works properly: as you can see in the picture below an image from the camera is displayed and a signal is plotted.
    Screenshot from 2018-07-03 18-58-12.png
    However, when I build the project as standalone, things stop working properly: images from the camera arrives grey and the signal is not plotted anymore.
    Screenshot from 2018-07-03 19-00-04.png

    To communicate with ROS I am using a native plugin I have created in C++. Neither the log file created by the plugin nor the Player.log are showing error messages. The plugin is able to create the ROS subscribers and it seems to receive images and data. Moreover it looks like Unity tries to update the texture with something because when no images are arriving it shows a "Waiting for images" image (that is changed with the grey image).

    From within the Editor I chose to select any platform for the plugin and I have allowed unsafe code from the settings. I have no clues about the source of this problem.

    Is somehow different the way memory is managed by the Editor and the standalone version? Am I missing something?

    If you need more specific details I will be glad to provide them.

    Thanks in advance for your help
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    You mention "seems to receive images..", you would likely want to confirm using Debug.Log or otherwise debugging the flow.
     
  3. simo5951

    simo5951

    Joined:
    Feb 28, 2018
    Posts:
    3
    Jeff,

    first of all, thanks for your suggestion.
    I will try to explain how I "send" images from ROS to Unity:
    • I create a texture in Unity,
    • I pass the pointer to the texture to a C++ function inside the plugin (lets call this function update_texture_in_plugin()),
    • update_texture_in_plugin() simply updates the GL texture whenever a new image is received.
    Using Debug.Log I was able to verify that the C# function who calls update_texture_in_plugin() is called.

    In the plugin I also have a function that checks if images are arriving from ROS. Logging in C# the value it returns, I can tell that the plugin receives new images.

    However, things get even more interesting debugging the signal part (the procedure to obtain the signal values from ROS is approximately the same as for images). I have a C# class responsible for plotting signals received from ROS. In the Update function of this class I call two functions from the plugin, one to check if messages are present and one to retrieve the value it contains. Well.... everything I try to print with Debug.Log is not displayed in the standalone project: neither the returning value of the message check, nor the value contained in the message, nor a simple string to check if the update is running. I also tried to print the value received from ROS in the log file created by the plugin, but not even there things are printed. It looks like the signal part is never executed when compiled as standalone.

    NB. Everything works within the editor.

    Do you have any other suggestion or idea about what might going wrong?
     
  4. simo5951

    simo5951

    Joined:
    Feb 28, 2018
    Posts:
    3
    I am sorry for writing again, but I was not able to solve the problem yet... Any other suggestion?
     
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446