title: How to load a mesh from an asset bundle?
body: <p>I'm trying to load a mesh with scripts to replace another mesh. I'm not doing a Unity project but rather a visual studio project with unity references.
  My code for loading the asset bundle and getting the mesh is:</p>
  <pre><code>var vshojoBundle = AssetBundle.LoadFromFile(&quot;vshojo&quot;);
  if (vshojoBundle == null) meshNames.Add(&quot;bundle not read&quot;);
  GameObject silverObject = vshojoBundle.LoadAsset(&quot;SilverAssets.obj&quot;);
  MeshFilter silverNewMesh = silverObject.GetComponent&lt;MeshFilter&gt;();
  meshNames.Add(silverNewMesh.mesh.name);
  </code></pre>
  <p><code>MeshNames</code> is just a list that later gets written in a log file to help me figure out things. When trying to get the name of the mesh in the last line, I get the following error: <code>NullReferenceExpection: System.NullReferenceException: Object reference not set to an instance of an Object</code>. The same exception occurs if I don't use that line to write on log and skip to the mesh replacement, when I replace the mesh I get the same error.</p>