The wrapper class used to intertact with the Unity Ads SDK.
Inheritance
Musical beat detection and audio spectrum analysis for use with the Unity game engine. The AudioProcessor class contains an interface that can be implemented on your GameObject. Usage Add the AudioProcessor script to your Main Camera object and adjust the threshold parameter to change the sensitivity. An IUnityAdsListener method that handles logic for an ad finishing. Define conditional behavior for different finish states by accessing the ShowResult result from the listener (documented below). C# (CSharp) UnityEngine.Events UnityEvent - 30 examples found. These are the top rated real world C# (CSharp) examples of UnityEngine.Events.UnityEvent extracted from open source projects. You can rate examples to help us improve the quality of examples. Add a non persistent listener to the UnityEvent. Use this to add a runtime callback. Adding multiple identical listeners results in only a single call being made.
Namespace: UnityEngine.Advertisements
Syntax
Add a non persistent listener to the UnityEvent. Use this to add a runtime callback. Adding multiple identical listeners results in only a single call being made.
Properties
debugMode
Returns true if the SDK is is in debug mode, and false if it isn't. Debug mode controls the level of logging from the SDK.
Declaration
Unity Button Listener
Property Value
| Type | Description |
|---|---|
| System.Boolean |
isInitialized
Returns true if the SDK is initialized successfully, and false if it isn't.
Declaration
Property Value
| Type | Description |
|---|---|
| System.Boolean |
isShowing
Returns true if an ad is currently showing, and false if it isn't.
Declaration
Property Value
| Type | Description |
|---|---|
| System.Boolean |
isSupported
Returns true if the SDK is supported on the current platform, and false if it isn't.
Declaration
Property Value
| Type | Description |
|---|---|
| System.Boolean |
version
Declaration
Property Value
| Type | Description |
|---|---|
| System.String |
Methods
AddListener(IUnityAdsListener)
Adds a listener that will recieve Unity Ads callbacks. SDK versions 3.1+ allow you to register multiple listeners. This is especially helpful for mediation customers.
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityAdsListener | listener | A listener for Unity Ads callbacks. |
GetPlacementState()
Declaration
Returns
| Type | Description |
|---|---|
| PlacementState |
GetPlacementState(String)
Returns the state of a specified Placement.
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | placementId | The unique identifier for a specific Placement, found on the developer dashboard. |
Returns
| Type | Description |
|---|---|
| PlacementState |
Initialize(String)
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | gameId | The platform-specific Unity game identifier for your Project, found on the developer dashboard. |
Initialize(String, Boolean)
Initializes the SDK with a specified Game ID and test mode setting.
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | gameId | The platform-specific Unity game identifier for your Project, found on the developer dashboard. |
| System.Boolean | testMode | Test mode allows you to test your integration without serving live ads. Use |
Initialize(String, Boolean, Boolean)
Initializes the SDK with a specified Game ID, test mode setting, and Placement load setting.
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | gameId | The platform-specific Unity game identifier for your Project, found on the developer dashboard. |
| System.Boolean | testMode | Test mode allows you to test your integration without serving live ads. Use |
| System.Boolean | enablePerPlacementLoad | Enable the load API lifecycle. See Load(String) for more information. |
IsReady()
Returns true if an ad is available to display on the default Placement, and false if it isn't.
Declaration
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsReady(String)
Returns true if an ad is available to display for a specified Placement, and false if it isn't.
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | placementId | The unique identifier for a specific Placement, found on the developer dashboard. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Load(String)
Loads ad content for a specified Placement. If you initialized the SDK with enablePerPlacementLoad enabled, you must call Load before calling Show.
The Load API is in closed beta and available upon invite only. If you would like to be considered for the beta, please cantact unityads-support@unity3d.com.
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | placementId | The unique identifier for a specific Placement, found on the developer dashboard. |

See Also
RemoveListener(IUnityAdsListener)
Addlistener Unity Button
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityAdsListener | listener | A listener for Unity Ads callbacks. |
SetMetaData(MetaData)
Sets various metadata for the SDK.
Declaration
Parameters

| Type | Name | Description |
|---|---|---|
| MetaData | metaData | A metadata container. |
Show()
Displays an ad in the default Placement if it is ready.
Declaration
See Also
Show(String)
Displays an ad in a specified Placement if it is ready. Gary lineker twitter.
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | placementId | The unique identifier for a specific Placement, found on the developer dashboard. |
See Also
Show(String, ShowOptions)
Displays an ad in a specified Placement if it is ready, and passes a ShowResult enum to the ShowOptions.resultCallback callback when the ad finishes.
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | placementId | The unique identifier for a specific Placement, found on the developer dashboard. |
| ShowOptions | showOptions | A collection of options, including |
Show(ShowOptions)
Displays an ad in the default Placement if it is ready, and passes a ShowResult enum to the ShowOptions.resultCallback callback when the ad finishes.
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| ShowOptions | showOptions | A collection of options, including |
- Delegates
- Events
- Example
Objective
The main objective of the blog post is to give idea about how to create and use delegates in unity.You will get final output:
Step 1 Delegate
1.1 Concept
Delegates are somewhat reference type of variables, used to hold the reference of methods having the same signature as that of the declared delegate. Delegate reference can be changed at runtime. When called, it notifies all the methods, which are being referenced by it.
1.2 Application
You can use delegates in scripting when:
- Want to invoke multiple methods on single event at runtime.
- Used to trigger callback methods.
1.3 Types
Basically there are two types of delegates:
- Single Delegate
- Multicast Delegate
1.4 Syntax
Button Addlistener Unity
To declare delegates in unity C#:
The Parameters_list is optional.
Step 2 Events
2.1 Concept
Events are a type of special delegates which are used when you want to notify other classes when something happens. Like, on button click, Coin collected, on level completion. Any class interested in that event can subscribe it and can call it when that particular event occurs. Events can be declared using Delegates.
2.2 Syntax
To declare event in unity C#: -
Step 3 Example
Addlistener Unity
To change the color and position of the ball at runtime, click on Play button.
3.1 DelegateHandler.cs Script
Create an empty gameobject and apply the script called DelegateHandler.cs
3.2 ColorAndMovement.cs Script
Unity Button Onclick Parameter
I hope you find this blog is very helpful while using Delegates and events in Unity. Let me know in comment if you have any questions regarding in Unity. I will reply you ASAP
Got an Idea of Game Development? What are you still waiting for? Contact us now and see the Idea live soon. Our company has been named as one of the best Game Development Company in India.
I am a game developer trying to explore my knowledge by implementing new concepts so that games can be made more creative and innovative.
