Skip to content

Commit

Permalink
Add the necessary openasset callback for the system to know if we ope…
Browse files Browse the repository at this point in the history
…n the asset inside the editor. (#118)

* Added OnOpenAssetAttributeMode.Validate

* added UNITY_2021_1

* remove the shaders has they are not edited in the editor.

* Fix macro
  • Loading branch information
iTris666 authored and GitHub Enterprise committed Nov 16, 2020
1 parent 1443b7d commit 47ce7f8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion com.unity.visualeffectgraph/Editor/Inspector/VFXAssetEditor.cs
Expand Up @@ -6,7 +6,6 @@
using UnityEditor;
using UnityEngine;
using UnityEngine.VFX;
using UnityEngine.Rendering;
using UnityEditor.Callbacks;
using UnityEditor.VFX;
using UnityEditor.VFX.UI;
Expand Down Expand Up @@ -90,6 +89,20 @@ void OnPreprocessAsset()
[CanEditMultipleObjects]
class VisualEffectAssetEditor : Editor
{
#if UNITY_2021_1_OR_NEWER
[OnOpenAsset(OnOpenAssetAttributeMode.Validate)]
public static bool WillOpenInUnity(int instanceID)
{
var obj = EditorUtility.InstanceIDToObject(instanceID);
if (obj is VFXGraph || obj is VFXModel || obj is VFXUI)
return true;
else if (obj is VisualEffectAsset)
return true;
else if (obj is VisualEffectSubgraph)
return true;
return false;
}
#endif
[OnOpenAsset(1)]
public static bool OnOpenVFX(int instanceID, int line)
{
Expand Down

0 comments on commit 47ce7f8

Please sign in to comment.