Skip to content

Commit 2ca3654

Browse files
Update README
1 parent 93a63da commit 2ca3654

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

README.md

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ A significant amount of effort is required to work around the GC and the resulti
3333

3434
C++ has no required garbage collector and features optional automatic memory management via "smart pointer" types like [shared_ptr](http://en.cppreference.com/w/cpp/memory/shared_ptr). It offers excellent alternatives to Unity's primitive garbage collector.
3535

36+
While using some .NET APIs will still involve garbage creation, the problem is contained to only those APIs rather than being a pervasive issue for all your code.
37+
3638
## Total Control
3739

3840
By using C++ directly, you gain complete control over the code the CPU will execute. It's much easier to generate optimal code with a C++ compiler than with a C# compiler, IL2CPP, and finally a C++ compiler. Cut out the middle-man and you can take advantage of compiler intrinsics or assembly to directly write machine code using powerful CPU features like [SIMD](http://jacksondunstan.com/articles/3890) and hardware AES encryption for massive performance gains.
@@ -66,7 +68,6 @@ While IL2CPP transforms C# into C++ already, it generates a lot of overhead. The
6668
transform.SetPosition(position);
6769

6870
* No need to reload the Unity editor when changing C++
69-
* Code generator exposes any C# API (Unity, .NET, custom DLLs) with a simple JSON config file
7071
* Handle `MonoBehaviour` messages in C++
7172

7273
>
@@ -77,12 +78,27 @@ While IL2CPP transforms C# into C++ already, it generates a lot of overhead. The
7778

7879
* Platform-dependent compilation via the [usual flags](https://docs.unity3d.com/Manual/PlatformDependentCompilation.html) (e.g. `#if UNITY_EDITOR`)
7980
* [CMake](https://cmake.org/) build system sets up any IDE project or command-line build
81+
* Code generator exposes any C# API (Unity, .NET, custom DLLs) with a simple JSON config file and runs from a menu in the Unity editor. It supports a wide range of features:
82+
* Class types
83+
* Struct types
84+
* Enumeration types
85+
* Base classes
86+
* Constructors
87+
* Methods
88+
* Fields
89+
* Properties (getters and setters)
90+
* `MonoBehaviour` classes with "message" functions like `Update`
91+
* `out` and `ref` parameters
92+
* Exceptions
93+
* Overloaded operators
94+
* Arrays (single- and multi-dimensional)
95+
* Delegates
8096

8197
# Performance
8298

83-
[Article](http://jacksondunstan.com/articles/3952).
99+
Most projects will see a net performance win by reducing garbage collection, eliminating IL2CPP overhead, and access to compiler intrinsics and assembly. Calls from C++ into C# incur a minor performance penalty, so if most of your code is calls to .NET APIs then you may experience a net performance loss.
84100

85-
tl;dr - Most projects will not be noticeably impacted by C++ overhead and many projects will benefit from reducing garbage collection, eliminating IL2CPP overhead, and access to compiler intrinsics and assembly.
101+
For testing and benchmarks, see this [article](http://jacksondunstan.com/articles/3952).
86102

87103
# Project Structure
88104

@@ -170,24 +186,7 @@ To run the code generator, choose `NativeScript > Generate Bindings` from the Un
170186

171187
To configure the code generator, open `NativeScriptTypes.json` and notice the existing examples. Add on to this file to expose more C# APIs from Unity, .NET, or custom DLLs to your C++ code.
172188

173-
The code generator supports:
174-
175-
* Class types (including generics)
176-
* Struct types (including generics)
177-
* Base classes (including generics)
178-
* Constructors (including generic parameters)
179-
* Methods (including generic parameters and return types)
180-
* Fields (including generic types)
181-
* Properties (getters and setters) (including generic types)
182-
* `MonoBehaviour` classes with "message" functions like `Update`
183-
* `out` and `ref` parameters
184-
* Enumerations
185-
* Exceptions
186-
* Overloaded operators
187-
* Arrays (single- and multi-dimensional)
188-
* Delegates
189-
190-
The code generator does not support (yet):
189+
Note that the code generator does not support (yet):
191190

192191
* Events
193192
* Boxing and unboxing (e.g. boxing `int` to `object`, casting `object` to `int`)
@@ -196,7 +195,7 @@ The code generator does not support (yet):
196195
* Default parameters
197196
* Interfaces
198197
* `decimal`
199-
* Pointers
198+
* C# pointers
200199

201200
# Updating To A New Version
202201

0 commit comments

Comments
 (0)