System Extensions
System.Action
HasInvocation
if (action.HasInvocation()) {
...
}
// => alias of
if (action.GetInvocationList().Length > 0) {
...
}
System.Func
HasInvocation
if (func.HasInvocation()) {
...
}
// => alias of
if (func.GetInvocationList().Length > 0) {
...
}
Matrix4x4
Casts
System.Numerics.Matrix4x4
<-> UnityEngine.Matrix4x4
var sysMat = new System.Numerics.Matrix4x4();
var uniMat = sysMat.ToUnity();
//--
var uniMat = new UnityEngine.Matrix4x4();
var sysMat = uniMat.ToSystem();
IO
DirectoryInfo:GetFilesRecursively
Likes directory.GetFiles()
but recursively.
DirectoryInfo:CopyTo
Copy a directory content to another recursively.
Stream:ReadAllBytes
Read all bytes in a stream.
// example from TextureUtility, open an embedded texture
icon = new Texture2D(128, 128);
...
using(var stream = assembly.GetManifestResourceStream(path)) {
if (stream != null) {
icon.LoadImage(stream.ReadAllBytes());
...
}
}