Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.

Commit 183cf7c

Browse files
committed
Add optional options parameter to CreateEngine
1 parent 0ff82c4 commit 183cf7c

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased]
88

9+
### Added
10+
* Added options parameter to `UnityPython.CreateEngine`
11+
912
### Changed
1013
* Updated IronPython to 2.7.8
1114

Scripts/UnityPython.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
using IronPython.Hosting;
22
using Microsoft.Scripting.Hosting;
3+
using System.Collections.Generic;
34

45
public sealed class UnityPython
56
{
67
public static ScriptEngine CreateEngine()
78
{
8-
var engine = Python.CreateEngine();
9+
return CreateEngine(null);
10+
}
11+
12+
public static ScriptEngine CreateEngine(IDictionary<string, object> options)
13+
{
14+
ScriptEngine engine;
15+
if (options == null)
16+
{
17+
engine = Python.CreateEngine();
18+
}
19+
else
20+
{
21+
engine = Python.CreateEngine(options);
22+
}
923

1024
var unityEngine = typeof(UnityEngine.GameObject).Assembly;
1125
engine.Runtime.LoadAssembly(unityEngine);

0 commit comments

Comments
 (0)