I'm doing a project for iOS in Unity and all works fine, but I'd like to also build for Web Player for testing purposes. The problem is once I switch platform to Web Player I get the following errors.
Assets/Main.cs(50,45): error CS0117: `System.IO.File' does not contain a definition for `ReadAllText'
Assets/Main.cs(51,29): error CS1502: The best overloaded method match for `SimpleJSON.JSON.Parse(string)' has some invalid arguments
Assets/Main.cs(51,29): error CS1503: Argument `#1' cannot convert `object' expression to type `string'
Obviously it's about unsupported API in Web Player, but how do I get around that?
You need to use "Platform Dependent Compilation" http://docs.unity3d.com/Manual/PlatformDependentCompilation.html
And include any platform specific code in relevant ifs, elifs and endifs.
#if !UNITY_WEBPLAYER
using System.IO.File;
#endif
Related
I am trying to make a Unity racing game using Universal Vehicle Controller from the asset store. The problem is that after importing this asset (which includes dependencies) I get this message in the console:
Library\PackageCache\com.unity.render-pipelines.universal#10.4.0\Editor\ShaderGraph\Targets\UniversalTarget.cs(191,37): error CS0117: 'Fields' does not contain a definition for 'AlphaClip'
That's pretty much it. I encountered this issue on Unity Version 2021.3.1f1/2f1/8f1 and on asset's version 1.3.121. Thanks!
I am currently implementing Video call using Agora in Unity. I am facing an error which shows "error CS1061: 'VideoSurface' does not contain a definition for 'mAdjustTransform' and no accessible extension method 'mAdjustTransform' accepting a first argument of type 'VideoSurface' could be found (are you missing a using directive or an assembly reference?)"
Please help me.....:(
I'm using Unity version 5.5.0f3 and getting an error during development. It's showing an error on this line of code:
var assembly = Security.LoadAndVerifyAssembly(www.bytes);
The error message I'm getting:
UnityEngine.Security.LoadAndVerifyAssembly(byte[])' is obsolete:This was an internal method which is no longer used'
As per the documentation, this method is used by the Web Player. However:
Note that web player is not supported from 5.4.0, so this function no longer serves a purpose and will be deprecated.
If you really want to continue using this method, you can try downloading a prior version of Unity from the Download Archive - though I would recommend against working on Web Player projects since they will become even more difficult to maintain going forward without official support.
I'm using cocoa pods and map box was working fine but I installed an update and this message appeared:
Now I can't run my project. I'm using map box iOS sdk 3.3.4. What should I do to fix this issue?
According to apple documentation:
The Swift compiler automatically imports Objective-C code as conventional Swift code. There may be edge cases in your code that are not automatically handled. If you need to change the name imported by Swift of an Objective-C method, enumeration case, or option set value, you can use the NS_SWIFT_NAME macro to customize how a declaration is imported. See more.
So all what I did was delete the implementation of the NS_SWIFT_NAME and with that I was able to build the project. I don't know what made this error appear but this was the best solution I found.
Example:
From this:
- (instancetype)recordWithRPM:(NSUInteger)RPM NS_SWIFT_NAME(init(RPM:));
To this:
- (instancetype)recordWithRPM:(NSUInteger)RPM;
I'm trying to make midroll ads work with DFP on Roku and I'm having some trouble.
I'm reading the docs on using the Roku Advertising Framework (RAF) and it says to put Library "Roku_Ads.brs" into the code where I want to use RAF. Since it uses the Library call, it leads me to assume that the library is included in Roku and doesn't have to be downloaded separately.
However, when I put Library "Roku_Ads.brs" at the top of my lib/ads.brs file, I always get the following error:
*** ERROR compiling /pkg:/source/lib/ads.brs:
Error loading file. (compile error &hb9) in pkg:/source/lib/ads.brs(1) 'Roku_Ads.brs'
What am I missing here? Is there some Roku_Ads.brs file that I need to download from somewhere first?
Thanks for the help!
Be sure to add the following line to your manifest:
bs_libs_required=roku_ads_lib