0
\$\begingroup\$

I'm working in Unity 5, and I currently have the following setup:

My project contains two prefabs which we'll call "Cube" and "CubeT". Cube was imported from an FBX file generated by Autodesk 3DS Max, and CubeT was created within Unity. I want to be able to modify Cube's mesh collider, but Unity will not allow me to do so. Therefore, I've thought about adding the mesh within Cube to CubeT and removing Cube. The thing is, I'm worried that I'll lose the mesh when I delete Cube, and subsequently lose the reference to it in CubeT.

If I reference Cube's mesh in CubeT and then remove Cube from the project by deleting the asset within Unity, what will happen? Will the needed mesh remain in the project or am I going to have to find another way?

\$\endgroup\$
  • 1
    \$\begingroup\$ Why don't you just backup the project and test it? \$\endgroup\$ – Katu Apr 16 '15 at 19:35
2
\$\begingroup\$

If I understand you correctly, you have created a model and then imported it to Unity. This model is what you call Cube and contains a mesh.

So, just check the file extension of your Cube - Unity5 shows it in the status bar at the bottom of the Project window, when you select a file. If the extension is .fbx - this is NOT a prefab at all. You will lose your mesh if you delete it. In this case keep both Cube and CubeT in the project. But, if the file extension is .prefab, then you could delete it without losing the mesh - mesh is stored in separate file.

If you want only a single file in the project, it is better to apply changes to the original model in 3DS Max and reimport it to Unity.

Editing a mesh collider isn't an option in Unity, but there are some common hints:

  • You can create a compound collider for your mesh using multiple Unity's built-in colliders (cube, sphere, capsule), and, obviously, it will be completely editable inside Unity.
  • Another hint is what 10001110101 suggested: create another mesh (most likely simplified), generate a collider for it. In the Hierarchy disable the mesh renderer component and use it's collider for your mesh.
|improve this answer|||||
\$\endgroup\$
0
\$\begingroup\$

The FBX file will not get deleted unless you delete it yourself. That being said, it's generally good practice to build your collision mesh (if you need something more complicated that a simple primitive), in the modeling program itself and export both meshes together. You can then link the underlying collision mesh in the FBX to the mesh collider.

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ Not quite what I'm looking for, sorry.. What I'm wondering is if the mesh will be removed from the project if I delete the prefab. \$\endgroup\$ – EnragedTanker Apr 16 '15 at 18:53
  • \$\begingroup\$ It shouldn't, no. As long as you're not explicitly removing the FBX. A prefab only has references to the mesh, not the actual data. \$\endgroup\$ – 10001110101 Apr 16 '15 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.