How to create a custom component thru code ? RCP3

Hello I'm trying to create a custom component but I can't see to make It work on the RCP3.

The video 'Extend Reality Composer Pro 3 functionality with Xcode' makes it seem too simple but I can't seem to work following the steps.

Answered by Vision Pro Engineer in 897581022

Hi @masaldana2,

Is your built RCPCustomComponents.framework file inside the Plugins folder Reality Composer Pro references in the screenshot you shared above? You'll need to ensure the .framework file is in that folder in order for Reality Composer Pro to work with it.

Alternatively, you can change the Plugin Directory path Reality Composer Pro uses to point directly to the PackageFrameworks directory Xcode builds to (it will be something along the lines of /Users/<username>/Library/Developer/Xcode/DerivedData/<xcode-project-folder>/Build/Products/Debug/PackageFrameworks/, where <username> is your account name and <xcode-project-folder> is the derived data folder for your specific Xcode project). When you create a new linked Xcode project directly from Reality Composer Pro, ensuring the Include Custom Components toggle is checked, this should happen automatically.

Another option is to make Xcode automatically copy the framework from the PackageFrameworks folder to your unique plugin folder when you build.

For an example of how to do this, take a look at the InstallPlugin.sh build script in the Chaparral Village sample. Here's the contents of that file for your convenience:

#!/bin/bash

# This script is responsible for installing a built
# RCPCustomComponents.framework into a location that
# RCP3 can find it at (<repo>/Plugins)
#
# This gets run as a pre-run script for the `RCPCustomComponents` target.
# If you aren't running as a macOS target, this causes the run to fail
# and not do anything.

# Errors => fail build
set -eo pipefail

if [ "${PLATFORM_NAME}" != "macosx" ]; then
    echo "Not running Chaparral Village on macOS. Please adjust the target desitination."
    exit 1
fi

# Resolve the symlinked built products directory for the framework.
FRAMEWORK_NAME="${PRODUCT_NAME}"
SOURCE_PATH="${BUILT_PRODUCTS_DIR}/PackageFrameworks/${FRAMEWORK_NAME}.framework"
BUILT_FRAMEWORK=$(cd "${SOURCE_PATH}"; pwd -P)

PROJECT_DIR=$(realpath "${WORKSPACE_PATH}/../..")

INSTALL_FOLDER="${PROJECT_DIR}/Plugins"
INSTALL_PATH="${INSTALL_FOLDER}/${FRAMEWORK_NAME}.framework"

# Remove already installed plug-in.
if [ -d "${INSTALL_PATH}" ]; then
    rm -rf "${INSTALL_PATH}"
fi

# Create the install folder in case it doesn't exit.
mkdir -p "${INSTALL_FOLDER}"

# Copy framework over
cp -a "${BUILT_FRAMEWORK}" "${INSTALL_PATH}"

Let me know if you run into issues with any of these approaches!

Accepted Answer

Hi @masaldana2,

Is your built RCPCustomComponents.framework file inside the Plugins folder Reality Composer Pro references in the screenshot you shared above? You'll need to ensure the .framework file is in that folder in order for Reality Composer Pro to work with it.

Alternatively, you can change the Plugin Directory path Reality Composer Pro uses to point directly to the PackageFrameworks directory Xcode builds to (it will be something along the lines of /Users/<username>/Library/Developer/Xcode/DerivedData/<xcode-project-folder>/Build/Products/Debug/PackageFrameworks/, where <username> is your account name and <xcode-project-folder> is the derived data folder for your specific Xcode project). When you create a new linked Xcode project directly from Reality Composer Pro, ensuring the Include Custom Components toggle is checked, this should happen automatically.

Another option is to make Xcode automatically copy the framework from the PackageFrameworks folder to your unique plugin folder when you build.

For an example of how to do this, take a look at the InstallPlugin.sh build script in the Chaparral Village sample. Here's the contents of that file for your convenience:

#!/bin/bash

# This script is responsible for installing a built
# RCPCustomComponents.framework into a location that
# RCP3 can find it at (<repo>/Plugins)
#
# This gets run as a pre-run script for the `RCPCustomComponents` target.
# If you aren't running as a macOS target, this causes the run to fail
# and not do anything.

# Errors => fail build
set -eo pipefail

if [ "${PLATFORM_NAME}" != "macosx" ]; then
    echo "Not running Chaparral Village on macOS. Please adjust the target desitination."
    exit 1
fi

# Resolve the symlinked built products directory for the framework.
FRAMEWORK_NAME="${PRODUCT_NAME}"
SOURCE_PATH="${BUILT_PRODUCTS_DIR}/PackageFrameworks/${FRAMEWORK_NAME}.framework"
BUILT_FRAMEWORK=$(cd "${SOURCE_PATH}"; pwd -P)

PROJECT_DIR=$(realpath "${WORKSPACE_PATH}/../..")

INSTALL_FOLDER="${PROJECT_DIR}/Plugins"
INSTALL_PATH="${INSTALL_FOLDER}/${FRAMEWORK_NAME}.framework"

# Remove already installed plug-in.
if [ -d "${INSTALL_PATH}" ]; then
    rm -rf "${INSTALL_PATH}"
fi

# Create the install folder in case it doesn't exit.
mkdir -p "${INSTALL_FOLDER}"

# Copy framework over
cp -a "${BUILT_FRAMEWORK}" "${INSTALL_PATH}"

Let me know if you run into issues with any of these approaches!

Thank you I had to build the .framework with MyMac instead of VisionOS

@masaldana2 can you explain the steps you used? I'm still struggling to figure out the RCP custom component build process.

1 create a package

2 watch this video minute 4:51 - copy code files https://developer.apple.com/videos/play/wwdc2026/281

3 build package .framework using 'MyMac' and copy .framework into a new folder /plugIns

4 open RCP3 and build settings make sure plugins is pointing to the new folder 'plugIns'

5 it should detect automatically @kpfeifer

Ah okay thanks! I didn't understand at first that you had to build the RCPCustomComponents scheme with the MyMac as the target, I was trying to build using the game's scheme.

It would be great if Apple could post a from-scratch walkthrough of how to set this up on a new project rather than copy/pasting from the one sample project.

How to create a custom component thru code ? RCP3
 
 
Q