One cube, with a rigidbody and two scripts attached:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoveRigidbodyDown : MonoBehaviour
{
Rigidbody _rb;
// Start is called before the first frame update
void Start()
{
_rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void FixedUpdate()
{
_rb.MovePosition(_rb.position + Vector3.up * -1);
}
}
and
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoveRigidbodyUp : MonoBehaviour
using UnityEngine;
public class MoveRigidbodyUp : MonoBehaviour
{
Rigidbody _rb;
// Start is called before the first frame update
void Start()
{
_rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void FixedUpdate()
{
_rb.MovePosition(_rb.position + Vector3.up * 1);
}
}
The result:
68aar
I would expect the cube to get moved up and then down, or down and then up, depending on script order - therefore leaving the cube where it is. But I’m finding that whichever script is executed last (out of these two) gets executed and the other one seems to get ignored. Am I missing some crucial aspect of this function?
(It was happening in both 2019.2 + 2019.3 beta)