Skip to content

Commit d8ad824

Browse files
PaulDemeulenaerejulienf-unity
authored andcommitted
PropertyBinder : Minor Fixes #29
1 parent f4e38ea commit d8ad824

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
@@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
88
### Fixed
99
- Prevent from creating a context in VisualEffectSugraphOperator by draggingfrom an output slot.
1010
- Don't show the blocks window when context cant have blocks
11+
- Avoid NullReferenceException when VisualEffectAsset is null if VFXPropertyBinder [Case 1219061](https://issuetracker.unity3d.com/product/unity/issues/guid/1219061/)
12+
- Missing Reset function in VFXPropertyBinder [Case 1219063](https://issuetracker.unity3d.com/product/unity/issues/guid/1219063/)
1113

1214
## [7.5.0] - 2020-06-08
1315

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)