Unity CreateGlobalKeyword must not run in a ScriptableObject constructor or field initializer
@vpark915▲ 0 net votes
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.