I am making a Multiplayer Game with MLAPI. The problem is, i have a ability system so every ability get executed over an ScritableObject. The problem is, if i have for example five Players in the scene all Players are referenced to the same ScritableObject. And so when somebody execute a ability. The other players are also doing it. So my Question is can I duplicate my default ability ScritableObject so that every player has its own abilities ScritableObject but with the same Values as the default ability ScritableObject. I must do that over Script. I know i could create a new ScritableObject and then make a method who paste my values. But maybe somebody has a better idea??????????
Asked
Active
Viewed 1,445 times
1 Answers
1
Afaik you can use Instantiate
also for cloning ScriptableObject
on runtime! Only you can of course not use any component taking more then the original parameter (which makes sense).
And the same way as ScriptableObject.CreateInstance
this will of course not create an asset but only a runtime instance.

derHugo
- 83,094
- 9
- 75
- 115
-
1Ok thx, much thx. That helps me but can i copy a already Existing Scritableobject with the Values. So that i have two existing Scritableobject with the same Values. Thank you for the Answer – Lyksel Feb 07 '22 at 20:29
-
1@Lyksel Well yes ... As said you use `Instantiate` that will create a clone rather than a new empty instance – derHugo Feb 07 '22 at 21:03
-
Ah now i understand. Sorry . But thx you save me from much error. THX – Lyksel Feb 08 '22 at 18:35