Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 758e4c2

Browse files
newproject: add forceDX11 checkbox (fixes #182)
1 parent 9bde3e2 commit 758e4c2

File tree

4 files changed

+24
-10
lines changed

4 files changed

+24
-10
lines changed

‎UnityLauncherPro/MainWindow.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2124,7 +2124,7 @@ void CreateNewEmptyProject(string targetFolder = null)
21242124
Console.WriteLine("Create project " + NewProject.newVersion + " : " + rootFolder);
21252125
if (string.IsNullOrEmpty(rootFolder)) return;
21262126

2127-
var p = Tools.FastCreateProject(NewProject.newVersion, rootFolder, NewProject.newProjectName, NewProject.templateZipPath, NewProject.platformsForThisUnity, NewProject.selectedPlatform, (bool)chkUseInitScript.IsChecked, initScriptFileFullPath);
2127+
var p = Tools.FastCreateProject(NewProject.newVersion, rootFolder, NewProject.newProjectName, NewProject.templateZipPath, NewProject.platformsForThisUnity, NewProject.selectedPlatform, (bool)chkUseInitScript.IsChecked, initScriptFileFullPath,NewProject.forceDX11);
21282128

21292129
// add to list (just in case new project fails to start, then folder is already generated..)
21302130
if (p != null) AddNewProjectToList(p);

‎UnityLauncherPro/NewProject.xaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
xmlns:local="clr-namespace:UnityLauncherPro"
77
mc:Ignorable="d"
8-
Title="Create New Project" Height="480" Width="450" Background="{DynamicResource ThemeDarkestBackground}" PreviewKeyDown="Window_PreviewKeyDown" ResizeMode="NoResize" WindowStartupLocation="CenterOwner" ShowInTaskbar="True">
8+
Title="Create New Project" Height="480" Width="500" Background="{DynamicResource ThemeDarkestBackground}" PreviewKeyDown="Window_PreviewKeyDown" ResizeMode="NoResize" WindowStartupLocation="CenterOwner" ShowInTaskbar="True">
99

1010
<Grid>
1111
<StackPanel Margin="10,3">
@@ -20,24 +20,28 @@
2020

2121
<Grid HorizontalAlignment="Stretch" Margin="0,3,0,0">
2222
<Grid.ColumnDefinitions>
23-
<ColumnDefinition Width="40*"/>
24-
<ColumnDefinition Width="20*"/>
25-
<ColumnDefinition Width="40*"/>
23+
<ColumnDefinition Width="35*"/>
24+
<ColumnDefinition Width="15*"/>
25+
<ColumnDefinition Width="22*"/>
26+
<ColumnDefinition Width="10*"/>
2627
</Grid.ColumnDefinitions>
2728
<Label x:Name="lblNewProjectNameLabel" Grid.Column="0" Content="Project Name:" Foreground="{DynamicResource ThemeButtonForeground}" Margin="0" Padding="0,5,5,0" />
2829
<Label Grid.Column="1" Content="Platform:" Foreground="{DynamicResource ThemeButtonForeground}" Margin="0" Padding="0,5,0,0" />
2930
<Label x:Name="lblTemplateTitleAndCount" Grid.Column="2" Content="Templates:" Foreground="{DynamicResource ThemeButtonForeground}" Margin="0" Padding="5,5,5,0" />
31+
<Label Content="Override" Grid.Column="3" Foreground="{DynamicResource ThemeButtonForeground}" Margin="0" Padding="0,5,0,0"/>
3032
</Grid>
3133

3234
<Grid HorizontalAlignment="Stretch" Margin="0,3,0,0">
3335
<Grid.ColumnDefinitions>
34-
<ColumnDefinition Width="40*"/>
35-
<ColumnDefinition Width="20*"/>
36-
<ColumnDefinition Width="40*"/>
36+
<ColumnDefinition Width="35*"/>
37+
<ColumnDefinition Width="15*"/>
38+
<ColumnDefinition Width="22*"/>
39+
<ColumnDefinition Width="10*"/>
3740
</Grid.ColumnDefinitions>
3841
<TextBox Grid.Column="0" x:Name="txtNewProjectName" VerticalAlignment="Center" IsUndoEnabled="True" TextChanged="TxtNewProjectName_TextChanged" PreviewKeyDown="TxtNewProjectName_PreviewKeyDown" TabIndex="0" Margin="0,2,6,2" />
3942
<ComboBox Grid.Column="1" x:Name="cmbNewProjectPlatform" SelectedIndex="0" Margin="0,0,0,0" TabIndex="2" DropDownOpened="CmbNewProjectPlatform_DropDownOpened" />
4043
<ComboBox Grid.Column="2" x:Name="cmbNewProjectTemplate" DisplayMemberPath="Key" SelectedIndex="0" Margin="6,0,0,0" TabIndex="2" DropDownOpened="CmbNewProjectTemplate_DropDownOpened" />
44+
<CheckBox Grid.Column="3" x:Name="chkForceDX11" Content="DX11" ToolTip="Use DX11 instead of DX12" Margin="6,0,0,0" IsChecked="True" Checked="chkForceDX11_Checked" Unchecked="chkForceDX11_Checked"/>
4145
</Grid>
4246

4347
<Label x:Name="lblNewProjectFolder" Content="(folder)" Foreground="{DynamicResource ThemeButtonForegroundDisabled}" Margin="0" FontSize="10" Padding="5,0,5,3" />

‎UnityLauncherPro/NewProject.xaml.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public partial class NewProject : Window
1515
public static string newName = null;
1616
public static string templateZipPath = null;
1717
public static string selectedPlatform = null;
18+
public static bool forceDX11 = false;
1819
public static string[] platformsForThisUnity = null;
1920

2021
bool isInitializing = true; // to keep OnChangeEvent from firing too early
@@ -289,6 +290,10 @@ private void GridAvailableVersions_SelectionChanged(object sender, SelectionChan
289290
// update templates list for selected unity version
290291
UpdateTemplatesDropDown(k.Path);
291292
UpdateModulesDropdown(k.Version);
293+
294+
// hide forceDX11 checkbox if version is below 6000
295+
bool is6000 = k.Version.Contains("6000");
296+
chkForceDX11.Visibility = is6000 ? Visibility.Visible : Visibility.Collapsed;
292297
}
293298

294299
private void GridAvailableVersions_Loaded(object sender, RoutedEventArgs e)
@@ -323,5 +328,10 @@ private void gridAvailableVersions_PreviewMouseDoubleClick(object sender, MouseB
323328
BtnCreateNewProject_Click(null, null);
324329
}
325330
}
331+
332+
private void chkForceDX11_Checked(object sender, RoutedEventArgs e)
333+
{
334+
forceDX11 = chkForceDX11.IsChecked == true;
335+
}
326336
}
327337
}

‎UnityLauncherPro/Tools.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,7 +1630,7 @@ public static string BrowseForOutputFolder(string title, string initialDirectory
16301630
}
16311631

16321632
// TODO too many params..
1633-
public static Project FastCreateProject(string version, string baseFolder, string projectName = null, string templateZipPath = null, string[] platformsForThisUnity = null, string platform = null, bool useInitScript = false, string initScriptPath = null)
1633+
public static Project FastCreateProject(string version, string baseFolder, string projectName = null, string templateZipPath = null, string[] platformsForThisUnity = null, string platform = null, bool useInitScript = false, string initScriptPath = null,boolforceDX11=false)
16341634
{
16351635
// check for base folders in settings tab
16361636
if (string.IsNullOrEmpty(baseFolder) == true)
@@ -1694,7 +1694,7 @@ public static Project FastCreateProject(string version, string baseFolder, strin
16941694
proj.TargetPlatform = platform;
16951695
proj.Modified = DateTime.Now;
16961696
proj.folderExists = true; // have to set this value, so item is green on list
1697-
1697+
proj.Arguments=version.Contains("6000")?(forceDX11?"-force-d3d11":null):null;// this gets erased later, since its not saved? would be nice to not add it at all though
16981698
var proc = LaunchProject(proj, null, useInitScript);
16991699
ProcessHandler.Add(proj, proc);
17001700

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /