From 1bd0521db5581d1e8439e0d2f1020dac4a2ce323 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Wed, 6 Apr 2016 11:25:14 +0100 Subject: [PATCH] Avoid type registration warnings when Fungus is not installed --- Assets/FungusLua/Resources/Prefabs/LuaEnvironment.prefab | 2 ++ Assets/FungusLua/Scripts/LuaUtils.cs | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/Assets/FungusLua/Resources/Prefabs/LuaEnvironment.prefab b/Assets/FungusLua/Resources/Prefabs/LuaEnvironment.prefab index 545dee15..b3b7feeb 100644 --- a/Assets/FungusLua/Resources/Prefabs/LuaEnvironment.prefab +++ b/Assets/FungusLua/Resources/Prefabs/LuaEnvironment.prefab @@ -40,11 +40,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: c10f0b861365b42b0928858f7b086ff3, type: 3} m_Name: m_EditorClassIdentifier: + fungusModule: 0 stringTable: {fileID: 0} activeLanguage: en timeScale: -1 registerTypes: - {fileID: 4900000, guid: 9c3ab7a98d51241bbb499643399fa761, type: 3} + - {fileID: 4900000, guid: 93fddea8208764a2dbb189cc238aed40, type: 3} --- !u!114 &11493126 MonoBehaviour: m_ObjectHideFlags: 1 diff --git a/Assets/FungusLua/Scripts/LuaUtils.cs b/Assets/FungusLua/Scripts/LuaUtils.cs index b9062ee7..c2c380a1 100644 --- a/Assets/FungusLua/Scripts/LuaUtils.cs +++ b/Assets/FungusLua/Scripts/LuaUtils.cs @@ -103,6 +103,8 @@ namespace Fungus /// protected virtual void InitTypes() { + bool isFungusInstalled = (Type.GetType("Fungus.Flowchart") != null); + foreach (TextAsset textFile in registerTypes) { if (textFile == null) @@ -119,6 +121,13 @@ namespace Fungus continue; } + // Don't register fungus types if the Fungus library is not present + if (!isFungusInstalled && + typeName.StartsWith("Fungus.")) + { + continue; + } + LuaEnvironment.RegisterType(typeName); } }