3 namespace UnityEngine
.Experimental
.Rendering
5 public static class DelegateUtility
7 public static Delegate
Cast(Delegate source
, Type type
)
11 Delegate
[] delegates
= source
.GetInvocationList();
12 if (delegates
.Length
== 1)
13 return Delegate
.CreateDelegate(type
,
14 delegates
[0].Target
, delegates
[0].Method
);
15 Delegate
[] delegatesDest
= new Delegate
[delegates
.Length
];
16 for (int nDelegate
= 0; nDelegate
< delegates
.Length
; nDelegate
++)
17 delegatesDest
[nDelegate
] = Delegate
.CreateDelegate(type
,
18 delegates
[nDelegate
].Target
, delegates
[nDelegate
].Method
);
19 return Delegate
.Combine(delegatesDest
);