Jump to content

Unity exporter uses mesh for name instead of game object name


ozRocker
 Share

Recommended Posts

I've been using the Unity exporter and its awesome!  Makes my life a lot easier :)

 

Something I'm struggling with at the moment is referring to my game objects in Babylon.js.  I have some cubes in Unity which I have assigned different names to, however the exporter doesn't use those names, but uses the name of the base mesh, which is "Cube".  Unfortunately that means every single cube (as well as all primitive shapes) have the same name.  Assigning a tag to them in Unity doesn't help since tags don't get exported with the object.  The only way I can refer to these different cubes is by searching the resulting .babylon file to look for all the cubes and get their IDs.  I have to do this every time I export since those IDs change.  

 

Does anyone know of an easier way I can refer to my different cubes, or a way I can get the exporter to use game object name instead of mesh name?

Link to comment
Share on other sites

I solved it!  Hopefully it doesn't break other stuff, but so far it works.

 

open file "SceneBuilder.Meshes.cs"

 

look for function "ConvertUnityMeshToBabylon"

 

in the first few lines look for:

ExporterWindow.ReportProgress(progress, "Exporting mesh: " + mesh.name);
and change to:
ExporterWindow.ReportProgress(progress, "Exporting mesh: " + gameObject.name);
and look for:
babylonMesh.name = mesh.name;
and change to:
babylonMesh.name = gameObject.name;
 
Link to comment
Share on other sites

ok, hopefully I did everything right.  I've created a pull request for my branch punkoffice.  Now I'm familiar with the exporter code I will go through it often and see what else I can add or improve.  I'm a massive Unity3D fan but their webGL conversion is way too bulky.  It won't work on IE and no chance in hell it'll work on a mobile device.  Its not suitable for a personal info 3D website at all (which is what I'm working on).  That's why I switched to Babylon.js, but I thought it would be painful to have to create a whole scene by code.  Having the Unity exporter is a dream come true!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...