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
Finding and exporting the objects in a scene
-
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.
Ready-made: Hierarchy Exporter
-
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.
Ready-made: Hierarchy Exporter
Rendering objects to images
-
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.
Ready-made: ObjectShot
-
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.
Ready-made: ObjectShot
Loading images at runtime
-
Load a WebP image from a URL in Unity
In Unity 2022.3 through 6.0, the built-in loaders do not decode WebP, so a .webp comes back blank — download the raw bytes and hand them to a WebP decoder instead.
Ready-made: WebP for Unity
.NET
WebP in .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.
Ready-made: WebP for .NET
-
Load a WebP into a System.Drawing Bitmap or a WPF image in C#
With .NET 8–11 on the Windows 11 builds tested, System.Drawing could not read or write WebP and WPF’s WebP decoder was a Store extension, so decode to BGRA yourself.
Ready-made: WebP for .NET