コガネブログ

平日更新を目標に Unity や C#、Visual Studio、ReSharper などのゲーム開発アレコレを書いていきます

【Unity】ゲームをリプレイ再生できる「InGameReplay」紹介

はじめに

「InGameReplay」を Unity プロジェクトに導入することで
ゲームをリプレイ再生できるようになります

使用例

f:id:baba_s:20180115192724g:plain

使い方

f:id:baba_s:20180115193253p:plain

「REPLAY」プレハブをシーンに配置します

f:id:baba_s:20180115193623p:plain

また、リプレイ再生したいオブジェクトに
「Replay Entity」コンポーネントをアタッチします

// Use this for initialization
void Start ()
{
    // This line call the replay to start after 3 seconds. You can remove this line and call StartReplay when you want.
    Invoke ("StartReplay", 3f);

そして、デフォルトではゲームを開始して3秒後に
リプレイの再生が始まってしまうため、
ReplayManager.cs の88行目の Invoke ("StartReplay", 3f); を削除します

最後に、リプレイを再生したいタイミングで
ReplayManager.StartReplay を実行することで使用できます

関連記事