Test method (Same as with previous post):
Just put a particle system on a transform that’s being animated by a predefined animation and then procedurally overridden in a LateUpdate(), you’ll see the horror!
Just for anyone else who comes across this problem. I have almost a solution, the only trouble is it is 1 frame delayed. This is much better than being in the completely wrong place though. Anyway, just attach this to your particle effect and set the target as where you want it to be.
using UnityEngine;
using System.Collections;
public class FollowLastFramesLateUpdate : MonoBehaviour {
public Transform target;
// Use this for initialization
void Start () {
if(target==null) {
enabled=false;
return;
}
transform.parent = null;
}
Vector3 lastFramePos;
Quaternion lastFrameRot;
// Update is called once per frame
void Update () {
transform.position = lastFramePos;
transform.rotation = lastFrameRot;
}
void LateUpdate(){
if(target==null) {
Destroy(gameObject);
return;
}
lastFramePos = target.position;
lastFrameRot = target.rotation;
}
}
You may have to set this script to be called after default in the script execution order.