Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by MountDoomTeam · Sep 14, 2012 at 03:40 PM · prefabproceduralcombinechildren

Sending cubes to prefab makes their mesh settings vanish

Say i place 30 cubes procedurally and combine them into a parent object via script.

Is it possible to take the cubes parent object and to make a prefab with it? Because every time i do, all the cube mesh filter and renderer settings vanish, and prefab contains only invisible cubes with no mesh settings.

I attempted via dragging from hierarchy to prefab, code: ReplacePrefab, and copying from hierarchy during play pasting back in edit mode... the prefab cubes meshes are gone.

why does it happen? do you have a suggestion?

Edit - Maybe because i procedually changed all the cube's UV offsets? it shouldnt stop from prefabbing them?!

i have tried both with CombineChildren and without, same result, i would also like get the Combined Children mesh and save it as a prefab.

EDIT- i just found that if i combine mesh and delete the children, the combined mesh still exists in parent object (The children were redundant and undeleted?!) but it becomes invisible if i try to drag the comined mesh parent object into a prefab.

alt text

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MountDoomTeam · Sep 14, 2012 at 05:32 PM 0
Share

i failed to prefab procedurally adited meshes, but i have found a script to export them as .obj files called EditorObjExporter it doesnt work yet but it's part of the same quest.

avatar image Bunny83 · Sep 15, 2012 at 10:57 AM 0
Share

BTW, it would be great to have more information about how you "combine your mesh" and where you actually do this, at runtime or in an editor script.

avatar image MountDoomTeam · Sep 22, 2012 at 03:12 PM 0
Share

just adding primitives into geometry shapes, combine mesh is done with combinechildren-extended-version from the forums with a frame delay of 2, and in the end it's easier to not make prefabs of the mesh just save the algorythm, although i did manage to make these into single meshes and export them as .obj's complete with color i may make an assetstore thing to make geometry sprites for games if people want, it looks retro! :)

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Bunny83 · Sep 15, 2012 at 10:55 AM

It's not enough to create a prefab of a combined Mesh. The combined Mesh is a temporal mesh which is created in memory. You have to save the Mesh as asset if you want to use it as asset.

That means you have to use AssetDatabase.CreateAsset to store the new Mesh in your project. Keep in mind that those are classes from the UnityEditor namepsace, so use them in an editor script only or you can't build your game.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DesiQ · Sep 15, 2012 at 11:01 AM 0
Share

Ah, today I learned CreateAsset :)

avatar image Bunny83 · Sep 15, 2012 at 11:03 AM 0
Share

;) The editor offers twice the features you can use at runtime. Some things are a bit tricky but once you figured it out it's awesome ;)

avatar image MountDoomTeam · Sep 22, 2012 at 03:14 PM 0
Share

you can combine the mesh and make a collider for it using combine mesh extended version for the forums. essential code!

avatar image
0

Answer by DesiQ · Sep 15, 2012 at 10:27 AM

why does it happen?

When you batch meshes, Unity makes an entirely new single mesh for each material. It then disables (but does not delete) the original mesh renderers, leaving behind only the new Combined Mesh. You can try making a prefab of the combined mesh, but that mesh won't have any colliders (batching doesn't combine those).

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Dungeon Generation, in the style of SCP Containment Breach 0 Answers

inserting random gun into player/enemies hands 3 Answers

Unity not Instantiating Prefabs Properly 0 Answers

Converting a number of runtime-created prefab GameObject cube's for export 0 Answers

Creating entities with some variations among them 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges