Including scripts in AssetBundles

I am trying assetbundles with Unity 5 and I have an error with scripts included in assetbundles. This is my source code for AssetBundles import. Why the TextAsset variable is always null? I use this code from Unity documentation http://docs.unity3d.com/Manual/scriptsinassetbundles.html

AssetBundle bundle = www.assetBundle;
if(bundle != null)
{
    // txt TextAsset is always null !!!
    TextAsset txt = bundle.LoadAsset(prefabNameInAssetBundle, typeof(TextAsset)) as TextAsset;

    // resObj is always != null, it's ok
    UnityEngine.Object resObj = bundle.LoadAsset(prefabNameInAssetBundle);
    if (resObj != null)
        newGO = (GameObject)GameObject.Instantiate(resObj);


   bundle.Unload(false);       
}

A TextAsset is an asset on its own. According to your variable names, you have somehow linked the TextAsset to a prefab (prefabNameInAssetBundle). Make sure that you are using the actual TextAsset.

Edit: You can’t instantiate TextAsset. You need to load them. Just have a closer look at the link you posted.