Skip to content

Commit 00dd1cd

Browse files
Move Bindings.json and BindingConstants.cs out of NativeScript
Rename BindingConstants.cs to NativeScriptConstants.cs
1 parent 3d12624 commit 00dd1cd

File tree

7 files changed

+46
-49
lines changed

7 files changed

+46
-49
lines changed

Unity/Assets/NativeScript/Bindings.json.meta renamed to Unity/Assets/Bindings.json.meta

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Unity/Assets/NativeScript/BindingConstants.cs

Lines changed: 0 additions & 41 deletions
This file was deleted.

Unity/Assets/NativeScript/Bindings.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public void Open()
215215

216216
// Open native library
217217
libraryHandle = OpenLibrary(
218-
Application.dataPath + BindingConstants.PluginPath);
218+
Application.dataPath + NativeScriptConstants.PluginPath);
219219
InitDelegate Init = GetDelegate<InitDelegate>(
220220
libraryHandle,
221221
"Init");
@@ -226,9 +226,9 @@ public void Open()
226226
#endif
227227

228228
// Init C++ library
229-
ObjectStore.Init(BindingConstants.MaxManagedObjects);
229+
ObjectStore.Init(NativeScriptConstants.MaxManagedObjects);
230230
Init(
231-
BindingConstants.MaxManagedObjects,
231+
NativeScriptConstants.MaxManagedObjects,
232232
Marshal.GetFunctionPointerForDelegate(new ReleaseObjectDelegate(ReleaseObject)),
233233
Marshal.GetFunctionPointerForDelegate(new StringNewDelegate(StringNew)),
234234
/*BEGIN INIT CALL*/

Unity/Assets/NativeScript/Editor/GenerateBindings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static void Generate(bool dryRun)
128128
// Load JSON
129129
string jsonPath = Path.Combine(
130130
Application.dataPath,
131-
BindingConstants.BindingsJsonPath);
131+
NativeScriptConstants.BindingsJsonPath);
132132
string json = File.ReadAllText(jsonPath);
133133
JsonDocument doc = JsonUtility.FromJson<JsonDocument>(json);
134134

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/// <summary>
2+
/// Constants used by the C++ scripting system. Redefine these with values
3+
/// specific to your project.
4+
/// </summary>
5+
/// <author>
6+
/// Jackson Dunstan, 2017, http://JacksonDunstan.com
7+
/// </author>
8+
/// <license>
9+
/// MIT
10+
/// </license>
11+
public static class NativeScriptConstants
12+
{
13+
/// <summary>
14+
/// Name of the plugin used by [DllImport] when running outside the editor
15+
/// </summary>
16+
public const string PluginName = "NativeScript";
17+
18+
/// <summary>
19+
/// Path to load the plugin from when running inside the editor
20+
/// </summary>
21+
#if UNITY_EDITOR_OSX
22+
public const string PluginPath = "/NativeScript.bundle/Contents/MacOS/NativeScript";
23+
#elif UNITY_EDITOR_LINUX
24+
public const string PluginPath = "/NativeScript.so";
25+
#elif UNITY_EDITOR_WIN
26+
public const string PluginPath = "/NativeScript.dll";
27+
#endif
28+
29+
/// <summary>
30+
/// Maximum number of simultaneous managed objects that the C++ plugin uses
31+
/// </summary>
32+
public const int MaxManagedObjects = 1024;
33+
34+
/// <summary>
35+
/// Path within the Unity project to the Bindings JSON file
36+
/// </summary>
37+
public const string BindingsJsonPath = "Bindings.json";
38+
}

Unity/Assets/NativeScript/BindingConstants.cs.meta renamed to Unity/Assets/NativeScriptConstants.cs.meta

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)