Skip to main content

Limitations in Playable Plugin

info

The Luna engine has been built in-house by the Luna team, with the goal of allowing you to create your playable ads in Unity, and having the same output and experience in the browser.

There are a number of hard limitations that comes with this, as well as some APIs which we currently do not support.

Limitations

DLLs

DLLs are currently unsupported in Luna.

What can you do?

Replace the DLL with the plug-in C# source code. C++ plugins are not supported.

Ads and Analytics SDKs

Ads and Analytics SDKs are not supported in Playable ads, and therefore Luna does not support them.

What can you do?

You have a few options:

  • Use Automatic Stubbing to remove the SDKs from your project.
  • Wrap calls to these SDKs using #if !UNITY_LUNA.
  • Remove references to the SDKs entirely from your code.

Avatar Animations

Avatar-based animations (both generic and humanoid) are not supported.

What can you do?

  • A work around is to re-bake the animations to target skinned mesh directly.

NavMesh is currently unsupported by Luna - whilst it is on the roadmap, it can be computationally expensive and so an alternative may be preferred for a playable experience.

What can you do?

  • The A* C# plugin from the asset store is a great alternative, and has been tested by Luna.
  • Implement you logic manually in C#.
  • Implement node-based Movement.

URP/HDRP

HDRP is currently unsupported, with no short term plans to add support.

What can you do?

Use Universal Render Pipeline or Unity's built-in Default render pipeline.

Shadows

Shadows are supported only for the built-in pipeline.

WebGL / Shader targets

Additive Shaders

While we do support them, problems can arise due to the limitations of using WebGL1: WebGL1 can't handle values greater than 1, or less than 0. So the output will be clamped between these values.

E.g. Overlit = White (1,1,1,1) + Red (1,0,0,1). Rather than getting the expected value of (2,1,1,2) it will be clamped to (1,1,1,1)

Please be aware this could lead to unexpected outcomes when performing this type of operation, and the colour seen may not be what you intended.

Precompiled Shaders

Shaders marked with Compiled code: none (Precompiled shaders) are not currently supported. Using such shaders can produce Type error: Cannot read property val of null. (on line offsetUnits.val)

Shader Targets

Luna always initialises WebGL 1.0 context for compatibility reasons (even when WebGL 2.0 is available). This leads to limited support of newer shader features (the exact set varies from device to device due to different vendor-specific extensions available). To make sure Luna is able to utilize all your shader code, please try running the game targeting OpenGL ES 2 API.

Bridge Limitations

Luna transpiles C# code to JS with the Bridge.NET library, however Bridge only supports up to C# 7.0. This means features added in later releases (7.1, 7.2 etc.) will likely not be supported in Luna.

For a list of C# 7.1+ features that we do support, click here.

Examples of such features, with workarounds for each:

Destructor (~TypeName method)

Example of unsupported behaviour:

    class myClass {
~myClass() {}
}

One workaround for this would be to instead use OnDestroy().

GOTO statement

Example of unsupported behaviour:

switch (n)
{
case 1:
cost += 25;
break;
case 2:
cost += 25;
goto case 1;
case 3:
cost += 50;
goto case 1;
default:
Console.WriteLine("Invalid selection.");
break;
}

One workaround for this is to use functions in place of looping back:

private static void costUp(int n){
cost += n * 25;
}

if (n != null){
costUp(n)
}

In other cases it might be better to use recursion in place of goto logic.

Circular inheritance with interfaces

Example of unsupported behaviour:

interface A extends B {}

interface B extends A {}

To workaround this you will need to break such inheritance and rewrite the code without it.

Inline cast

When attempting an inline cast, be sure to have declared the variable prior to casting.

However to avoid complications we suggest avoiding inline casting entirely.

Example of what to do:

double varDouble = 2.3;
int varInt;

varInt = (int) varDouble;

Bridge Implemented Features

As previously mentioned, Luna transpiles C# code into JavaScript by using Bridge.NET library. Listed below is a list of all the C# 7.0-7.3 features that have been implemented or are planned to be implemented.

info

Playable Plugin offers support for C# 7.0 features. Please refer to the C# documentation to see the differences between the various versions.

C# 7.0-7.3 features

FeatureSupport
Out variablesSupported
Tuples and deconstructionSupported
Pattern matchingSupported
Local functionsSupported
Expanded Expression-bodied membersSupported
Ref locals and returnsSupported
DiscardsSupported
Throw expressionsSupported
Default Literal expressionsSupported
In modifiers on parametersSupported
Non-trailing names argumentsSupported
== and != with tuple typesSupported

Luna Compiler V2

For more information C# 8.0/9.0 features, please check the Luna Compiler V2 guide.

Lighting

While lighting is supported, there are limitations surrounding the number of lights that have high intensity settings.

For example, if you have a light component and set its intensity to 1 and have additional lights in the scene as well, with intensities set to 1 or higher as these lights are summed in Luna causing over lit scenes in your Luna build.

This is a limitation of WebGL 1.0.

Unity GUI

Luna does not support the old Unity GUI system.

DOTS or ECS

We don't support Unity DOTs or ECS.