Unity ads install error from package manager

 When you are trying to install or updating your unity ads sdk from package manager after installing it will showing you two of them error

let me talk about the first error if you are showing error in console and saying

 "Feature `expression bodied members' cannot be used because it is not part of the C# 4.0 language specification" 

like this


Feature `expression bodied members' cannot be used because it is not part of the C# 4.0 language specification
 

G:/games/Unity Games/sample/Library/PackageCache/com.unity.ads@3.4.0/Runtime/Advertisement/Advertisement.cs(25,42): error CS1644: Feature `expression bodied members' cannot be used because it is not part of the C# 4.0 language specification

This error is showing to use because you are using Scripting Runtime Version from .NET 3.5 equivalent which is now deprecated so change it to .NET 4.x Equivalent.

Steps to change it are as follows

1. Open build setting by navigating file and click on build setting as shown in the picture

Build setting in unity


2. When build setting dialog box is open click on player setting
Build setting in unity

3. Now player setting is opened in player navigate to other setting and in other setting you will find configuration section and here you will find scripting runtime version which is currently ".NET 3.5 "

Scripting Runtime Version

Change this Scripting Runtime Version from .NET 3.5 to .NET 4.x equivalent



When select .NET 4.x Equivalent it will ask you to restart just click on restart



and then unity editor will restart and after that there will be no error in unity ads sdk and  console will not going to show you any error

or you can watch video of it



Come to the second type if error 


When You try to upgrade or install unity ads from package manager

showing you an error like this 

Package com.unity.ads@3.4.9 has invalid dependencies:

com.unity.ugui: Package [com.unity.ugui@1.0.0] cannot be found

.unity.ads has invalid dependencies:

In package manager and in console it is 

Assembly has reference to non-existent assembly 'UnityEngine.UI' (Packages/com.unity.ads/Runtime/Advertisement/UnityEngine.Advertisements.asmdef)

Assembly has reference to non-existent assembly 'UnityEngine.UI' (Packages/com.unity.ads/Tests/Runtime/Advertisement/UnityEngine.Advertisements.Tests.asmdef)

Assembly has reference to non-existent assembly 'UnityEngine.UI'


These errors occur because you are using old unity version which have different configuration for UnityEngine.UI an you are trying to install newer Unity ads version

So just remove this version and use other old version of unity ads version by navigating windows -> package manager -> Advertisement and click on all version and select lower or equal version of version 3.4.2

Unity ads version

remember which version you should choose depend on your unity editor version so lower versions.

Can watch a video




Comments

Popular posts from this blog

How to fix Android Gradle Build failed error in unity

How to install unity editor