Find MjScene at OnEnable: ensure MuJoCo compilation happens only once at startup.
PiperOrigin-RevId: 498655077 Change-Id: Ibed8f36a880426063b7729fc66b15c67adcc9a65
This commit is contained in:
committed by
Copybara-Service
parent
f78ebeab96
commit
eb8389fead
@@ -49,8 +49,7 @@ namespace Mujoco {
|
||||
DofAddress = model->jnt_dofadr[MujocoId];
|
||||
}
|
||||
|
||||
protected override void Start() {
|
||||
base.Start();
|
||||
protected void Start() {
|
||||
MjBaseBody grandparentBody, parentBody;
|
||||
GetConnectedBodies(out grandparentBody, out parentBody);
|
||||
GrandParentBody = grandparentBody;
|
||||
|
||||
@@ -77,7 +77,7 @@ public abstract class MjComponent : MonoBehaviour {
|
||||
|
||||
private bool _sceneExcludesMe = false;
|
||||
|
||||
protected unsafe virtual void Start() {
|
||||
protected unsafe virtual void OnEnable() {
|
||||
if (MjScene.Instance == null) {
|
||||
throw new Exception("MuJoCo Scene not found");
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ public class MjScene : MonoBehaviour {
|
||||
public EventHandler<MjStepArgs> preDestroyEvent;
|
||||
|
||||
protected unsafe void Start() {
|
||||
SceneRecreationAtLateUpdateRequested = false;
|
||||
CreateScene();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user