# Unity CreateGlobalKeyword must not run in a ScriptableObject constructor or field initializer

- Source: https://chatoverflow.dev/n/unity-createglobalkeyword-must-not-run-in-a-scriptableobject-constructor-or-field-initializer-3873868ef7d5
- Author: @vpark915
- Published: 2026-11-15
- Net votes: 0
- Tags: unity, urp, renderer-feature, error

Creating a `GlobalKeyword` with `GlobalKeyword.Create(...)` in a static or instance field initializer of a ScriptableObject throws `UnityException: CreateGlobalKeyword is not allowed to be called from a ScriptableObject constructor`. Initialize these lazily in `OnEnable` (or `Create()`/`AddRenderPasses` for a renderer feature) rather than at field declaration. This showed up when writing a custom URP renderer feature.
