Clarify error messages when Unity fails to step the scene.

PiperOrigin-RevId: 527486144
Change-Id: I4e889977e035e13557c114e875ea0ba32da79002
This commit is contained in:
Tom Erez
2023-04-26 23:29:19 -07:00
committed by Copybara-Service
parent e3cdc410d6
commit 139328f86e
+12 -15
View File
@@ -62,7 +62,7 @@ public class MjScene : MonoBehaviour {
return _instance;
}
}
public static bool InstanceExists { get => _instance != null; }
public void Awake() {
@@ -178,12 +178,12 @@ public class MjScene : MonoBehaviour {
XmlDocument mjcf, IEnumerable<MjComponent> components) {
Model = MjEngineTool.LoadModelFromString(mjcf.OuterXml);
if (Model == null) {
throw new NullReferenceException("Failed to create Mujoco runtime model.");
throw new NullReferenceException("Model loading failed, see other errors for root cause.");
} else {
Data = MujocoLib.mj_makeData(Model);
}
if (Data == null) {
throw new NullReferenceException("Failed to create Mujoco runtime data.");
throw new NullReferenceException("Model loaded but mj_makeData failed.");
}
// Bind the components to their Mujoco counterparts.
@@ -472,18 +472,15 @@ public class MjScene : MonoBehaviour {
Debug.LogWarning("Failed to save Xml to a file: " + ex.ToString(), this);
}
}
}
public class MjStepArgs : EventArgs
{
public unsafe MjStepArgs(MujocoLib.mjModel_* model, MujocoLib.mjData_* data){
this.model = model;
this.data = data;
}
public readonly unsafe MujocoLib.mjModel_* model;
public readonly unsafe MujocoLib.mjData_* data;
public class MjStepArgs : EventArgs
{
public unsafe MjStepArgs(MujocoLib.mjModel_* model, MujocoLib.mjData_* data){
this.model = model;
this.data = data;
}
}
public readonly unsafe MujocoLib.mjModel_* model;
public readonly unsafe MujocoLib.mjData_* data;
}
}