JsonUtility.ToJson(transform) will result in an error:
ArgumentException: JsonUtility.ToJson does not support engine types.
My question is why? Why can I serialize all self-implemented Mono Behaviours but no engine types? I cannot see any logical reason why this is explicitly forbidden. Yes it is possible using
EditorJsonUtility, but I want to be able to do this in the game.
The reason why I want this, is for example to save the initial
Transform of an object so I can reset its position/rotation/transform to its original state. Yes I can copy the variables, but I want a more general approach so any component can be stored without the need to define all variables you wish to save for every single component.