//---------------------------------------------------------------------------------------
void USkookumScriptComponent::UninitializeComponent()
  {
  // Call SkookumScript destructor, but only if we are located inside the game world
  if (m_instance_p && GetOwner()->GetWorld() == SkUEClassBindingHelper::get_world())
    {
    SK_ASSERTX(SkookumScript::is_flag_set(SkookumScript::Flag_evaluate), "SkookumScript must be in initialized state when UninitializeComponent() is invoked.");
    delete_sk_instance();
    }

  Super::UninitializeComponent();
  }
//---------------------------------------------------------------------------------------
void USkookumScriptComponent::OnUnregister()
  {
  Super::OnUnregister();

  ms_registered_skookumscript_components.remove(this);

  //SkDebug::print_ide(a_str_format("USkookumScriptComponent::OnUnregister() 0x%p\n", this), SkLocale_ide, SkDPrintType_trace);
  if (SkookumScript::is_flag_set(SkookumScript::Flag_evaluate) && m_instance_p)
    {
    delete_sk_instance();
    }
  }