Is there a way to check whether I have used any undocumented functions in my project?

Most of us know that undocumented functions are subject to being changed/removed in future versions, and are for that reason to be used with caution.

However, programs like Visual Studio and Monodevelop provide Intellisense and auto-complete features which make it very easy to accidentally use deprecated and undocumented features without realising it, and with version 3.0 of Unity on the horizon, it could be that some of these functions are changed or removed soon.

For this reason, I wonder if there is a way that we can automatically check whether our projects use any undocumented or deprecated functions. If there is no way currently, I wonder if Unity Technologies would be so kind as to provide one!

When you're using Visual Studio or MonoDevelop, there's actually a very nice way - but you have to pay attention to it while coding (it doesn't work as automated process afterwards):

Use the IDE Documentation - and whenever you use a Unity API method that does not have documentation - which you will see in the tooltip when documentation is missing ... watch out. You might still check back with Unity's API documentation in such cases to be totally sure (maybe it's just not properly documented but included in the API documentation). But if the tooltip shows documentation, you know for sure that you're on safe grounds.

I'm pretty sure it would be possible to create an automated approach based on the XML-documentations, too. That would work by using introspection and comparing each call to a method in the code with the existing API. That's not trivial to implement, though ... might be easier to just wait for the time when such an undocumented feature is removed; then the compiler will tell you what the problem is and you can (hopefully) easily solve it.

This isn't precisely the answer to what you're asking, but related -- it would be useful if the Unity devs can make use of the System.Obsolete attribute to mark API changes, which produces a compile warning. (This is for C#.)

This isn't a blanket solution, but would be useful for:

  • API evolution between Unity versions
  • as a way to flag methods revealed by the Unity team but deliberately not documented or supported

Note that you can also use this attribute on your own projects to help make sure your team is using your APIs as intended.