Search Unity

Help with a Script

Discussion in 'Scripting' started by Cerberus_team, Feb 10, 2016.

  1. Cerberus_team

    Cerberus_team

    Joined:
    Apr 9, 2014
    Posts:
    43
    Can anyone help me with this, i am trying to make this script so that the second class (Mobile Platform) only appears in the inspector when the boolean (Mobile) is activated on the (Platform) class.

    Code (CSharp):
    1.  
    2. public class Splash : MonoBehaviour {
    3.    
    4.  
    5.     public static bool  IsMobile;
    6.     public static bool  IsConsole;
    7.     public static bool  IsDesktop;
    8.    
    9.     public static bool  IsGooglePlay;
    10.     public static bool  IsAmazon;
    11.     public static bool  IsSamsung;
    12.     public static bool  IsThirdParty;
    13.  
    14.  
    15.     [Space (10)]
    16.     public Platform SetGlobalPlatform;
    17.  
    18.     [Space (10)]
    19.     public MobilePlatform SetMobilePlatform;
    20.  
    21.  
    22.     [Serializable]
    23.     public class Platform : System.Object {
    24.        
    25.         public bool  Mobile;
    26.         public bool  Console;
    27.         public bool  Desktop;
    28.     }
    29.  
    30.     [Serializable]
    31.     public class MobilePlatform : System.Object {
    32.        
    33.         public bool  GooglePlay;
    34.         public bool  Amazon;
    35.         public bool  Samsung;
    36.         public bool  ThirdParty;
    37.     }
    38.    
    39.     void  Awake (){
    40.        
    41.         IsMobile = SetGlobalPlatform.Mobile;
    42.         IsConsole = SetGlobalPlatform.Console;
    43.         IsDesktop = SetGlobalPlatform.Desktop;
    44.        
    45.         IsGooglePlay = SetMobilePlatform.GooglePlay;
    46.         IsAmazon = SetMobilePlatform.Amazon;
    47.         IsSamsung = SetMobilePlatform.Samsung;
    48.         IsThirdParty = SetMobilePlatform.ThirdParty;
    49.     }
    50. }
    Any help would be appreciated, thank you.
     
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148