I'm trying to record an action replay for the last 5 seconds. I'm building a bowling game and want to perform an action replay for when the ball strikes the pin by capturing with camera's with different angles. I'm unaware of how this thing could be done. Do i have to record a clip at run time for that and play it at the right time to display action replay? or something else?
Below is the code. Please refer to it.
Replay.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Replay : MonoBehaviour
{
public Text timertext;
public GameObject pin1;
public GameObject pin2;
public GameObject pin3;
public GameObject pin4;
public GameObject pin5;
public GameObject pin6;
public GameObject pin7;
public GameObject pin8;
public GameObject pin9;
public GameObject pin10;
static int count = 50;
Vector3 pin1po;
Vector3 pin2po;
Vector3 pin3po;
Vector3 pin4po;
Vector3 pin5po;
Vector3 pin9po;
Vector3 pin10po;
List<Vector3> PinsPosition1;
List<Vector3> PinsPosition2;
List<Vector3> PinsPosition3;
List<Vector3> PinsPosition4;
List<Vector3> PinsPosition5;
List<Vector3> PinsPosition6;
List<Vector3> PinsPosition7;
List<Vector3> PinsPosition8;
List<Vector3> PinsPosition9;
List<Vector3> PinsPosition10;
List<Quaternion> PinsRotation1;
List<Quaternion> PinsRotation2;
List<Quaternion> PinsRotation3;
List<Quaternion> PinsRotation4;
List<Quaternion> PinsRotation5;
List<Quaternion> PinsRotation6;
List<Quaternion> PinsRotation7;
List<Quaternion> PinsRotation8;
List<Quaternion> PinsRotation9;
List<Quaternion> PinsRotation10;
public static bool start;
// Use this for initialization
void Start()
{
start = false;
pin1po = new Vector3();
pin2po = new Vector3();
pin3po = new Vector3();
pin4po = new Vector3();
pin5po = new Vector3();
pin9po = new Vector3();
pin10po = new Vector3();
PinsPosition1 = new List<Vector3>();
PinsPosition2 = new List<Vector3>();
PinsPosition3 = new List<Vector3>();
PinsPosition4 = new List<Vector3>();
PinsPosition5 = new List<Vector3>();
PinsPosition6 = new List<Vector3>();
PinsPosition7 = new List<Vector3>();
PinsPosition8 = new List<Vector3>();
PinsPosition9 = new List<Vector3>();
PinsPosition10 = new List<Vector3>();
PinsRotation1 = new List<Quaternion>();
PinsRotation2 = new List<Quaternion>();
PinsRotation3 = new List<Quaternion>();
PinsRotation4 = new List<Quaternion>();
PinsRotation5 = new List<Quaternion>();
PinsRotation6 = new List<Quaternion>();
PinsRotation7 = new List<Quaternion>();
PinsRotation8 = new List<Quaternion>();
PinsRotation9 = new List<Quaternion>();
PinsRotation10 = new List<Quaternion>();
pin1po = pin1.transform.position;
pin2po = pin2.transform.position;
pin3po = pin3.transform.position;
pin4po = pin4.transform.position;
pin5po = pin5.transform.position;
pin9po = pin9.transform.position;
pin10po = pin10.transform.position;
}
public void Checktime(bool time)
{
start = time;
}
// Update is called once per frame
void Update()
{
}
private void FixedUpdate()
{
if (start == true)
{
count = count - 1;
if (count < 1)
{
PinsPosition1.Add(pin1.transform.position);
PinsRotation1.Add(pin1.transform.rotation);
PinsPosition2.Add(pin2.transform.position);
PinsRotation2.Add(pin2.transform.rotation);
PinsPosition3.Add(pin3.transform.position);
PinsRotation3.Add(pin3.transform.rotation);
PinsPosition4.Add(pin4.transform.position);
PinsRotation4.Add(pin4.transform.rotation);
PinsPosition5.Add(pin5.transform.position);
PinsRotation5.Add(pin5.transform.rotation);
PinsPosition6.Add(pin6.transform.position);
PinsRotation6.Add(pin6.transform.rotation);
PinsPosition7.Add(pin7.transform.position);
PinsRotation7.Add(pin7.transform.rotation);
PinsPosition8.Add(pin8.transform.position);
PinsRotation8.Add(pin8.transform.rotation);
PinsPosition9.Add(pin9.transform.position);
PinsRotation9.Add(pin9.transform.rotation);
PinsPosition10.Add(pin10.transform.position);
PinsRotation10.Add(pin10.transform.rotation);
}
}
if(count<-100)
{
return;
}
}
}
Thanks!