Skip to content

Commit 9ee25da

Browse files
PaulDemeulenaereiTris666
authored andcommitted
PropertyBinder : Minor Fixes (#29)
* Fix for binder when null asset & fix for binder while resetting * Call ClearPropertyBinders while resetting
1 parent 165c121 commit 9ee25da

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

com.unity.visualeffectgraph/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ The version number for this package has increased due to a version update of a r
111111
- Avoid NullReferenceException in Previous Position Binder" component. [Case 1242351](https://issuetracker.unity3d.com/product/unity/issues/guid/1242351/)
112112
- Don't show the blocks window when context cant have blocks
113113
- Prevent from creating a context in VisualEffectSugraphOperator by draggingfrom an output slot.
114+
- Avoid NullReferenceException when VisualEffectAsset is null if VFXPropertyBinder [Case 1219061](https://issuetracker.unity3d.com/product/unity/issues/guid/1219061/)
115+
- Missing Reset function in VFXPropertyBinder [Case 1219063](https://issuetracker.unity3d.com/product/unity/issues/guid/1219063/)
114116

115117
## [7.1.1] - 2019-09-05
116118
### Added

com.unity.visualeffectgraph/Editor/Utilities/PropertyBinding/VFXPropertyBinderEditor.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,21 @@ private class MenuPropertySetName
126126

127127
public void CheckTypeMenu(SerializedProperty property, VFXPropertyBindingAttribute attribute, VisualEffectAsset asset)
128128
{
129-
GenericMenu menu = new GenericMenu();
130-
var parameters = (asset.GetResource().graph as UnityEditor.VFX.VFXGraph).children.OfType<UnityEditor.VFX.VFXParameter>();
129+
VFXGraph graph = null;
130+
if (asset != null)
131+
{
132+
var resource = asset.GetResource();
133+
if (resource != null) //If VisualEffectGraph is store in asset bundle, we can't use this following code
134+
{
135+
graph = resource.graph as VFXGraph;
136+
}
137+
}
138+
139+
if (graph == null)
140+
return;
141+
142+
var menu = new GenericMenu();
143+
var parameters = graph.children.OfType<UnityEditor.VFX.VFXParameter>();
131144
foreach (var param in parameters)
132145
{
133146
string typeName = param.type.ToString();

com.unity.visualeffectgraph/Runtime/Utilities/PropertyBinding/VFXPropertyBinder.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ private void OnEnable()
3636
m_VisualEffect = GetComponent<VisualEffect>();
3737
}
3838

39+
private void Reset()
40+
{
41+
m_VisualEffect = GetComponent<VisualEffect>();
42+
m_Bindings = new List<VFXBinderBase>();
43+
m_Bindings.AddRange(gameObject.GetComponents<VFXBinderBase>());
44+
ClearPropertyBinders();
45+
}
46+
3947
void Update()
4048
{
4149
if (!m_ExecuteInEditor && Application.isEditor && !Application.isPlaying) return;

0 commit comments

Comments
 (0)