Skip to content

Commit 22a1262

Browse files
JustinasPlEvergreen
authored andcommitted
Scripting/deprecate forbidden api pt1
1 parent f76abc1 commit 22a1262

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

Packages/com.unity.shadergraph/Editor/Data/Graphs/Vector1ShaderProperty.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
using System.Globalization;
44
using UnityEditor.Graphing;
55
using UnityEngine;
6-
6+
#if UNITY_6000_5_OR_NEWER // LifeCycle API is available from here
7+
using UnityEngine.Assemblies;
8+
#endif
79
namespace UnityEditor.ShaderGraph.Internal
810
{
911
[Serializable]
@@ -173,7 +175,11 @@ internal static Type GetEnumHelper(string typeName)
173175

174176
var type = Type.GetType(typeName, false, true);
175177
if (type != null) return type;
178+
#if UNITY_6000_5_OR_NEWER // LifeCycle API is available from here
179+
foreach (var a in CurrentAssemblies.GetLoadedAssemblies())
180+
#else
176181
foreach (var a in AppDomain.CurrentDomain.GetAssemblies())
182+
#endif
177183
{
178184
type = a.GetType(typeName, false, true);
179185
if (type != null && type.IsEnum)

Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Editor/ShaderGraphParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ private static Dictionary<string, int> CreateNodeDictionary()
112112
{
113113
// CORECLR_FIXME - Replace Assembly.LoadFile below with CurrentAssemblies.LoadFromPath once method is public (SCP-1544)
114114
// Non-asmdef way
115-
Assembly sga = Assembly.LoadFile(UnityEngine.Application.dataPath + "/../Library/ScriptAssemblies/Unity.ShaderGraph.Editor.dll");
115+
Assembly sga = CurrentAssemblies.LoadFromPath(UnityEngine.Application.dataPath + "/../Library/ScriptAssemblies/Unity.ShaderGraph.Editor.dll");
116116
Type abstractMatNode = sga.GetType("UnityEditor.ShaderGraph.AbstractMaterialNode");
117117
Type masterNodeType = sga.GetType("UnityEditor.ShaderGraph.IMasterNode");
118118
List<Type> types = sga.GetTypes()

0 commit comments

Comments
 (0)