ros2-for-unity
ros2-for-unity copied to clipboard
Release 1.2.0 did not work on my PC
Describe the bug 1.2.0 does not seem to work for me on Linux 22.04 and Unity 2021.3.2 (LTS). It looks like it was an overlay release so I installed humble using apt-get on my computer and started the editor from a terminal where I already sourced ROS2 humble.
To Reproduce Steps to reproduce the behavior:
- Start with a computer with Ubuntu 22.04
- Make a fresh project in Unity 2021.3.2
- Download Ros2ForUnity_humble_ubuntu2204.zip
- Open a terminal and run
source /opt/ros/humble/setup.bash - Open the Unity editor in the same terminal by writing, for example,
Unity/Hub/Editor/2021.3.20f1/Editor - Add a ROS2 Unity Component script to an emtpy GameObject.
Expected behavior No errors
Screenshots

Desktop (please complete the following information):
- OS: Ubuntu22.04, Windows 10
- ros2 distro humble
- ros2-for-unity version 1.2.0
- ros2cs version ?
- ros2 dds middleware fastdds
- ros2 environment setup single pc
Can you verify that the ROS_DISTRO is set to humble and the /opt/ros/humble/lib is in LD_LIBRARY_PATH after sourcing the ROS 2?
env | grep ROS_DISTRO
env | grep LD_LIBRARY_PATH
sam@sam-blade:~$ env | grep ROS_DISTRO
ROS_DISTRO=humble
sam@sam-blade:~$ env | grep LD_LIBRARY_PATH
LD_LIBRARY_PATH=/opt/ros/humble/opt/rviz_ogre_vendor/lib:/opt/ros/humble/lib/x86_64-linux-gnu:/opt/ros/humble/lib
How did you import the .zip package to unity? I tried to renaming it .unitypackage but got an error for couldn't decompress. I tried decompressing the zip and drag the two folders into an empty project still doesn't seem to work.
Edit: Actually nvm I figured it out but I am also have the same problem as @samiamlabs with ros2 humble
As a quick solution, you might look for the check that outputs this message and disable the check. If the check is invalid and not a symptom of some mismatch, this should be enough. We will be looking into it next week.
As @adamdbrw mentioned, try to check the versions which are detected by Ros2ForUnity by adding debug log to Ros2ForUnity/Scripts/ROS2ForUnity.cs somewhere in the if statement in line 180:
Debug.Log("Sourced: " + ros2SourcedCodename + ". From metadata: " + ros2FromRos2csMetadata);
Logged ROS 2 versions should be the same and not empty. If it is not the case, then there might be an issue with path resolution.
Can you also make sure that Ros2ForUnity folder lives inside project Assets?:
Assets/
└── Ros2ForUnity
├── Plugins
│ └── Linux
│ └── x86_64
└── Scripts
└── Time
Same happened with me then I tried running the Unity from terminal as shown below and it worked.
https://github.com/RobotecAI/ros2-for-unity/issues/32#issuecomment-1023981776