Search Unity

Question Method with parameter of Type Scene can not be added to OnClick event

Discussion in 'UGUI & TextMesh Pro' started by unity_O4p1JtHGmTwVkw, Apr 8, 2023.

  1. unity_O4p1JtHGmTwVkw

    unity_O4p1JtHGmTwVkw

    Joined:
    Oct 11, 2021
    Posts:
    2
    The first two methods can be added to Onclick() events without trouble.
    But I cannot select the third one.

    What could be the problem here?

    Code (CSharp):
    1.     public void selectMainWeapon(GameObject weapon){
    2.         primary = weapon;
    3.     }
    4.  
    5.     public void selectSecondaryWeapon(GameObject weapon){
    6.         secondary = weapon;
    7.     }
    8.  
    9.     public void loadMap(Scene scene){
    10.         if(primary != null && secondary != null){
    11.             SceneManager.LoadScene(scene.name);
    12.         }else{
    13.             Debug.Log("Not enough weapons selected");
    14.         }
    15.     }