Reference

    Inherited By: , AStar, , AudioEffectInstance, , ConfigFile, , EditorExportPlugin, , EditorInspectorPlugin, , EditorResourcePreviewGenerator, , EditorScenePostImport, , EncodedObjectAsID, , File, , GDNative, , GDScriptNativeClass, , JSONParseResult, , KinematicCollision2D, , MeshDataTool, , Mutex, , PackedDataContainerRef, , Physics2DShapeQueryParameters, , Physics2DTestMotionResult, , PhysicsShapeQueryResult, , RegEx, , Resource, , ResourceFormatSaver, , ResourceInteractiveLoader, , SceneTreeTimer, , SpatialGizmo, , StreamPeer, , TCP_Server, , TriangleMesh, , UPNPDevice, , WeakRef,

    Category: Core

    Base class for reference-counted objects.

    References keep an internal reference counter so that they are automatically released when no longer in use, and only then. References therefore do not need to be freed manually with Object.free.

    In the vast majority of use cases, instantiating and using -derived types is all you need to do. The methods provided in this class are only for advanced users, and can cause issues if misused.

    Initializes the internal reference counter. Use this only if you really know what you are doing.


    Increments the internal reference counter. Use this only if you really know what you are doing.

    Returns whether the increment was successful.


    • unreference ( )

    Decrements the internal reference counter. Use this only if you really know what you are doing.