Unable to find the UserPermissionToPost
Have you made sure that you’re using the latest Mobile Notifications package?
This API didn’t exist < 2.1.0. So check your package manager whether it is up to date or not.
I’ve tried it in a project using Unity 2021.3.16 LTS and it works fine to me.
using Unity.Notifications.Android;
using UnityEngine;
public class NotificationComponent : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
var permission = AndroidNotificationCenter.UserPermissionToPost;
}
}
If you’re not receiving any errors in the console but the red line persists, you’ll need to regenerate the csproj files.
Edit > Preferences > External Tools > Regenerate project files
Thx a lot, i need to update my unity version and the package version