Question: I want to make my character transparent in some circumstances, I know I could do that via

```
 GetComponent<SpriteRenderer>().color = new Color(1f,1f,1f,0.2f);

```

if it's a single sprite without animation.

But the thing is that it's during an animation, so is there any way to change the sprite sheet's alpha which the animation is using alpha via scripts?

Answer: 
**Abort object creation**

As documented by Qt, three methods exists to unload/abort an object instantiation:

1. Set [`Loader.active`](http://doc.qt.io/qt-5/qml-qtquick-loader.html#active-prop) to `false`
2. Set [`Loader.source`](http://doc.qt.io/qt-5/qml-qtquick-loader.html#source-prop) to an empty string
3. Set [`Loader.sourceComponent`](http://doc.qt.io/qt-5/qml-qtquick-loader.html#sourceComponent-prop) to `undefined`

**Asynchronous behaviour**

To be able to change these properties during loading, [`Loader.asynchronous`](http://doc.qt.io/qt-5/qml-qtquick-loader.html#asynchronous-prop) should be `true`, otherwise the GUI thread is busy with loading the object. You also need to [`QQmlIncubationController`](http://doc.qt.io/qt-5/qqmlincubationcontroller.html) for your [`QQmlEngine`](http://doc.qt.io/qt-5/qqmlengine.html#setIncubationController) to control the idle time used for object incubation. Without such a controller `Loader.asynchronous` does not have any effect. Note that [`QQmlApplicationEngine`](http://doc.qt.io/qt-5/qqmlapplicationengine.html#details) automatically installs a default controller if the scene contains a `QQuickWindow`.

**Bugs**

Up to the last tested Qt version (Qt 5.8.0, 5.9.0 beta), a severe memory leaks exist when aborting an unfinished object incubation (at least in certain cases, including the example in the answer of derM) resulting in a fast memory usage increase for large components. A [bug report](https://bugreports.qt.io/browse/QTBUG-60188) is created including a proposed solution.

According to the bug report, this should be fixed in Qt version 5.15 (not tested).
I don't know what your issu is, with those *objects that are destroyed before the loader finishs*, but maybe the issue is there? If not, this should work:
If it does not help, please add some code to your question, that reproduces your problem.

**main.qml**

```
import QtQuick 2.7
import QtQuick.Controls 2.0

ApplicationWindow {
    id: root
    visible: true
    width: 400; height: 450

    Button {
        text: (complexLoader.active ? 'Loading' : 'Unloading')
        onClicked: complexLoader.active = !complexLoader.active
    }

    Loader {
        id: complexLoader
        y: 50
        width: 400
        height: 400
        source: 'ComplexComponent.qml'
        asynchronous: true
        active: false
        // visible: status === 1
    }

    BusyIndicator {
        anchors.fill: complexLoader
        running: complexLoader.status === 2
        visible: running
    }
}

```

**ComplexComponent.qml**

```
import QtQuick 2.0

Rectangle {
    id: root
    width: 400
    height: 400
    Grid {
        id: grid
        anchors.fill: parent
        rows: 50
        columns: 50
        Repeater {
            model: parent.rows * parent.columns
            delegate: Rectangle {
                width: root.width / grid.columns
                height: root.height / grid.rows
                color: Qt.rgba(Math.random(index),
                               Math.random(index),
                               Math.random(index),
                               Math.random(index))
            }
        }
    }
}

```