Unity Issue Tracker - Warning When Building Mixed Reality Template: MonoBehaviour Instantiated with new Keyword
Closed
XRCLB-126
Warning When Building Mixed Reality Template: MonoBehaviour Instantiated with new Keyword
Package: XR Composition Layers
Fixed
2.1.X
Won't Fix
2.0.X
The Composition Layers package does not do backports to previous versions.
Steps to reproduce:
Open Unity Hub
Create a new project using the Mixed Reality Template
Build the project
Observe the console after the build completes
Actual results: The warning appears:
"You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all"
Expected results: No warnings should occur after building the template
Reproducible with versions: 2.1.2 (6000.2.0b7), 2.1.1 (6000.2.8f1)
Not reproducible with versions: 6000.0.51f1, 6000.1.8f1
Tested on (OS): macOS 15.3 (Intel)
Prioritise and Follow this issue
Have a workaround or additional info about this issue?