Abstract
Code cloning—the practice of duplicating logic—is a well-documented phenomenon in traditional software engineering that often leads to increased maintenance debt. However, Virtual Reality (VR) development introduces unique complexities through its heavy reliance on serialized asset files (e.g., Unity’s .prefab and .mat). This paper presents the first large-scale empirical study of code clones in VR software, analyzing 345 open-source projects. By employing a hybrid methodology that combines traditional detection tools with Large Language Models (LLMs), we reveal that VR developers frequently shift cloning behavior from source code to asset files, creating maintenance risks that traditional scanners fail to detect. Our findings highlight the efficacy of GPT-4o in identifying these asset clones with high accuracy.
Introduction
In software development, code cloning is a double-edged sword: while it accelerates initial prototyping, it creates a long-term burden where bugs must be fixed across multiple instances. In the context of VR, this problem is exacerbated. VR applications are not merely collections of code; they are integrated systems of logic and "serialized assets" that define 3D hierarchies, physics, and scene properties.
A critical gap exists in current research: traditional clone detection tools are optimized for programming languages like C# or C++, leaving the semi-structured data in VR asset files largely invisible. If a developer clones a complex VR "Prefab" instead of using a proper reference, they inherit technical debt that standard security and maintenance scanners cannot see.
Methodology
To address this gap, we constructed the VR-345 dataset, comprising 233 applications and 112 development tools curated from GitHub. The study utilized a multi-stage analysis pipeline to capture both functional and structural clones.
As illustrated in the workflow above, the methodology involved two distinct tracks:
- Source Code Analysis: We used NiCad, a traditional clone detector, to identify functional clones within C# and C++ source files.
- Serialized Asset Analysis: Because asset files lack standard programming syntax, we leveraged GPT-4o using a two-step Chain-of-Thought (CoT) prompting strategy. The LLM first evaluated file pairs for structural and functional similarity and then aggregated these results into project-wide "Clone Groups."
Key Insights and Results
The Asset-Code Trade-off
Our analysis revealed a surprising trend: VR projects exhibit lower levels of source code cloning compared to traditional software. However, this is not due to superior discipline; rather, developers are shifting their cloning behavior into the asset layer. Simpler files, such as "Materials," are cloned frequently for rapid optimization, while complex "Scenes" remain unique due to their inherent difficulty to replicate.
The Impact of Third-Party Libraries
A significant portion of redundancy in VR applications stems from third-party SDKs like SteamVR and VRTK. These libraries provide high-level abstractions that developers often copy and modify locally rather than extending through proper inheritance, leading to widespread "cloning debt."
LLM Performance in Clone Detection
A core contribution of this study is the validation of LLMs for non-traditional clone detection. We benchmarked several models to determine their ability to identify clones in semi-structured asset files.
As shown in the table, GPT-4o outperformed both Claude 3.5 and Gemini 1.5 Pro, achieving a 97.7% F1-score. This demonstrates that LLMs can effectively bridge the gap where traditional syntax-based tools fail.
Discussion and Future Work
While our study provides a holistic view of the VR cloning landscape, it is currently focused on the Unity engine and C# ecosystem. The exclusion of Unreal Engine (which uses binary assets) remains a limitation, as current LLM workflows and NiCad struggle with binary formats. Furthermore, while LLMs are highly accurate, their computational cost poses a challenge for scaling to massive commercial repositories.
Future research will focus on developing VR-specific metrics that account for the spatial and interactive nature of these environments, eventually building an integrated framework capable of simultaneous code and asset analysis.
Summary updated