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.
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!