How to compile script to include it to AssetBundle?

According to this manual I can include scripts as binary data and load them via Reflection.
I understand all steps, except one: how can I compile script to get binary data for stroring it in .binary file?
Is there any tutorial/help?


  1. Open Monodevelop and create C#Library project
  2. Add UnityEngine.dll to References
  3. Compile your scripts
  4. Copy bin/.dll from your library project folder to Assets of your unity project and change extension from .dll to .bytes

That’s all.

We used to load asset bundles, in which the scripts were attached the objects.
It worked for us.
Unity automatically compiles the script attached to the GameObjects.