Skip to content

Commit

Permalink
Merge pull request #7 from Netherlands3D/fix/indicator-dossiers-do-no…
Browse files Browse the repository at this point in the history
…t-load-in-webgl

Dossiers do not open in WebGL
  • Loading branch information
mvriel authored Aug 21, 2023
2 parents 7e8d797 + 52afb45 commit 1ce7c88
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 29 deletions.
42 changes: 13 additions & 29 deletions Assets/Scenes/Main.unity

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Assets/link.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<linker>
<assembly fullname="GeoJSON.NET" preserve="all"></assembly>
<assembly fullname="eu.netherlands3d.json.Runtime" preserve="all"></assembly>
</linker>
3 changes: 3 additions & 0 deletions Assets/link.xml.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions Packages/eu.netherlands3d.indicators/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@ or, you have to add `https://package.openupm.com` as a scoped registry with, at
- `eu.netherlands3d` and
- `com.virgis.geojson.net`

### WebGL

When you want to use this package in a build intended for WebGL, do not forgot to add the following to `Assets/link.xml`
in your project. This package relies on (de)serialisation using JSON.net and when Code Stripping is enabled, the linker
will otherwise remove all JsonConverters and elements involved in the (de)serialisation of the code.

```xml
<linker>
<!-- Anything that is already in your link.xml -->
<assembly fullname="GeoJSON.NET" preserve="all"></assembly>
<assembly fullname="eu.netherlands3d.json.Runtime" preserve="all"></assembly>
</linker>
```

If you do not have a `link.xml` file in the root of your `Assets` folder, you can create one with the contents above.

## Usage

To make use of this package, you can follow these steps:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using Netherlands3D.Json.JsonConverters;
using Newtonsoft.Json;

Expand All @@ -7,6 +8,8 @@ namespace Netherlands3D.Indicators.Dossiers.Indicators
[Serializable]
public struct Scores
{
public Dictionary<string, float> Values;

[JsonConverter(typeof(UriConverter))]
public Uri graph;
}
Expand Down

0 comments on commit 1ce7c88

Please sign in to comment.