Quantcast
Viewing all articles
Browse latest Browse all 302

Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption.

I am having an issue trying to set the parent of an object. (Using Unity 5.5.4p4) The error is: Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption So i deleted my prefab and i instantiated the prefab in a script but the error still. :/ can someone try to help me? (In my box folder script) public GameObject DLG;//PREFAB void Start () { Instantiate (DLG, transform.parent);//INSTANTIATE } (In my box script) private void GridIconToObject () { Vector3 GridPosition = new Vector3 (MousePosition.x,MousePosition.y - 6.4f); IconSpawned.transform.position = new Vector3 (Mathf.FloorToInt(GridPosition.x) + 0.5f,Mathf.FloorToInt(GridPosition.y) + 6.4f + 0.5f); // other things without importance Icons [IconArrayIndex].transform.parent = transform.parent.parent.GetChild(7);//error line } I've tried other ways to get the parent but didnt work anyways

Viewing all articles
Browse latest Browse all 302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>