Retrieve the binary only when the MuJoCo package is installed.

PiperOrigin-RevId: 461524833
Change-Id: Ie8ca9dda71b35262f99688d02f71be77c251ea3e
This commit is contained in:
Tom Erez
2022-07-17 20:47:29 -07:00
committed by Copybara-Service
parent 0180d839a9
commit e8a9db82b8
2 changed files with 30 additions and 25 deletions
@@ -30,7 +30,9 @@ public class MujocoBinaryRetriever {
static void RegisteredPackagesEventHandler( static void RegisteredPackagesEventHandler(
PackageRegistrationEventArgs packageRegistrationEventArgs) { PackageRegistrationEventArgs packageRegistrationEventArgs) {
var mujocoPath = packageRegistrationEventArgs.added[0].assetPath; foreach (var packageInfo in packageRegistrationEventArgs.added) {
if (packageInfo.name.Equals("org.mujoco")) {
var mujocoPath = packageInfo.assetPath;
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) {
if (AssetDatabase.LoadMainAssetAtPath(mujocoPath + "/mujoco.dylib") == null) { if (AssetDatabase.LoadMainAssetAtPath(mujocoPath + "/mujoco.dylib") == null) {
File.Copy( File.Copy(
@@ -59,3 +61,5 @@ public class MujocoBinaryRetriever {
} }
} }
} }
}
}
+2 -1
View File
@@ -12,5 +12,6 @@
"changelogUrl": "https://mujoco.readthedocs.io/en/latest/changelog.html", "changelogUrl": "https://mujoco.readthedocs.io/en/latest/changelog.html",
"documentationUrl": "https://mujoco.readthedocs.io/en/latest/unity.html", "documentationUrl": "https://mujoco.readthedocs.io/en/latest/unity.html",
"license": "Apache-2.0", "license": "Apache-2.0",
"licensesUrl": "https://github.com/deepmind/mujoco/blob/main/LICENSE" "licensesUrl": "https://github.com/deepmind/mujoco/blob/main/LICENSE",
"hideInEditor": false
} }