Skip to content

Commit

Permalink
chore(config): make ApplyOnPlay non-persistent (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdunderscore committed Oct 15, 2023
1 parent 753319d commit 2d0357f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

### Fixed
- Fixed an issue where apply on play might not work when multiple scenes are open (#61)

### Changed

- Make Apply on Play non-persistent, as users seem to frequently have issues with it left turned off.

### Removed

### Security
Expand Down
14 changes: 9 additions & 5 deletions Editor/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,29 @@

using System;
using UnityEditor;
using UnityEngine;

#endregion

namespace nadena.dev.ndmf.config
{
public static class Config
internal class NonPersistentConfig : ScriptableSingleton<NonPersistentConfig>
{
// Preserve apply-on-play config from pre-1.8 versions of Modular Avatar
private const string PREFKEY_APPLY_ON_PLAY = "nadena.dev.modular-avatar.applyOnPlay";
[SerializeField] public bool applyOnPlay = true;
}


public static class Config
{
/// <summary>
/// Controls whether NDMF transformations will be applied at play time.
/// </summary>
public static bool ApplyOnPlay
{
get => EditorPrefs.GetBool(PREFKEY_APPLY_ON_PLAY, true);
get => NonPersistentConfig.instance.applyOnPlay;
set
{
EditorPrefs.SetBool(PREFKEY_APPLY_ON_PLAY, value);
NonPersistentConfig.instance.applyOnPlay = value;
NotifyChange();
}
}
Expand Down

0 comments on commit 2d0357f

Please sign in to comment.