- Home /
setting the parent of a transform which resdes in a prefab is dusabled to prevent data corruption
I'm downloading the 3D model from server using of Assetbundle. I'm getting the model from url but when i attached to the gamer object of Prefab it showing error and the cube is not showing "setting the parent of a transform which resdes in a prefab is dusabled to prevent data corruption",
public GameObject imageTarget;
private GameObject mBundleInstance = null;
using (WWW www = WWW .LoadFromCacheOrDownload(bundleURL, Version)) {
yield return www;
Debug.Log (Version);
if (www .error != null)
throw new UnityException("WWW Download had an error: " + www .error);
AssetBundle bundle = www .assetBundle;
if (AssetName == "") {
Debug.Log ("null");
mBundleInstance = Instantiate (bundle.mainAsset) as GameObject;
mBundleInstance.transform.parent = imageTarget.transform;
mBundleInstance.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
mBundleInstance.transform.localPosition = new Vector3(0.0f, 0.15f, 0.0f);
mBundleInstance.transform.gameObject.SetActive(true);
}
I have met this problem too, but I don't solve it .Whether you solve it?
Answer by M-G-Production · Dec 01, 2014 at 06:24 AM
Hi karthees... I had the same problem :( you might need to find another way...
http://answers.unity3d.com/questions/9661/how-do-i-set-a-parent-of-a-prefab-at-runtime-c.html
Math
Your answer
Follow this Question
Related Questions
Make a simple tree 1 Answer
Instantiate a Prefab as child 0 Answers
First child of a gameobject 3 Answers
Script that mimics a child object behavior. 1 Answer
Parenting GameObjects 1 Answer