I know this is an older post, but the error “Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption” indicates that you are attempting to parent a prefab. You cannot do so. When you instantiate an object from a prefab, you need to refer to the actual GameObject that was instantiated, not the prefab which the GameObject is cloned.
prefabInstantiation = Instantiate(objectPrefab, position, rotation) as GameObject;
prefabInstantiation.transform.parent = `
As you can see, I am not referring to the actual prefab, but the object which was instantiated. Then I am setting the instantiated objects parent as some other object.
It works very well in Unity windows, but when I create the build for my Oculus Quest 2, the fish do not appear.
In the console I have this message:
Setting the parent of a transform which resides in a Prefab Asset is disabled to prevent data corruption (GameObject: ‘Needlenose Fish (Clone)’).
UnityEngine.Transform: set_parent (Transform)
GlobalFlock: Start () (at Assets / GlobalFlock.cs: 28)
Knowing that if I put the fish directly on the stage, I can see them clearly with my Quest!
Original code :
26 GameObject fish = (GameObject)Instantiate(fishPrefabs[Random.Range(0, fishPrefabs.Length)], pos, Quaternion.identity);