public static int GetRenderTexture2dId(this SpriteBatchSystem system) { var possibleAttributes = system.GetType() .GetCustomAttributes(typeof(ToRenderTexture2dAttribute), true); if (!possibleAttributes.Any()) { return(-1); } var attribute = (ToRenderTexture2dAttribute)possibleAttributes.First(); return(attribute.RenderTextureId); }