Skip to content

Commit

Permalink
fixed property watecher updating
Browse files Browse the repository at this point in the history
  • Loading branch information
larsolm committed Feb 27, 2020
1 parent 39f1b83 commit d3f224f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ public abstract class PropertyWatcher : BindableElement
{
public SerializedProperty Property { get; private set; }

public PropertyWatcher()
{
style.display = DisplayStyle.None;
}

public virtual void Watch(SerializedProperty property)
{
if (this.IsBound())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using UnityEditor;
using UnityEditor;
using UnityEngine.UIElements;

namespace PiRhoSoft.Utilities.Editor
Expand All @@ -10,9 +9,9 @@ public abstract class SerializedDataField<T> : PropertyWatcher<string>
private const string _referencesPropertyName = "_references";

private T _value;
private SerializedData _data;
private SerializedProperty _contentProperty;
private SerializedProperty _referencesProperty;
private readonly SerializedData _data;
private readonly SerializedProperty _contentProperty;
private readonly SerializedProperty _referencesProperty;

public SerializedDataField(SerializedProperty property, T value)
{
Expand Down Expand Up @@ -58,7 +57,7 @@ public void Extract()
public void Inject(T value)
{
_value = value;
_data.EditorContent = String.Empty;
_data.EditorContent = string.Empty;
_data.EditorReferences.Clear();

using (var writer = new SerializedDataWriter(_data))
Expand All @@ -72,6 +71,8 @@ public void Inject(T value)
_referencesProperty.GetArrayElementAtIndex(i++).objectReferenceValue = reference;

_contentProperty.serializedObject.ApplyModifiedProperties();

Update(_value);
}
}
}
20 changes: 17 additions & 3 deletions ProjectSettings/EditorSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,33 @@
--- !u!159 &1
EditorSettings:
m_ObjectHideFlags: 0
serializedVersion: 7
serializedVersion: 9
m_ExternalVersionControlSupport: Visible Meta Files
m_SerializationMode: 2
m_LineEndingsForNewScripts: 0
m_DefaultBehaviorMode: 1
m_PrefabRegularEnvironment: {fileID: 0}
m_PrefabUIEnvironment: {fileID: 0}
m_SpritePackerMode: 4
m_SpritePackerPaddingPower: 1
m_EtcTextureCompressorBehavior: 1
m_EtcTextureFastCompressor: 1
m_EtcTextureNormalCompressor: 2
m_EtcTextureBestCompressor: 4
m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd
m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmref
m_ProjectGenerationRootNamespace:
m_UserGeneratedProjectSuffix:
m_CollabEditorSettings:
inProgressEnabled: 1
m_EnableTextureStreamingInEditMode: 1
m_EnableTextureStreamingInPlayMode: 1
m_AsyncShaderCompilation: 1
m_EnterPlayModeOptionsEnabled: 0
m_EnterPlayModeOptions: 3
m_ShowLightmapResolutionOverlay: 1
m_UseLegacyProbeSampleCount: 1
m_AssetPipelineMode: 1
m_CacheServerMode: 0
m_CacheServerEndpoint:
m_CacheServerNamespacePrefix: default
m_CacheServerEnableDownload: 1
m_CacheServerEnableUpload: 1

0 comments on commit d3f224f

Please sign in to comment.