Snippet: simple Unity comment component

I put this together a while ago. Maybe you’ll find it useful.


Unity label selection dropdown Unity label selection dropdown

  • Single script, plug-and-play.
  • Double-click the text area to edit.


Either paste the script below into your project, or install it as a package via the Unity Package Manager using this URL:0



  • During build, the [PostProcessScene] callback removes instances of the component from your scenes.
  • Since we can’t remove the entire component from prefabs at build time1, the ISerializationCallbackReceiver callback clears the comment content.
  • You can even use it with ECS since the component won’t be baked at all.
  1. Yes, you can install packages straight from GitHub Gists (if they’re set up with a package.json and an .asmdef). I’m as surprised as you are that this actually works, but Gists are built on top of regular Git repositories, so it makes sense. return ︿

  2. I looked, but couldn’t find any way to do this. If I recall correctly, deleting the component during serialization results in an error. I wish we had [PostProcessPrefab] or something… return ︿