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
1
Question by user-4369 (google) · Aug 27, 2010 at 10:41 AM · gameobjectparentchange

Building asset bundles and wanting to move game objects from one parent to a newly created parent

As part of a build process I am trying to separate parts of a max model into separate asset bundles.

I have a GameObject that has lots of children that are game objects lets say 20+, i want to take 4 of those child GameObjects detach them from there shared Parent and Parent them to a new GameObject that i have just created.

Ive tried just assigning the objects parent to a new object but this fails at runtime as its read only.

instance.m_gameObj.transform.parent.gameObject = newGO;

So i think i need to either make a copy of the child and add it is as a new component to my new GameObject.

And possibly even destroy the original parent object, but im worried that will destroy all the other child objects i want to copy over as well as there still attached to it.

Update

What ive tried since posting.

  1. Use EditorUtility.InstantiatePrefab to create clones of the 4 game objects i want
  2. Then use UnityEngine.Object.DestroyImmediate to destroy each game objects parent
  3. Then create a new dummy game object like this - GameObject newGO = new GameObject("MainAsset");
  4. Then make the parent of my 4 game objects the new dummy game object m_gameObj.transform.parent = newGO.transform;
  5. Then build the asset bundle of the new GameObject - bool buildOk = BuildPipeline.BuildAssetBundle(newGO, null, bundleTarget, BuildAssetBundleOptions.CollectDependencies);
  6. But still no luck even tho there is no crashes or warnings the BuildAssetBundle returns false, and im still trying to work out what part of this its not liking.

Does anyone have any ideas for this?

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Lucas Meijer 1 · Aug 31, 2010 at 01:46 PM

I cannot see from the information provided what is wrong, however, we created a relatively complex project that uses asset bundles extensively to show how to effectively use assetbundles in a real world scenario. (It also takes a fbx file, and creates different assetbundles from different subsets of the fbx file). You can find it at: http://unity3d.com/support/resources/example-projects/charactercustomization

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

No one has followed this question yet.

Related Questions

How can I access a child object? 1 Answer

DontDestroyOnLoad with not marked parents bug? (steps to reproduce here too!)) 1 Answer

How to remove the GameObject having the Object 1 Answer

Instantiate Terrain Object as child of Empty Game Object 1 Answer

How to destroy a parent object when child object is collided 1 Answer


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