1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Unity BuildPlayerOptions.extraScriptingDefinesの使用

Posted at

Unity 2022.1からビルド中にsymbolの変更ができなくりました。

PlayerSettings.SetScriptingDefineSymbolsForGroup()を使った場合、ビルドが失敗します。

今回はunity2022.3 から追加されたBuildPlayerOptions.extraScriptingDefinesを使用する例を紹介します。
これでビルド中にsymbolの追加することができるようになりました。

var opt = new BuildPlayerOptions();
opt.scenes = EditorBuildSettings.scenes.Where(scene => scene.enabled).Select(scene => scene.path).ToArray();
opt.locationPathName = path;
opt.target = target;
opt.targetGroup = group;
#if UNITY_2022_1_OR_NEWER
opt.extraScriptingDefines = BuildProcesser.ExtraScriptingDefines;
#endif

var report = BuildPipeline.BuildPlayer(opt);


1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?