Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
This question was closed Mar 23, 2017 at 03:47 PM by Liam_B for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by Liam_B · Mar 22, 2017 at 07:05 AM · gameobjectinstantiatedestroyassetbundle

Destroying Instantiated Prefab from AssetBundle

Hello!

A bit of a last resort after spending the past week or so trying to find a solution via the forums, I'm able to instantiate a model within the parent GameObject, however I'm having trouble destroying the object after its been used. Heres the code used to download and instantiate the model (Which works fine, just unsure whether some may need reworking for the destroy to work).

         while (!Caching.ready)
             yield return null;
 
         var www = WWW.LoadFromCacheOrDownload(mARData.ModelUrlAndroid, mARData.TargetVersion);
         yield return www;
         bundle = www.assetBundle;
 
         if (!string.IsNullOrEmpty (www.error)) {
             Debug.Log (www.error);
         } 
 
         else {
             model = (GameObject)bundle.LoadAsset(mARData.ModelName);
 
             model = Instantiate(model);
             model.transform.parent = AugmentationObject.transform;
             model.transform.localPosition = new Vector3(mARData.PositionX, mARData.PositionY, mARData.PositionZ);
             model.transform.localRotation = Quaternion.Euler(mARData.RotationX, mARData.RotationY, mARData.RotationZ);
             model.transform.localScale = new Vector3(mARData.ScaleX, mARData.ScaleY, mARData.ScaleZ);
 
             model.name = mARData.ModelName;
 
             www.assetBundle.Unload(false);
             mIsLoadingModel = false;



Any help/links would be greatly appreciated!

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

  • Sort: 
avatar image
0
Best Answer

Answer by Liam_B · Mar 25, 2017 at 08:53 AM

Okay seemed to fix the issue in the end, before exporting the asset bundle I assigned a Tag to the object, which then I was easily able to find and destroy the object with :)

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

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

using Contains(gameObject) to find and destroy a gameObject from a list 2 Answers

Guided Missiles help? 2 Answers

PlayerRespawn class wont Instantiate the player prefab 1 Answer

Why won't this object destroy? 2 Answers

How to check if a game object is destroyed from array? And instantiate a new game object when a game object is destroyed? 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