LoginSignup
4
5

More than 5 years have passed since last update.

コマンドラインからbatchmodeでレンダリング結果を出力したい

Posted at

Unity2017.1.0f3

https://github.com/Unity-Technologies/GenericFrameRecorder
↑これとffmpeg使って動画にしていたのですが、
Jenkins先生に動画にしてもらおうと思うとちょっと困ります。

https://docs.unity3d.com/jp/530/Manual/CommandLineArguments.html
例によってコマンドラインからUnity起動して云々なんですが、
-batchmodeにするとGameViewがそもそもないのです。

で、GenericFrameRecorderにも採用されてるよく見るコードに一工夫。
GameViewがなかったら作ればいいじゃない。

        public static EditorWindow GetMainGameView()
        {
            System.Type T = System.Type.GetType("UnityEditor.GameView,UnityEditor");
            System.Reflection.MethodInfo GetMainGameView = T.GetMethod("GetMainGameView", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
            System.Object Res = GetMainGameView.Invoke(null, null);
            if(Res == null)Res = EditorWindow.GetWindow(T);
            return (EditorWindow)Res;
        }

if(Res == null)Res = EditorWindow.GetWindow(T);
を追加しました。

あとWindowsのJenkinsは素の設定のままだとGUIアプリケーションが使えず、DirectXのあたりでこけてたので対処しました。
以下参考
http://toshimana.hatenablog.com/entry/2014/07/05/095613

4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5