private static FyberSettings GetInstance()
		{
			if (instance == null)
			{
				PluginBridge.bridge = new PluginBridgeComponent();
				instance = Resources.Load(fyberSettingsAssetName) as FyberSettings;
				if (instance == null)
				{
					// If not found, autocreate the asset object.
					instance = CreateInstance<FyberSettings>();
#if UNITY_EDITOR
					string properPath = Path.Combine(Application.dataPath, fyberSettingsPath);
					if (!Directory.Exists(properPath))
					{
						AssetDatabase.CreateFolder("Assets/Fyber", "Resources");
					}
					
					string fullPath = Path.Combine(Path.Combine("Assets", fyberSettingsPath),
					                               fyberSettingsAssetName + fyberSettingsAssetExtension
					                               );
					instance.hideFlags = HideFlags.HideInInspector;
					AssetDatabase.CreateAsset(instance, fullPath);
#endif
				}
			}
			return instance;
		}
Example #2
0
        private static FyberSettings GetInstance()
        {
            if (instance == null)
            {
                PluginBridge.bridge = new PluginBridgeComponent();
                instance            = Resources.Load(fyberSettingsAssetName) as FyberSettings;
                if (instance == null)
                {
                    // If not found, autocreate the asset object.
                    instance = CreateInstance <FyberSettings>();
#if UNITY_EDITOR
                    string properPath = Path.Combine(Application.dataPath, fyberSettingsPath);
                    if (!Directory.Exists(properPath))
                    {
                        AssetDatabase.CreateFolder("Assets/OfferWallEdge", "Resources");
                    }

                    string fullPath = Path.Combine(Path.Combine("Assets", fyberSettingsPath),
                                                   fyberSettingsAssetName + fyberSettingsAssetExtension
                                                   );
                    instance.hideFlags = HideFlags.HideInInspector;
                    AssetDatabase.CreateAsset(instance, fullPath);
#endif
                }
            }
            return(instance);
        }
        public void StartSDK(string json)
        {
            using (AndroidJavaClass mediationStarter = new AndroidJavaClass("com.fyber.mediation.MediationAdapterStarter"))
            {
                FyberSettings settings = FyberSettings.Instance;
                mediationStarter.CallStatic("setup", settings.BundlesInfoJson(), settings.BundlesCount());
            }

            using (AndroidJavaClass mediationStarter = new AndroidJavaClass("com.fyber.mediation.MediationConfigProvider"))
            {
                FyberSettings settings = FyberSettings.Instance;
                mediationStarter.CallStatic("setup", settings.BundlesConfigJson());
            }

            using (AndroidJavaObject plugin = new AndroidJavaObject("com.fyber.unity.FyberPlugin"))
            {
                plugin.CallStatic("setPluginParameters", Fyber.Version, Application.unityVersion);
                plugin.CallStatic("start", json);
            }
        }