RobotecAI / ros2-for-unity

High-performance ROS2 solution for Unity3D
Apache License 2.0
448 stars 58 forks source link

Fix PostInstall.cs for Cross Building #60

Closed ynyBonfennil closed 1 year ago

ynyBonfennil commented 1 year ago

Since I had a trouble cross-building an unity application which uses ros2-for-unity, I've created a pull request.

When using Unity editor of Linux machine and trying to build a Windows application, metadata_ros2cs.xml will be copied to _Data/Plugins/ directory (which is written in PostInstall.cs).

However, when running the built application on Windows machine, ros2-for-unity tries to load metadata_ros2cs.xml from _Data/Plugins/x86_64 directory (which is written in ROS2ForUnity.cs), and it fails to load the xml file and the app will crash.

To solve this problem, I've fixed the PostInstall.cs to check target platform instead of the current OS.