Skip to content

Commit c960984

Browse files
committed
Update README.md
1 parent 232199e commit c960984

1 file changed

Lines changed: 80 additions & 12 deletions

File tree

README.md

Lines changed: 80 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Powerful visual scripting toolkit for Unity.
1212

1313
- [Install](#install)
1414
- [Highlights](#highlights)
15-
- [Platform](#platform)
15+
- [Platforms](#platforms)
1616
- [Core Concepts](#core-concepts)
1717
- [Quick Start Guide](#quick-start-guide)
1818
- [Flow Visual Scripting](#flow-visual-scripting)
@@ -40,14 +40,24 @@ Add following dependencies to `manifest.json`.
4040

4141
Use git URL to download package by Unity Package Manager ```https://github.com/AkiKurisu/Ceres.git```.
4242

43-
## Highlights
43+
## Highlights
4444

45-
- Generic and delegate support
46-
- Graph and C# integration
47-
- Editor debugging
48-
- Easy implementation
49-
- Optimized runtime performance
50-
- IL2CPP compatible
45+
> **Powerful visual scripting toolkit** that brings the best of both worlds - visual programming and C# code integration.
46+
47+
### 🚀 **Core Features**
48+
49+
- **🎯 Generic & Delegate Support** - Full support for C# generics and delegates in visual scripting
50+
- **🔗 Graph & C# Integration** - Seamless integration between visual graphs and traditional C# code
51+
- **🐛 Editor Debugging** - Built-in debugging tools with breakpoints and step-by-step execution
52+
- **⚡ Easy Implementation** - Simple setup with minimal configuration required
53+
- **🏃‍♂️ Optimized Runtime Performance** - High-performance execution with IL2CPP optimizations
54+
- **📱 IL2CPP Compatible** - Fully compatible with IL2CPP builds and recommended for production
55+
56+
### 🎨 **Visual Excellence**
57+
58+
- **Intuitive Node-Based Editor** - Clean, modern interface for creating visual scripts
59+
- **Real-time Preview** - See your logic flow as you build it
60+
- **Professional Workflow** - Industry-standard tools and practices
5161

5262
## Platforms
5363

@@ -115,7 +125,7 @@ Click `Open Flow Graph` in the Inspector panel to open the Flow Graph Editor.
115125
![Open Flow Graph](./Documentation~/resources/Images/flow_quick_start_1.png)
116126

117127
### 4. Create Start Event
118-
Right click the graph and click `Create Node/Select Events/Implement Start`.
128+
Right-click the graph and click `Create Node/Select Events/Implement Start`.
119129

120130
![Create Node](./Documentation~/resources/Images/flow_quick_start_2.png)
121131

@@ -334,6 +344,62 @@ Relay nodes are completely flattened during serialization. At runtime, connectio
334344

335345
The picture above shows relay nodes do not effect execution flow (only forward execution three times for `Start`, `Find GameObject`, and `Log String`).
336346

347+
348+
### IL2CPP Call
349+
350+
Ceres implements sophisticated IL2CPP optimizations to achieve near-native performance for executable function calls. The optimization strategy varies by platform to maximize performance while maintaining compatibility.
351+
352+
#### Platform-Specific Optimizations
353+
354+
**Windows & Android Platforms**
355+
For Windows and Android builds, Ceres directly utilizes IL2CPP's native API to bypass reflection overhead entirely:
356+
357+
```csharp
358+
#if ENABLE_IL2CPP && (UNITY_STANDALONE_WIN || UNITY_ANDROID)
359+
unsafe
360+
{
361+
if (functionType == ExecutableFunctionType.InstanceMethod && _il2cppClass != IntPtr.Zero)
362+
{
363+
// Direct IL2CPP method lookup and function pointer invocation
364+
var ptr = IL2CPP.GetIl2CppMethod(_il2cppClass, $"Invoke_{functionName}", invokeParameterCount);
365+
if (ptr != IntPtr.Zero)
366+
{
367+
functionStructure = new ExecutableFunction(functionInfo, ptr, false);
368+
_functions.Add(functionStructure);
369+
return functionStructure;
370+
}
371+
}
372+
}
373+
#endif
374+
```
375+
376+
This approach provides the highest performance by:
377+
- **Direct Function Pointer Calls**: Using `delegate* unmanaged[Cdecl]` function pointers for zero-overhead method invocation
378+
- **Native IL2CPP API**: Leveraging `il2cpp_class_get_method_from_name` and `il2cpp_method_get_function_pointer` for direct method resolution
379+
- **Bypassing Reflection**: Eliminating `MethodInfo` overhead completely at runtime
380+
381+
**Other Platforms**
382+
For platforms where direct IL2CPP API access is limited, Ceres uses IL Post Processing (ILPP) to inject static bridge functions:
383+
384+
```csharp
385+
#if ENABLE_IL2CPP
386+
// We haven't injected IL in always included assembly, use legacy way in this case.
387+
if (!FlowConfig.IsIncludedAssembly(targetType.Assembly))
388+
{
389+
targetType.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy)
390+
.Where(x => x.GetCustomAttribute<ExecutableFunctionAttribute>() != null)
391+
.ToList()
392+
.ForEach(RegisterExecutableFunctionInvoker);
393+
return;
394+
}
395+
#endif
396+
```
397+
398+
The ILPP approach provides significant performance improvements by:
399+
- **Static Bridge Functions**: Injecting `Invoke_` prefixed static methods that wrap executable functions
400+
- **Function Pointer Registration**: Registering native function pointers during build time
401+
- **Delegate Optimization**: Using `delegate* unmanaged[Cdecl]` calling convention for minimal overhead
402+
337403
## Documentation
338404

339405
For more detailed information, you can also visit:
@@ -346,9 +412,7 @@ For more detailed information, you can also visit:
346412

347413
### Flow
348414

349-
Powerful visual scripting solution inspired from Unreal's Blueprint.
350-
351-
Included in this repository.
415+
Ceres built-in event-driven visual scripting solution.
352416

353417
See [Startup Flow](https://akikurisu.github.io/Ceres/docs/flow_startup.html)
354418

@@ -374,12 +438,16 @@ See [Next-Gen-Dialogue](https://github.com/AkiKurisu/Next-Gen-Dialogue).
374438

375439
Technique articles related to Ceres.
376440

441+
### Design
442+
377443
[如何设计一个Unity可视化脚本框架(一)](https://zhuanlan.zhihu.com/p/20500696157)
378444

379445
[如何设计一个Unity可视化脚本框架(二)](https://zhuanlan.zhihu.com/p/20711259559)
380446

381447
[如何设计一个Unity可视化脚本框架(三)](https://zhuanlan.zhihu.com/p/23323693948)
382448

449+
### Performance
450+
383451
[让Unity IL2CPP下的反射性能提高100倍的方法](https://zhuanlan.zhihu.com/p/25806713882)
384452

385453
## License

0 commit comments

Comments
 (0)