首页 > 解决方案 > 当我在 Unity3D 中使用 IronPython 时,如何修复“类型 'ScriptRuntime' 是在未引用的程序集中定义的”

问题描述

我在 Unity3D 中使用 IronPython 通过 C# 导入 .py 文件。

但是,有一个错误。我不知道为什么。

“类型 ' ScriptRuntime' 在未引用的程序集中定义。”

我不知道如何解决它。你可以帮帮我吗?非常感谢!

C# 代码

//I used several package
using UnityEngine;
using IronPython.Hosting;
using Microsoft.Scripting;
using System;
using System.Linq;
using System.Text;
using System.Collections;
using System.Collections.Generic;

错误出现在以下几行。

ScriptRuntime pyRunTime = Python.CreateRuntime();
dynamic obj = pyRunTime.UseFile("hello.py");

标签: c#unity3dironpython

解决方案


推荐阅读