I have a character that fires projectiles. I’ve animated it so that when i go into the animator and click the bool isattacking he starts to shoot. As soon as he shoots I get the error:
Setting the parent of a transform which resides in a prefab disabled to prevent data corruption.
UnityEngine.Transform:set_parent(Transform)
The line that this is connected to is my fire function
here it is:
private void Fire()
{
GameObject newProjectile = Instantiate(projectile) as GameObject;
newProjectile.transform.parent = projectileParent.transform;
newProjectile.transform.position = gun.transform.position;
}
The line unity has problems with is the second one about parent. Now in Monodevelop there seems to be no problems. Does anyone know how to resolve this error?