I read through and understand PrefabUtility, but I couldnt find a way to add a game object to an instantiated prefab.
The final goal is to save numbers to the editor so I can access them at a later time.
I read through and understand PrefabUtility, but I couldnt find a way to add a game object to an instantiated prefab.
The final goal is to save numbers to the editor so I can access them at a later time.
GameObject prefabInstance = PrefabUtility.InstantiatePrefab(Resources.Load(“myPrefab”)) as GameObject;
GameObject otherObject = …; //the object that you want to add to the prefab
otherObject.transform.parent = prefabInstance.transform;
PrefabUtility.ReplacePrefab(prefabInstance, PrefabUtility.GetPrefabParent(prefabInstance), ReplacePrefabOptions.ConnectToPrefab);