Any way to hide MonoBehaviour script in component menu?

If I make new MonoBehaviour script, script name is automatically added to Menu->Component->Script.
I want to hide some script in menu.

Is there any way to hide it just like hiding public member variable in inspector with [HideInInspector] tag?

This is a good question, and the answer is fairly straightforward:

public class MySecretBehaviour : MonoBehaviour {

    // blah...


You used to be able to hide items in the menu with [AddComponentMenu("")] but it no longer works as of version 2017. But if you use [System.Obsolete("Obsolete reason goes here")] it will mark the script as deprecated visually when added as a component.

[System.Obsolete("Use class FooBar instead")]
public class SetRandomInt {
  // Your code here

Example of deprecated component.