Hi,
I´m currently working on implementing upgrades to my game.
I have a GameObject which my upgrade script is attached to and at first (because I want my upgrades in different Scenes) I used a Singleton Pattern so that my upgrades stay the same, even if you load a new Scene.
But the problem is, that in the other scenes, in which my Singleton Pattern destroyed the initial Upgrade GameObject, which I had dragged in to other GameObjects (in other words attached with public or [SerializeField]).
Now of course the GameObjects that had the initial Upgrade GameObject attached to them, didn´t do what they were supposed to do.
So I´m trying to use Prefabs to make all the upgrades be the same in every script.
That´s why I “told” the Upgrade GameObject to apply all the changes I made to every other PrefabInstance
with PrefabUtility.ApplyPrefabInstance:
[SerializeField] GameObject myPrefab; //Dragged In Itself In Unity
void Update()
{
PrefabUtility.ApplyPrefabInstance(myPrefab, InteractionMode.AutomatedAction);
}
(Of course a really simplified version)
But the weird thing is Unity is “telling” me, I can´t apply methods on an object which is not part of a Prefab instance is not supported.
Can you help?