FastScriptReload
FastScriptReload copied to clipboard
Allow user to optionally do Unity full recompile on hot reload compilation failure
This should be opt in from the menu (for automatic workflow)
FastScriptReload.Editor.FastScriptReloadManager.TriggerReloadForChangedFiles - is executing compilation and marking down DynamicFileHotReloadState for changed files, it makes sense to add additional full-reload logic in here.
As for only executing when user opted in, PlayerPrefs can be added to
FastScriptReload.Editor.FastScriptReloadPreference
as boolean, eg
public static readonly ToggleProjectEditorPreferenceDefinition EnableExperimentalThisCallLimitationFix = new ToggleProjectEditorPreferenceDefinition("(Experimental) Enable method calls with 'this' as argument fix", "EnableExperimentalThisCallLimitationFix", true)
then rendering that in options screen can be achieved by adjusting FastScriptReload.Editor.FastScriptReloadWelcomeScreen.CreateLeftSections
and perhaps adding additonal options to 'Reload' screen, like so
new GuiSection("Options", new List<ClickableElement>
{
new ChangeMainViewButton("Reload", (screen) =>
{
const int sectionBreakHeight = 15;
GUILayout.Label(
@"Asset watches all script files and automatically hot-reloads on change, you can disable that behaviour and reload on demand.",
screen.TextStyle
);
using (LayoutHelper.LabelWidth(320))
{
ProductPreferenceBase.RenderGuiAndPersistInput(FastScriptReloadPreference.EnableAutoReloadForChangedFiles);
}
GUILayout.Space(sectionBreakHeight);
//TODO: add at correct place
...