- Home /
Question by
rsoneriu · Oct 29, 2014 at 07:27 PM ·
prefabprefab-instance
Reset script to prefab values
Hey guys, I have a question.
How can I revert a script to the prefab state?
The script has game objects attached, values, in short a lot of stuff on it and, in my research on this topic, people suggested to duplicate all the values and just revert to those at enable / disable.
I really hope there is another way, because, as i said, it has a lot of values in it, and i cannot (or i dont see an easy way) to duplicate them all. I did try this but to no avail:
for (var child : Transform in transform.parent.transform){
UnityEditor.PrefabUtility.ResetToPrefabState(child.gameObject);
child.gameObject.SetActive(true);
}
Any help is much appreciated!
Comment