/// <summary>
 /// Initializes the currently selected scene object. This should be called whenever the selected scene object 
 /// changes.
 /// </summary>
 private void InitializeSO()
 {
     if (selectedSO != null)
         soState = new SerializedSceneObject(selectedSO, true);
 }
 private static extern void Internal_CreateInstance(SerializedSceneObject instance, IntPtr so, bool hierarchy);
        /// <summary>
        /// Clears a selected scene object. This must be called on every scene object <see cref="InitializeSO"/> has been called
        /// on, after operations on it are done.
        /// </summary>
        private void ClearSO()
        {
            if (selectedSO != null)
            {
                Animation animation = selectedSO.GetComponent<Animation>();
                if (animation != null)
                    animation.EditorStop();
            }

            if (soState != null)
            {
                soState.Restore();
                soState = null;
            }
        }
 private static extern void Internal_CreateInstance(SerializedSceneObject instance, IntPtr so, bool hierarchy);