Answers
Worked answers to specific Unity and .NET problems — the ones that cost an afternoon the first time. Each gives you C# you can paste into a project, shows the output it really produces, and says which versions it applies to.
Unity
-
Get all GameObjects in a Unity scene, including inactive ones
Unity’s find methods skip inactive GameObjects unless you ask for them: pass FindObjectsInactive.Include, or walk the scene’s roots yourself.
-
Dump a Unity scene hierarchy to a text file
Walk the scene’s root GameObjects, build an indented string as you recurse, and write it with File.WriteAllText from an editor script — no Play mode needed.
-
Generate item icons from prefabs in Unity
Render each prefab with a throwaway camera that culls everything except the prefab, read the RenderTexture back, and write it out with EncodeToPNG.
-
Save a GameObject or prefab as a transparent PNG in Unity
Render it with a camera that clears to Color.clear, into an ARGB32 RenderTexture, then read it back as RGBA32 and save it with EncodeToPNG.
-
Load a WebP image from a URL in Unity
Unity’s built-in loaders decode PNG, JPG and EXR only, so a .webp comes back blank — download the raw bytes and hand them to a WebP decoder instead.
.NET
-
Convert WebP to PNG or JPEG, and back, in C#
Decode the WebP to raw pixels with a WebP codec and write them with a PNG or JPEG encoder; to go the other way, read the image to pixels and encode those as WebP.
-
Load a WebP into a System.Drawing Bitmap or a WPF image in C#
System.Drawing cannot read or write WebP, and WPF reads it only when a Microsoft Store extension is installed, so decode the file to BGRA pixels yourself.