Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question my app crash when a share button is clicked

Discussion in 'Assets and Asset Store' started by lamfoy10, Nov 21, 2022.

  1. lamfoy10

    lamfoy10

    Joined:
    Nov 13, 2022
    Posts:
    2
    Crash with share button, i'm running my unity application as one activity within a number of them, so want the share button to work and share the screen with social media, the app is work normal in android 9 and below but its keep crash in android 10 and approve when click on share button

    code:

    Code (CSharp):
    1.  protected override async void Awake()
    2.     {
    3.         base.Awake();
    4.         TextsabwayName.font = await ResourceStation.LoadAsset<Font>(eBundle.Font, LocalizationTable.DefaultFont, sFileExtension.Font);
    5.     }
    6.  
    7.     void Start()
    8.     {
    9.         ButtonShare.onClick.AddListener(Share);
    10.         ButtonX.onClick.AddListener(Close);
    11.     }
    12.  
    13.     private void Share()
    14.     {
    15.         MusicSystem.Instance.PlaySound(SoundName.ButtonYes);
    16.         AnalyticsSystem.ShareNewSabway(SabwayTable.Level(ID));
    17.         ShareControl.Share(
    18.                             delegate { ChangeShareState(true); },
    19.                             delegate { ChangeShareState(false); }
    20.                             );
    21.     }
    22.  
    23.     private void ChangeShareState(bool isShare)
    24.     {
    25.         GameObjectLogo.SetActive(isShare);
    26.         ButtonShare.gameObject.SetActive(!isShare);
    27.         ButtonX.gameObject.SetActive(!isShare);
    28.     }
    29.  
    30.     private void Close()
    31.     {
    32.         MusicSystem.Instance.PlaySound(SoundName.ButtonNo);
    33.         Hide();
    34.     }
    35.  
    36.     public void Show(string id)
    37.     {
    38.         ID = id;
    39.         base.Show();
    40.         AnimatorNewsabway.Play("Wait", 0);
    41.         MusicSystem.Instance.PlaySound(SoundName.Newsabway2);
    42.         GameObjectLogo.SetActive(false);
    43.         SetupScreen(id);
    44.     }
    Is there a problem?