Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f3f0139

Browse files
Support generic "factory functions" with derived types
Remove obsolete MonoBehaviour functionality Simplify example JSON config and C++ game code
1 parent 156646d commit f3f0139

File tree

13 files changed

+3681
-35058
lines changed

13 files changed

+3681
-35058
lines changed

‎README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ C++ is the standard language for video games as well as many other fields. By pr
9494
* Methods
9595
* Fields
9696
* Properties (getters and setters)
97-
* `MonoBehaviour` classes with "message" functions like `Update`
9897
* `out` and `ref` parameters
9998
* Exceptions
10099
* Overloaded operators
@@ -105,6 +104,7 @@ C++ is the standard language for video games as well as many other fields. By pr
105104
* Implementing C# interfaces with C++ classes
106105
* Deriving from C# classes with C++ classes
107106
* Default parameters
107+
* Generic types and methods
108108

109109
# Performance
110110

@@ -140,7 +140,7 @@ With C++, the workflow looks like this:
140140
2. Copy everything in `Unity/Assets` directory to your Unity project's `Assets` directory
141141
3. Copy the `Unity/CppSource` directory to your Unity project directory
142142
4. Edit `NativeScriptTypes.json` and specify what parts of the Unity, .NET, and custom DLL APIs you want access to from C++.
143-
5. Edit `Unity/CppSource/Game/Game.cpp` to create your game. Some example code is provided, but feel free to delete it. You can add more C++ source (`.cpp`) and header (`.h`) files here as your game grows.
143+
5. Edit `Unity/CppSource/Game/Game.cpp` and `Unity/CppSource/Game/Game.h`to create your game. Some example code is provided, but feel free to delete it. You can add more C++ source (`.cpp`) and header (`.h`) files here as your game grows.
144144

145145
# Building the C++ Plugin
146146

@@ -170,7 +170,7 @@ With C++, the workflow looks like this:
170170
2. Create a directory for build files. Anywhere is fine.
171171
3. Open a Command Prompt by clicking the Start button, typing "Command Prompt", then clicking the app
172172
4. Execute `cd /path/to/your/build/directory`
173-
5. Execute `cmake -G "Visual Studio VERSION YEAR Win64" -DEDITOR=TRUE /path/to/your/project/CppSource`. Replace `VERSION` and `YEAR` with the version of Visual Studio you want to use. To see the options, execute `cmake --help` and look at the list at the bottom. For example, use `"`Visual Studio 15 2017 Win64` for Visual Studio 2017. Any version, including Community, works just fine. Remove `-DEDITOR=TRUE` for standalone builds.
173+
5. Execute `cmake -G "Visual Studio VERSION YEAR Win64" -DEDITOR=TRUE /path/to/your/project/CppSource`. Replace `VERSION` and `YEAR` with the version of Visual Studio you want to use. To see the options, execute `cmake --help` and look at the list at the bottom. For example, use `"Visual Studio 15 2017 Win64"` for Visual Studio 2017. Any version, including Community, works just fine. Remove `-DEDITOR=TRUE` for standalone builds.
174174
6. The project files are now generated in your build directory
175175
7. Open `NativeScript.sln` and click `Build > Build Solution`.
176176

@@ -202,7 +202,6 @@ To configure the code generator, open `NativeScriptTypes.json` and notice the ex
202202

203203
Note that the code generator does not support (yet):
204204

205-
* `MonoBehaviour` contents (e.g. fields) except for "message" functions
206205
* `Array`, `string`, and `object` methods (e.g. `GetHashCode`)
207206
* Non-null string default parameters and null non-string default parameters
208207
* Implicit `params` parameter (a.k.a. "var args") passing

‎Unity/Assets/Game.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using UnityEngine;
2+
3+
namespace MyGame
4+
{
5+
/// <summary>
6+
/// Base class of a script used in the example code to make a "ball" bounce
7+
/// back and forth on the screen
8+
/// </summary>
9+
/// <author>
10+
/// Jackson Dunstan, 2018, http://JacksonDunstan.com
11+
/// </author>
12+
/// <license>
13+
/// MIT
14+
/// </license>
15+
public abstract class AbstractBaseBallScript : MonoBehaviour
16+
{
17+
public abstract void Update();
18+
}
19+
}

‎Unity/Assets/Game/AbstractBaseBallScript.cs.meta

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

‎Unity/Assets/NativeScript/Bindings.cs

Lines changed: 463 additions & 7525 deletions
Large diffs are not rendered by default.

‎Unity/Assets/NativeScript/BootScript.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ void Awake()
3939
#if UNITY_EDITOR
4040
void Update()
4141
{
42+
Bindings.Update();
43+
4244
if (AutoReload)
4345
{
4446
if (AutoReloadPollTime > 0)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /