RSX Code Reference
    Preparing search index...
    • rsx
    • onViewportDragAndDrop

    Function onViewportDragAndDrop

    • Adds out-of-the-box drag and drop functionality to subclasses of Resource when the user drags the resource from the library to a scene viewport.

      Simply apply the decorator to your subclass of Resource and provide a callback that is called when your resource was dropped on a SceneObject.

      The following example shows a potential implementation:

      onViewportDragAndDrop((resource: MyCustomResource, sceneObject: SceneObject) =>
      {
      sceneObject.addComponent(MyCustomComponent).resource = resource;
      })

      Type Parameters

      Parameters

      • fnCallback: (resource: T, sceneObject: SceneObject) => void

      Returns AttributeDecorator<Attribute>