diff --git a/Assets/Fungus/FungusLua/Resources/Prefabs/LuaScript.prefab b/Assets/Fungus/FungusLua/Resources/Prefabs/LuaScript.prefab index 48fef9d1..76029dcb 100644 --- a/Assets/Fungus/FungusLua/Resources/Prefabs/LuaScript.prefab +++ b/Assets/Fungus/FungusLua/Resources/Prefabs/LuaScript.prefab @@ -8,6 +8,7 @@ GameObject: serializedVersion: 4 m_Component: - 4: {fileID: 449874} + - 114: {fileID: 11446228} - 114: {fileID: 11472914} m_Layer: 0 m_Name: LuaScript @@ -28,7 +29,7 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 ---- !u!114 &11472914 +--- !u!114 &11446228 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} @@ -36,7 +37,7 @@ MonoBehaviour: m_GameObject: {fileID: 139298} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} m_Name: m_EditorClassIdentifier: executeAfterTime: 1 @@ -47,11 +48,21 @@ MonoBehaviour: repeatEveryFrame: 1 hasFailed: 0 executeMethods: 2 +--- !u!114 &11472914 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 139298} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} + m_Name: + m_EditorClassIdentifier: luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: runAsCoroutine: 1 - useFungusModule: 1 --- !u!1001 &100100000 Prefab: m_ObjectHideFlags: 1 diff --git a/Assets/Fungus/FungusLua/Scripts/Editor/ExecuteHandlerEditor.cs b/Assets/Fungus/FungusLua/Scripts/Editor/ExecuteHandlerEditor.cs new file mode 100644 index 00000000..8466186a --- /dev/null +++ b/Assets/Fungus/FungusLua/Scripts/Editor/ExecuteHandlerEditor.cs @@ -0,0 +1,106 @@ +// Adapted from the Unity Test Tools project (MIT license) +// https://bitbucket.org/Unity-Technologies/unitytesttools/src/a30d562427e9/Assets/UnityTestTools/ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using UnityEditor; +using UnityEngine; + +namespace Fungus +{ + + [CustomEditor(typeof(ExecuteHandler))] + public class ExecuteHandlerEditor : Editor + { + private readonly DropDownControl m_ComparerDropDown = new DropDownControl(); + + #region GUI Contents + private readonly GUIContent m_GUIExecuteAfterTimeGuiContent = new GUIContent("Execute after (seconds)", "After how many seconds the script should be executed"); + private readonly GUIContent m_GUIRepeatExecuteTimeGuiContent = new GUIContent("Repeat execute", "Should the execution be repeated."); + private readonly GUIContent m_GUIRepeatEveryTimeGuiContent = new GUIContent("Frequency of repetitions", "How often should the execution be done"); + private readonly GUIContent m_GUIExecuteAfterFramesGuiContent = new GUIContent("Execute after (frames)", "After how many frames the script should be executed"); + private readonly GUIContent m_GUIRepeatExecuteFrameGuiContent = new GUIContent("Repeat execution", "Should the execution be repeated."); + #endregion + + public ExecuteHandlerEditor() + { + m_ComparerDropDown.convertForButtonLabel = type => type.Name; + m_ComparerDropDown.convertForGUIContent = type => type.Name; + m_ComparerDropDown.ignoreConvertForGUIContent = types => false; + m_ComparerDropDown.tooltip = "Comparer that will be used to compare values and determine the result of assertion."; + } + + public override void OnInspectorGUI() + { + var executeHandler = (ExecuteHandler)target; + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel(new GUIContent("On Event")); + executeHandler.executeMethods = (ExecuteHandler.ExecuteMethod)EditorGUILayout.EnumMaskField(executeHandler.executeMethods, + EditorStyles.popup, + GUILayout.ExpandWidth(false)); + EditorGUILayout.EndHorizontal(); + + if (executeHandler.IsExecuteMethodSelected(ExecuteHandler.ExecuteMethod.AfterPeriodOfTime)) + { + DrawOptionsForAfterPeriodOfTime(executeHandler); + } + + if (executeHandler.IsExecuteMethodSelected(ExecuteHandler.ExecuteMethod.Update)) + { + DrawOptionsForOnUpdate(executeHandler); + } + + if (Application.isPlaying) + { + EditorGUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + + if (GUILayout.Button(new GUIContent("Execute Now", "Execute the script immediately."))) + { + executeHandler.Execute(); + } + + GUILayout.FlexibleSpace(); + EditorGUILayout.EndHorizontal(); + } + } + + private void DrawOptionsForAfterPeriodOfTime(ExecuteHandler executeHandler) + { + EditorGUILayout.Space(); + executeHandler.executeAfterTime = EditorGUILayout.FloatField(m_GUIExecuteAfterTimeGuiContent, + executeHandler.executeAfterTime); + if (executeHandler.executeAfterTime < 0) + executeHandler.executeAfterTime = 0; + executeHandler.repeatExecuteTime = EditorGUILayout.Toggle(m_GUIRepeatExecuteTimeGuiContent, + executeHandler.repeatExecuteTime); + if (executeHandler.repeatExecuteTime) + { + executeHandler.repeatEveryTime = EditorGUILayout.FloatField(m_GUIRepeatEveryTimeGuiContent, + executeHandler.repeatEveryTime); + if (executeHandler.repeatEveryTime < 0) + executeHandler.repeatEveryTime = 0; + } + } + + private void DrawOptionsForOnUpdate(ExecuteHandler executeHandler) + { + EditorGUILayout.Space(); + executeHandler.executeAfterFrames = EditorGUILayout.IntField(m_GUIExecuteAfterFramesGuiContent, + executeHandler.executeAfterFrames); + if (executeHandler.executeAfterFrames < 1) + executeHandler.executeAfterFrames = 1; + executeHandler.repeatExecuteFrame = EditorGUILayout.Toggle(m_GUIRepeatExecuteFrameGuiContent, + executeHandler.repeatExecuteFrame); + if (executeHandler.repeatExecuteFrame) + { + executeHandler.repeatEveryFrame = EditorGUILayout.IntField(m_GUIRepeatEveryTimeGuiContent, + executeHandler.repeatEveryFrame); + if (executeHandler.repeatEveryFrame < 1) + executeHandler.repeatEveryFrame = 1; + } + } + } +} diff --git a/Assets/Fungus/FungusLua/Scripts/Editor/ExecuteHandlerEditor.cs.meta b/Assets/Fungus/FungusLua/Scripts/Editor/ExecuteHandlerEditor.cs.meta new file mode 100644 index 00000000..9906985e --- /dev/null +++ b/Assets/Fungus/FungusLua/Scripts/Editor/ExecuteHandlerEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 433a5aec1adda4a86a0022cde6487aa9 +timeCreated: 1460475473 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Fungus/FungusLua/Scripts/Editor/LuaScriptEditor.cs b/Assets/Fungus/FungusLua/Scripts/Editor/LuaScriptEditor.cs index 6423e4aa..fcfb3a40 100644 --- a/Assets/Fungus/FungusLua/Scripts/Editor/LuaScriptEditor.cs +++ b/Assets/Fungus/FungusLua/Scripts/Editor/LuaScriptEditor.cs @@ -14,16 +14,6 @@ namespace Fungus [CustomEditor(typeof(LuaScript))] public class LuaScriptEditor : Editor { - private readonly DropDownControl m_ComparerDropDown = new DropDownControl(); - - #region GUI Contents - private readonly GUIContent m_GUIExecuteAfterTimeGuiContent = new GUIContent("Execute after (seconds)", "After how many seconds the script should be executed"); - private readonly GUIContent m_GUIRepeatExecuteTimeGuiContent = new GUIContent("Repeat execute", "Should the execution be repeated."); - private readonly GUIContent m_GUIRepeatEveryTimeGuiContent = new GUIContent("Frequency of repetitions", "How often should the execution be done"); - private readonly GUIContent m_GUIExecuteAfterFramesGuiContent = new GUIContent("Execute after (frames)", "After how many frames the script should be executed"); - private readonly GUIContent m_GUIRepeatExecuteFrameGuiContent = new GUIContent("Repeat execution", "Should the execution be repeated."); - #endregion - protected SerializedProperty luaEnvironmentProp; protected SerializedProperty runAsCoroutineProp; protected SerializedProperty luaFileProp; @@ -31,14 +21,6 @@ namespace Fungus protected List luaFiles = new List(); - public LuaScriptEditor() - { - m_ComparerDropDown.convertForButtonLabel = type => type.Name; - m_ComparerDropDown.convertForGUIContent = type => type.Name; - m_ComparerDropDown.ignoreConvertForGUIContent = types => false; - m_ComparerDropDown.tooltip = "Comparer that will be used to compare values and determine the result of assertion."; - } - public virtual void OnEnable() { luaEnvironmentProp = serializedObject.FindProperty("luaEnvironment"); @@ -67,38 +49,6 @@ namespace Fungus public override void OnInspectorGUI() { - var fungusInvoke = (LuaScript)target; - EditorGUILayout.BeginHorizontal(); - EditorGUILayout.PrefixLabel(new GUIContent("On Event")); - fungusInvoke.executeMethods = (LuaScript.ExecuteMethod)EditorGUILayout.EnumMaskField(fungusInvoke.executeMethods, - EditorStyles.popup, - GUILayout.ExpandWidth(false)); - EditorGUILayout.EndHorizontal(); - - if (fungusInvoke.IsExecuteMethodSelected(LuaScript.ExecuteMethod.AfterPeriodOfTime)) - { - DrawOptionsForAfterPeriodOfTime(fungusInvoke); - } - - if (fungusInvoke.IsExecuteMethodSelected(LuaScript.ExecuteMethod.Update)) - { - DrawOptionsForOnUpdate(fungusInvoke); - } - - if (Application.isPlaying) - { - EditorGUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); - - if (GUILayout.Button(new GUIContent("Execute Now", "Execute the Lua script immediately."))) - { - fungusInvoke.Execute(); - } - - GUILayout.FlexibleSpace(); - EditorGUILayout.EndHorizontal(); - } - serializedObject.Update(); EditorGUILayout.PropertyField(luaEnvironmentProp); @@ -154,41 +104,5 @@ namespace Fungus serializedObject.ApplyModifiedProperties(); } - - private void DrawOptionsForAfterPeriodOfTime(LuaScript script) - { - EditorGUILayout.Space(); - script.executeAfterTime = EditorGUILayout.FloatField(m_GUIExecuteAfterTimeGuiContent, - script.executeAfterTime); - if (script.executeAfterTime < 0) - script.executeAfterTime = 0; - script.repeatExecuteTime = EditorGUILayout.Toggle(m_GUIRepeatExecuteTimeGuiContent, - script.repeatExecuteTime); - if (script.repeatExecuteTime) - { - script.repeatEveryTime = EditorGUILayout.FloatField(m_GUIRepeatEveryTimeGuiContent, - script.repeatEveryTime); - if (script.repeatEveryTime < 0) - script.repeatEveryTime = 0; - } - } - - private void DrawOptionsForOnUpdate(LuaScript script) - { - EditorGUILayout.Space(); - script.executeAfterFrames = EditorGUILayout.IntField(m_GUIExecuteAfterFramesGuiContent, - script.executeAfterFrames); - if (script.executeAfterFrames < 1) - script.executeAfterFrames = 1; - script.repeatExecuteFrame = EditorGUILayout.Toggle(m_GUIRepeatExecuteFrameGuiContent, - script.repeatExecuteFrame); - if (script.repeatExecuteFrame) - { - script.repeatEveryFrame = EditorGUILayout.IntField(m_GUIRepeatEveryTimeGuiContent, - script.repeatEveryFrame); - if (script.repeatEveryFrame < 1) - script.repeatEveryFrame = 1; - } - } } } diff --git a/Assets/Fungus/FungusLua/Scripts/ExecuteHandler.cs b/Assets/Fungus/FungusLua/Scripts/ExecuteHandler.cs new file mode 100644 index 00000000..adcdb462 --- /dev/null +++ b/Assets/Fungus/FungusLua/Scripts/ExecuteHandler.cs @@ -0,0 +1,293 @@ +// Adapted from the Unity Test Tools project (MIT license) +// https://bitbucket.org/Unity-Technologies/unitytesttools/src/a30d562427e9/Assets/UnityTestTools/ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using UnityEngine; +using MoonSharp.Interpreter; +using Debug = UnityEngine.Debug; +using Object = UnityEngine.Object; + +namespace Fungus +{ + + [Serializable] + public class ExecuteHandler : MonoBehaviour, IExecuteHandlerConfigurator + { + [Flags] + public enum ExecuteMethod + { + AfterPeriodOfTime = 1 << 0, + Start = 1 << 1, + Update = 1 << 2, + FixedUpdate = 1 << 3, + LateUpdate = 1 << 4, + OnDestroy = 1 << 5, + OnEnable = 1 << 6, + OnDisable = 1 << 7, + OnControllerColliderHit = 1 << 8, + OnParticleCollision = 1 << 9, + OnJointBreak = 1 << 10, + OnBecameInvisible = 1 << 11, + OnBecameVisible = 1 << 12, + OnTriggerEnter = 1 << 13, + OnTriggerExit = 1 << 14, + OnTriggerStay = 1 << 15, + OnCollisionEnter = 1 << 16, + OnCollisionExit = 1 << 17, + OnCollisionStay = 1 << 18, + OnTriggerEnter2D = 1 << 19, + OnTriggerExit2D = 1 << 20, + OnTriggerStay2D = 1 << 21, + OnCollisionEnter2D = 1 << 22, + OnCollisionExit2D = 1 << 23, + OnCollisionStay2D = 1 << 24, + } + + [SerializeField] public float executeAfterTime = 1f; + [SerializeField] public bool repeatExecuteTime = true; + [SerializeField] public float repeatEveryTime = 1f; + [SerializeField] public int executeAfterFrames = 1; + [SerializeField] public bool repeatExecuteFrame = true; + [SerializeField] public int repeatEveryFrame = 1; + [SerializeField] public bool hasFailed; + + [SerializeField] public ExecuteMethod executeMethods = ExecuteMethod.Start; + + private int m_ExecuteOnFrame; + + // Recursively build the full hierarchy path to this game object + private static string GetPath(Transform current) + { + if (current.parent == null) + { + return current.name; + } + return GetPath(current.parent) + "." + current.name; + } + + public void Start() + { + Execute(ExecuteMethod.Start); + + if (IsExecuteMethodSelected(ExecuteMethod.AfterPeriodOfTime)) + { + StartCoroutine(ExecutePeriodically()); + } + if (IsExecuteMethodSelected(ExecuteMethod.Update)) + { + m_ExecuteOnFrame = Time.frameCount + executeAfterFrames; + } + } + + public IEnumerator ExecutePeriodically() + { + yield return new WaitForSeconds(executeAfterTime); + Execute(ExecuteMethod.AfterPeriodOfTime); + while (repeatExecuteTime) + { + yield return new WaitForSeconds(repeatEveryTime); + Execute(ExecuteMethod.AfterPeriodOfTime); + } + } + + public bool ShouldExecuteOnFrame() + { + if (Time.frameCount > m_ExecuteOnFrame) + { + if (repeatExecuteFrame) + m_ExecuteOnFrame += repeatEveryFrame; + else + m_ExecuteOnFrame = Int32.MaxValue; + return true; + } + return false; + } + + public void OnDisable() + { + Execute(ExecuteMethod.OnDisable); + } + + public void OnEnable() + { + Execute(ExecuteMethod.OnEnable); + } + + public void OnDestroy() + { + Execute(ExecuteMethod.OnDestroy); + } + + public void Update() + { + if (IsExecuteMethodSelected(ExecuteMethod.Update) && ShouldExecuteOnFrame()) + { + Execute(ExecuteMethod.Update); + } + } + + public void FixedUpdate() + { + Execute(ExecuteMethod.FixedUpdate); + } + + public void LateUpdate() + { + Execute(ExecuteMethod.LateUpdate); + } + + public void OnControllerColliderHit() + { + Execute(ExecuteMethod.OnControllerColliderHit); + } + + public void OnParticleCollision() + { + Execute(ExecuteMethod.OnParticleCollision); + } + + public void OnJointBreak() + { + Execute(ExecuteMethod.OnJointBreak); + } + + public void OnBecameInvisible() + { + Execute(ExecuteMethod.OnBecameInvisible); + } + + public void OnBecameVisible() + { + Execute(ExecuteMethod.OnBecameVisible); + } + + public void OnTriggerEnter() + { + Execute(ExecuteMethod.OnTriggerEnter); + } + + public void OnTriggerExit() + { + Execute(ExecuteMethod.OnTriggerExit); + } + + public void OnTriggerStay() + { + Execute(ExecuteMethod.OnTriggerStay); + } + + public void OnCollisionEnter() + { + Execute(ExecuteMethod.OnCollisionEnter); + } + + public void OnCollisionExit() + { + Execute(ExecuteMethod.OnCollisionExit); + } + + public void OnCollisionStay() + { + Execute(ExecuteMethod.OnCollisionStay); + } + + public void OnTriggerEnter2D() + { + Execute(ExecuteMethod.OnTriggerEnter2D); + } + + public void OnTriggerExit2D() + { + Execute(ExecuteMethod.OnTriggerExit2D); + } + + public void OnTriggerStay2D() + { + Execute(ExecuteMethod.OnTriggerStay2D); + } + + public void OnCollisionEnter2D() + { + Execute(ExecuteMethod.OnCollisionEnter2D); + } + + public void OnCollisionExit2D() + { + Execute(ExecuteMethod.OnCollisionExit2D); + } + + public void OnCollisionStay2D() + { + Execute(ExecuteMethod.OnCollisionStay2D); + } + + private void Execute(ExecuteMethod executeMethod) + { + if (IsExecuteMethodSelected(executeMethod)) + { + Execute(); + } + } + + public bool IsExecuteMethodSelected(ExecuteMethod method) + { + return method == (executeMethods & method); + } + + /// + /// Execute the Lua script immediately. + /// This is the function to call if you want to trigger execution from an external script. + /// + public virtual void Execute() + { + // Call any OnExecute methods in components on this gameobject + SendMessage("OnExecute", SendMessageOptions.DontRequireReceiver); + } + + #region AssertionComponentConfigurator + public int UpdateExecuteStartOnFrame { set { executeAfterFrames = value; } } + public int UpdateExecuteRepeatFrequency { set { repeatEveryFrame = value; } } + public bool UpdateExecuteRepeat { set { repeatExecuteFrame = value; } } + public float TimeExecuteStartAfter { set { executeAfterTime = value; } } + public float TimeExecuteRepeatFrequency { set { repeatEveryTime = value; } } + public bool TimeExecuteRepeat { set { repeatExecuteTime = value; } } + public ExecuteHandler Component { get { return this; } } + #endregion + } + + public interface IExecuteHandlerConfigurator + { + /// + /// If the assertion is evaluated in Update, after how many frame should the evaluation start. Defult is 1 (first frame) + /// + int UpdateExecuteStartOnFrame { set; } + /// + /// If the assertion is evaluated in Update and UpdateExecuteRepeat is true, how many frame should pass between evaluations + /// + int UpdateExecuteRepeatFrequency { set; } + /// + /// If the assertion is evaluated in Update, should the evaluation be repeated after UpdateExecuteRepeatFrequency frames + /// + bool UpdateExecuteRepeat { set; } + + /// + /// If the assertion is evaluated after a period of time, after how many seconds the first evaluation should be done + /// + float TimeExecuteStartAfter { set; } + /// + /// If the assertion is evaluated after a period of time and TimeExecuteRepeat is true, after how many seconds should the next evaluation happen + /// + float TimeExecuteRepeatFrequency { set; } + /// + /// If the assertion is evaluated after a period, should the evaluation happen again after TimeExecuteRepeatFrequency seconds + /// + bool TimeExecuteRepeat { set; } + + ExecuteHandler Component { get; } + } + +} diff --git a/Assets/Fungus/FungusLua/Scripts/ExecuteHandler.cs.meta b/Assets/Fungus/FungusLua/Scripts/ExecuteHandler.cs.meta new file mode 100644 index 00000000..2d284be4 --- /dev/null +++ b/Assets/Fungus/FungusLua/Scripts/ExecuteHandler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6ee79785811ba49399c1b56d7309e3df +timeCreated: 1460474888 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Fungus/FungusLua/Scripts/LuaScript.cs b/Assets/Fungus/FungusLua/Scripts/LuaScript.cs index 2d739878..f4666335 100644 --- a/Assets/Fungus/FungusLua/Scripts/LuaScript.cs +++ b/Assets/Fungus/FungusLua/Scripts/LuaScript.cs @@ -14,49 +14,8 @@ using Object = UnityEngine.Object; namespace Fungus { - [Serializable] - public class LuaScript : MonoBehaviour, ILuaScriptConfigurator + public class LuaScript : MonoBehaviour { - [Flags] - public enum ExecuteMethod - { - AfterPeriodOfTime = 1 << 0, - Start = 1 << 1, - Update = 1 << 2, - FixedUpdate = 1 << 3, - LateUpdate = 1 << 4, - OnDestroy = 1 << 5, - OnEnable = 1 << 6, - OnDisable = 1 << 7, - OnControllerColliderHit = 1 << 8, - OnParticleCollision = 1 << 9, - OnJointBreak = 1 << 10, - OnBecameInvisible = 1 << 11, - OnBecameVisible = 1 << 12, - OnTriggerEnter = 1 << 13, - OnTriggerExit = 1 << 14, - OnTriggerStay = 1 << 15, - OnCollisionEnter = 1 << 16, - OnCollisionExit = 1 << 17, - OnCollisionStay = 1 << 18, - OnTriggerEnter2D = 1 << 19, - OnTriggerExit2D = 1 << 20, - OnTriggerStay2D = 1 << 21, - OnCollisionEnter2D = 1 << 22, - OnCollisionExit2D = 1 << 23, - OnCollisionStay2D = 1 << 24, - } - - [SerializeField] public float executeAfterTime = 1f; - [SerializeField] public bool repeatExecuteTime = true; - [SerializeField] public float repeatEveryTime = 1f; - [SerializeField] public int executeAfterFrames = 1; - [SerializeField] public bool repeatExecuteFrame = true; - [SerializeField] public int repeatEveryFrame = 1; - [SerializeField] public bool hasFailed; - - [SerializeField] public ExecuteMethod executeMethods = ExecuteMethod.Start; - /// /// The Lua Environment to use when executing Lua script. /// @@ -82,10 +41,10 @@ namespace Fungus [Tooltip("Run the script as a Lua coroutine so execution can be yielded for asynchronous operations.")] public bool runAsCoroutine = true; - private int m_ExecuteOnFrame; - protected string friendlyName = ""; + protected bool initialised; + // Recursively build the full hierarchy path to this game object private static string GetPath(Transform current) { @@ -98,197 +57,46 @@ namespace Fungus public void Start() { - if (luaEnvironment == null) - { - // Create a Lua Environment if none exists yet - luaEnvironment = LuaEnvironment.GetLua(); - } - - if (luaEnvironment == null) - { - Debug.LogError("No Lua Environment found"); - return; - } - - // Ensure the LuaEnvironment is initialized before trying to execute code - luaEnvironment.InitEnvironment(); - - // Cache a descriptive name to use in Lua error messages - friendlyName = GetPath(transform) + ".LuaScript"; - - Execute(ExecuteMethod.Start); - - if (IsExecuteMethodSelected(ExecuteMethod.AfterPeriodOfTime)) - { - StartCoroutine(ExecutePeriodically()); - } - if (IsExecuteMethodSelected(ExecuteMethod.Update)) - { - m_ExecuteOnFrame = Time.frameCount + executeAfterFrames; - } + InitLuaScript(); } - public IEnumerator ExecutePeriodically() + protected virtual void InitLuaScript() { - yield return new WaitForSeconds(executeAfterTime); - Execute(ExecuteMethod.AfterPeriodOfTime); - while (repeatExecuteTime) + if (initialised) { - yield return new WaitForSeconds(repeatEveryTime); - Execute(ExecuteMethod.AfterPeriodOfTime); + return; } - } - public bool ShouldExecuteOnFrame() - { - if (Time.frameCount > m_ExecuteOnFrame) + if (luaEnvironment == null) { - if (repeatExecuteFrame) - m_ExecuteOnFrame += repeatEveryFrame; - else - m_ExecuteOnFrame = Int32.MaxValue; - return true; + // Create a Lua Environment if none exists yet + luaEnvironment = LuaEnvironment.GetLua(); } - return false; - } - - public void OnDisable() - { - Execute(ExecuteMethod.OnDisable); - } - - public void OnEnable() - { - Execute(ExecuteMethod.OnEnable); - } - - public void OnDestroy() - { - Execute(ExecuteMethod.OnDestroy); - } - public void Update() - { - if (IsExecuteMethodSelected(ExecuteMethod.Update) && ShouldExecuteOnFrame()) + if (luaEnvironment == null) { - Execute(ExecuteMethod.Update); + Debug.LogError("No Lua Environment found"); + return; } - } - - public void FixedUpdate() - { - Execute(ExecuteMethod.FixedUpdate); - } - - public void LateUpdate() - { - Execute(ExecuteMethod.LateUpdate); - } - - public void OnControllerColliderHit() - { - Execute(ExecuteMethod.OnControllerColliderHit); - } - - public void OnParticleCollision() - { - Execute(ExecuteMethod.OnParticleCollision); - } - - public void OnJointBreak() - { - Execute(ExecuteMethod.OnJointBreak); - } - - public void OnBecameInvisible() - { - Execute(ExecuteMethod.OnBecameInvisible); - } - - public void OnBecameVisible() - { - Execute(ExecuteMethod.OnBecameVisible); - } - - public void OnTriggerEnter() - { - Execute(ExecuteMethod.OnTriggerEnter); - } - - public void OnTriggerExit() - { - Execute(ExecuteMethod.OnTriggerExit); - } - - public void OnTriggerStay() - { - Execute(ExecuteMethod.OnTriggerStay); - } - - public void OnCollisionEnter() - { - Execute(ExecuteMethod.OnCollisionEnter); - } - - public void OnCollisionExit() - { - Execute(ExecuteMethod.OnCollisionExit); - } - - public void OnCollisionStay() - { - Execute(ExecuteMethod.OnCollisionStay); - } - - public void OnTriggerEnter2D() - { - Execute(ExecuteMethod.OnTriggerEnter2D); - } - - public void OnTriggerExit2D() - { - Execute(ExecuteMethod.OnTriggerExit2D); - } - - public void OnTriggerStay2D() - { - Execute(ExecuteMethod.OnTriggerStay2D); - } - - public void OnCollisionEnter2D() - { - Execute(ExecuteMethod.OnCollisionEnter2D); - } - - public void OnCollisionExit2D() - { - Execute(ExecuteMethod.OnCollisionExit2D); - } - public void OnCollisionStay2D() - { - Execute(ExecuteMethod.OnCollisionStay2D); - } + // Ensure the LuaEnvironment is initialized before trying to execute code + luaEnvironment.InitEnvironment(); - private void Execute(ExecuteMethod executeMethod) - { - if (IsExecuteMethodSelected(executeMethod)) - { - Execute(); - } - } + // Cache a descriptive name to use in Lua error messages + friendlyName = GetPath(transform) + ".LuaScript"; - public bool IsExecuteMethodSelected(ExecuteMethod method) - { - return method == (executeMethods & method); + initialised = true; } /// - /// Execute the Lua script immediately. + /// Execute the Lua script. /// This is the function to call if you want to trigger execution from an external script. /// - public virtual void Execute() + public virtual void OnExecute() { + // Make sure the environment is initialised before executing + InitLuaScript(); + if (luaEnvironment == null) { Debug.LogWarning("No Lua Environment found"); @@ -311,47 +119,5 @@ namespace Fungus luaEnvironment.DoLuaString(s, friendlyName, runAsCoroutine); } } - - #region AssertionComponentConfigurator - public int UpdateExecuteStartOnFrame { set { executeAfterFrames = value; } } - public int UpdateExecuteRepeatFrequency { set { repeatEveryFrame = value; } } - public bool UpdateExecuteRepeat { set { repeatExecuteFrame = value; } } - public float TimeExecuteStartAfter { set { executeAfterTime = value; } } - public float TimeExecuteRepeatFrequency { set { repeatEveryTime = value; } } - public bool TimeExecuteRepeat { set { repeatExecuteTime = value; } } - public LuaScript Component { get { return this; } } - #endregion - } - - public interface ILuaScriptConfigurator - { - /// - /// If the assertion is evaluated in Update, after how many frame should the evaluation start. Defult is 1 (first frame) - /// - int UpdateExecuteStartOnFrame { set; } - /// - /// If the assertion is evaluated in Update and UpdateExecuteRepeat is true, how many frame should pass between evaluations - /// - int UpdateExecuteRepeatFrequency { set; } - /// - /// If the assertion is evaluated in Update, should the evaluation be repeated after UpdateExecuteRepeatFrequency frames - /// - bool UpdateExecuteRepeat { set; } - - /// - /// If the assertion is evaluated after a period of time, after how many seconds the first evaluation should be done - /// - float TimeExecuteStartAfter { set; } - /// - /// If the assertion is evaluated after a period of time and TimeExecuteRepeat is true, after how many seconds should the next evaluation happen - /// - float TimeExecuteRepeatFrequency { set; } - /// - /// If the assertion is evaluated after a period, should the evaluation happen again after TimeExecuteRepeatFrequency seconds - /// - bool TimeExecuteRepeat { set; } - - LuaScript Component { get; } } - } diff --git a/Assets/FungusExamples/Lua/Narrative.unity b/Assets/FungusExamples/Lua/Narrative.unity index a8f5ffcd..a19e09e7 100644 --- a/Assets/FungusExamples/Lua/Narrative.unity +++ b/Assets/FungusExamples/Lua/Narrative.unity @@ -625,6 +625,7 @@ GameObject: serializedVersion: 4 m_Component: - 4: {fileID: 519026841} + - 114: {fileID: 519026842} - 114: {fileID: 519026840} m_Layer: 0 m_Name: LuaScript @@ -645,14 +646,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: - executeAfterTime: 1 - repeatExecuteTime: 1 - repeatEveryTime: 1 - executeAfterFrames: 1 - repeatExecuteFrame: 1 - repeatEveryFrame: 1 - hasFailed: 0 - executeMethods: 2 luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: "setsaydialog(saydialog)\nsetmenudialog(menudialog)\n\nfunction start()\n @@ -672,6 +665,25 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_RootOrder: 6 +--- !u!114 &519026842 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 519026839} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: + executeAfterTime: 1 + repeatExecuteTime: 1 + repeatEveryTime: 1 + executeAfterFrames: 1 + repeatExecuteFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + executeMethods: 2 --- !u!1 &614649408 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/FungusExamples/Lua/Trigger.unity b/Assets/FungusExamples/Lua/Trigger.unity index 8b356b29..8336a287 100644 --- a/Assets/FungusExamples/Lua/Trigger.unity +++ b/Assets/FungusExamples/Lua/Trigger.unity @@ -1143,6 +1143,7 @@ GameObject: - 33: {fileID: 1437227278} - 65: {fileID: 1437227277} - 23: {fileID: 1437227276} + - 114: {fileID: 1437227281} - 114: {fileID: 1437227280} m_Layer: 0 m_Name: CubeTrigger @@ -1219,14 +1220,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: - executeAfterTime: 1 - repeatExecuteTime: 1 - repeatEveryTime: 1 - executeAfterFrames: 1 - repeatExecuteFrame: 1 - repeatEveryFrame: 1 - hasFailed: 0 - executeMethods: 8192 luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: 'runblock(flowchart, "Start") @@ -1236,6 +1229,25 @@ MonoBehaviour: say("Block is finished");' runAsCoroutine: 1 +--- !u!114 &1437227281 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1437227275} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: + executeAfterTime: 1 + repeatExecuteTime: 1 + repeatEveryTime: 1 + executeAfterFrames: 1 + repeatExecuteFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + executeMethods: 8192 --- !u!1001 &1575311449 Prefab: m_ObjectHideFlags: 0 diff --git a/Assets/Tests/Lua/FungusTests.unity b/Assets/Tests/Lua/FungusTests.unity index 5d7d6d7a..07f1ae2b 100644 --- a/Assets/Tests/Lua/FungusTests.unity +++ b/Assets/Tests/Lua/FungusTests.unity @@ -955,7 +955,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!114 &110417826 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1160,6 +1160,7 @@ GameObject: serializedVersion: 4 m_Component: - 4: {fileID: 116891409} + - 114: {fileID: 116891411} - 114: {fileID: 116891410} m_Layer: 0 m_Name: LuaScript @@ -1191,14 +1192,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: - executeAfterTime: 1 - repeatExecuteTime: 1 - repeatEveryTime: 1 - executeAfterFrames: 1 - repeatExecuteFrame: 1 - repeatEveryFrame: 1 - hasFailed: 0 - executeMethods: 2 luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: '-- Check the starting value of StringVar @@ -1228,6 +1221,25 @@ MonoBehaviour: pass()' runAsCoroutine: 1 +--- !u!114 &116891411 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 116891408} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: + executeAfterTime: 1 + repeatExecuteTime: 1 + repeatEveryTime: 1 + executeAfterFrames: 1 + repeatExecuteFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + executeMethods: 2 --- !u!1001 &130678264 Prefab: m_ObjectHideFlags: 0 @@ -2269,10 +2281,10 @@ RectTransform: - {fileID: 913989833} m_Father: {fileID: 465829170} m_RootOrder: 3 - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 650, y: -365} - m_SizeDelta: {x: 1300, y: 100} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &398057889 MonoBehaviour: @@ -2474,10 +2486,10 @@ RectTransform: - {fileID: 1088283066} m_Father: {fileID: 465829170} m_RootOrder: 1 - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 650, y: -155} - m_SizeDelta: {x: 1300, y: 100} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &405820710 MonoBehaviour: @@ -2584,6 +2596,7 @@ GameObject: serializedVersion: 4 m_Component: - 4: {fileID: 448016417} + - 114: {fileID: 448016419} - 114: {fileID: 448016418} m_Layer: 0 m_Name: LuaScript @@ -2615,14 +2628,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: - executeAfterTime: 1 - repeatExecuteTime: 1 - repeatEveryTime: 1 - executeAfterFrames: 1 - repeatExecuteFrame: 1 - repeatEveryFrame: 1 - hasFailed: 0 - executeMethods: 2 luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: '-- The "Do Test" block in the flowchart sets a bunch of flowchart variables @@ -2694,6 +2699,25 @@ MonoBehaviour: pass()' runAsCoroutine: 1 +--- !u!114 &448016419 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 448016416} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: + executeAfterTime: 1 + repeatExecuteTime: 1 + repeatEveryTime: 1 + executeAfterFrames: 1 + repeatExecuteFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + executeMethods: 2 --- !u!1 &465829169 GameObject: m_ObjectHideFlags: 0 @@ -2734,7 +2758,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: -0.000018477, y: 191} - m_SizeDelta: {x: 1300, y: 680} + m_SizeDelta: {x: 1300, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &465829171 MonoBehaviour: @@ -2851,10 +2875,10 @@ RectTransform: - {fileID: 1446085149} m_Father: {fileID: 465829170} m_RootOrder: 6 - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 650, y: -655} - m_SizeDelta: {x: 1300, y: 50} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &507572621 MonoBehaviour: @@ -2967,6 +2991,7 @@ GameObject: serializedVersion: 4 m_Component: - 4: {fileID: 508615589} + - 114: {fileID: 508615591} - 114: {fileID: 508615590} m_Layer: 0 m_Name: LuaScript @@ -2998,6 +3023,22 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: + luaEnvironment: {fileID: 0} + luaFile: {fileID: 0} + luaScript: "menuoptions.menudialog = menudialog\n\nfunction option1()\n fail()\nend\n\nmenu(\"Option + 1\", option1)\n\ncheck(optionbutton0.activeSelf)\nclearmenu()\nassert(not optionbutton0.activeSelf)\n\npass()" + runAsCoroutine: 1 +--- !u!114 &508615591 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 508615588} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: executeAfterTime: 1 repeatExecuteTime: 1 repeatEveryTime: 1 @@ -3006,11 +3047,6 @@ MonoBehaviour: repeatEveryFrame: 1 hasFailed: 0 executeMethods: 2 - luaEnvironment: {fileID: 0} - luaFile: {fileID: 0} - luaScript: "menuoptions.menudialog = menudialog\n\nfunction option1()\n fail()\nend\n\nmenu(\"Option - 1\", option1)\n\ncheck(optionbutton0.activeSelf)\nclearmenu()\nassert(not optionbutton0.activeSelf)\n\npass()" - runAsCoroutine: 1 --- !u!1 &511430244 GameObject: m_ObjectHideFlags: 0 @@ -3019,6 +3055,7 @@ GameObject: serializedVersion: 4 m_Component: - 4: {fileID: 511430245} + - 114: {fileID: 511430247} - 114: {fileID: 511430246} m_Layer: 0 m_Name: LuaScript @@ -3050,14 +3087,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: - executeAfterTime: 1 - repeatExecuteTime: 1 - repeatEveryTime: 1 - executeAfterFrames: 1 - repeatExecuteFrame: 1 - repeatEveryFrame: 1 - hasFailed: 0 - executeMethods: 2 luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: "-- Test the Menu Timer functionality\n\nmenuoptions.menudialog = menudialog\n\n-- @@ -3066,6 +3095,25 @@ MonoBehaviour: \ pass()\nend\n\n-- Display a menu option with a timer\nmenu(\"Option 1\", option1)\nmenutimer(1, timeout)\n" runAsCoroutine: 1 +--- !u!114 &511430247 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 511430244} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: + executeAfterTime: 1 + repeatExecuteTime: 1 + repeatEveryTime: 1 + executeAfterFrames: 1 + repeatExecuteFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + executeMethods: 2 --- !u!1 &560555132 GameObject: m_ObjectHideFlags: 0 @@ -3270,10 +3318,10 @@ RectTransform: - {fileID: 913529610} m_Father: {fileID: 465829170} m_RootOrder: 2 - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 650, y: -260} - m_SizeDelta: {x: 1300, y: 100} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &625261051 MonoBehaviour: @@ -3593,10 +3641,10 @@ RectTransform: - {fileID: 863130403} m_Father: {fileID: 465829170} m_RootOrder: 4 - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 650, y: -470} - m_SizeDelta: {x: 1300, y: 100} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &715595888 MonoBehaviour: @@ -4289,7 +4337,7 @@ Transform: - {fileID: 560555133} - {fileID: 511430245} m_Father: {fileID: 0} - m_RootOrder: 4 + m_RootOrder: 5 --- !u!1 &828158145 GameObject: m_ObjectHideFlags: 0 @@ -4298,6 +4346,7 @@ GameObject: serializedVersion: 4 m_Component: - 4: {fileID: 828158146} + - 114: {fileID: 828158148} - 114: {fileID: 828158147} m_Layer: 0 m_Name: LuaScript @@ -4330,14 +4379,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: - executeAfterTime: 1 - repeatExecuteTime: 1 - repeatEveryTime: 1 - executeAfterFrames: 1 - repeatExecuteFrame: 1 - repeatEveryFrame: 1 - hasFailed: 0 - executeMethods: 2 luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: "-- Test Say creating a SayDialog when none already exists\n\nsayoptions.waitforinput @@ -4346,6 +4387,25 @@ MonoBehaviour: \ pass()\nend\n\nmenu(\"Option A\", choose_a)\n\nlocal go = luautils.find(\"OptionButton0\")\ncheck(go != nil)\n\nlocal button = go.GetComponent(\"Button\")\ncheck(button != nil)\n\nbutton.onClick.Invoke()" runAsCoroutine: 1 +--- !u!114 &828158148 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 828158145} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: + executeAfterTime: 1 + repeatExecuteTime: 1 + repeatEveryTime: 1 + executeAfterFrames: 1 + repeatExecuteFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + executeMethods: 2 --- !u!1 &851680338 GameObject: m_ObjectHideFlags: 0 @@ -4424,6 +4484,7 @@ GameObject: serializedVersion: 4 m_Component: - 4: {fileID: 851718692} + - 114: {fileID: 851718694} - 114: {fileID: 851718693} m_Layer: 0 m_Name: LuaScript @@ -4455,14 +4516,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: - executeAfterTime: 1 - repeatExecuteTime: 1 - repeatEveryTime: 1 - executeAfterFrames: 1 - repeatExecuteFrame: 1 - repeatEveryFrame: 1 - hasFailed: 0 - executeMethods: 2 luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: '-- Test getting and setting Fungus variables @@ -4490,6 +4543,25 @@ MonoBehaviour: pass()' runAsCoroutine: 1 +--- !u!114 &851718694 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 851718691} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: + executeAfterTime: 1 + repeatExecuteTime: 1 + repeatEveryTime: 1 + executeAfterFrames: 1 + repeatExecuteFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + executeMethods: 2 --- !u!1 &863130402 GameObject: m_ObjectHideFlags: 0 @@ -4599,10 +4671,10 @@ RectTransform: - {fileID: 884473401} m_Father: {fileID: 465829170} m_RootOrder: 0 - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 650, y: -50} - m_SizeDelta: {x: 1300, y: 100} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &876352040 MonoBehaviour: @@ -4816,7 +4888,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 2 + m_RootOrder: 1 --- !u!1 &913529609 GameObject: m_ObjectHideFlags: 0 @@ -6169,7 +6241,7 @@ Transform: - {fileID: 36455799} - {fileID: 508615589} m_Father: {fileID: 0} - m_RootOrder: 5 + m_RootOrder: 6 --- !u!1 &1077682782 GameObject: m_ObjectHideFlags: 0 @@ -6421,7 +6493,7 @@ Transform: - {fileID: 605829511} - {fileID: 1845639738} m_Father: {fileID: 0} - m_RootOrder: 1 + m_RootOrder: 3 --- !u!1 &1142920804 GameObject: m_ObjectHideFlags: 0 @@ -7114,7 +7186,7 @@ RectTransform: m_Father: {fileID: 1446085149} m_RootOrder: 0 m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} + m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 10, y: 0} m_Pivot: {x: 0.5, y: 0.5} @@ -7213,7 +7285,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 6 + m_RootOrder: 2 --- !u!1 &1446085148 GameObject: m_ObjectHideFlags: 0 @@ -7706,6 +7778,7 @@ GameObject: serializedVersion: 4 m_Component: - 4: {fileID: 1652835881} + - 114: {fileID: 1652835883} - 114: {fileID: 1652835882} m_Layer: 0 m_Name: LuaScript @@ -7738,20 +7811,31 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: - executeAfterTime: 2 - repeatExecuteTime: 0 - repeatEveryTime: 1 - executeAfterFrames: 1 - repeatExecuteFrame: 1 - repeatEveryFrame: 1 - hasFailed: 0 - executeMethods: 2 luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: "-- Test the Menu Timer functionality\n\nmenuoptions.menudialog = menudialog\n\n-- Called if user clicks on menu option\nfunction option1()\n pass()\nend\n\n-- Display a menu option with a timer\nmenu(\"Option 1\", option1)\n\noptionbutton0.onClick.Invoke()\n" runAsCoroutine: 1 +--- !u!114 &1652835883 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1652835880} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: + executeAfterTime: 1 + repeatExecuteTime: 1 + repeatEveryTime: 1 + executeAfterFrames: 1 + repeatExecuteFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + executeMethods: 2 --- !u!1 &1667495163 GameObject: m_ObjectHideFlags: 0 @@ -8630,10 +8714,10 @@ RectTransform: - {fileID: 761668839} m_Father: {fileID: 465829170} m_RootOrder: 5 - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 650, y: -575} - m_SizeDelta: {x: 1300, y: 100} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1762200959 MonoBehaviour: @@ -8780,6 +8864,7 @@ GameObject: serializedVersion: 4 m_Component: - 4: {fileID: 1845639738} + - 114: {fileID: 1845639740} - 114: {fileID: 1845639739} m_Layer: 0 m_Name: LuaScript @@ -8811,14 +8896,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: - executeAfterTime: 1 - repeatExecuteTime: 1 - repeatEveryTime: 1 - executeAfterFrames: 1 - repeatExecuteFrame: 1 - repeatEveryFrame: 1 - hasFailed: 0 - executeMethods: 2 luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: '-- Test Say Dialog integration @@ -8857,6 +8934,25 @@ MonoBehaviour: ' runAsCoroutine: 1 +--- !u!114 &1845639740 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1845639737} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: + executeAfterTime: 1 + repeatExecuteTime: 1 + repeatEveryTime: 1 + executeAfterFrames: 1 + repeatExecuteFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + executeMethods: 2 --- !u!1 &1880266302 GameObject: m_ObjectHideFlags: 0 @@ -9370,7 +9466,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!114 &1993284458 MonoBehaviour: m_ObjectHideFlags: 0 @@ -9407,7 +9503,7 @@ Transform: - {fileID: 1652835881} - {fileID: 20972057} m_Father: {fileID: 0} - m_RootOrder: 3 + m_RootOrder: 4 --- !u!4 &2004121212 stripped Transform: m_PrefabParentObject: {fileID: 495584, guid: 49031c561e16d4fcf91c12153f8e0b25, type: 2} @@ -9506,6 +9602,7 @@ GameObject: serializedVersion: 4 m_Component: - 4: {fileID: 2049586852} + - 114: {fileID: 2049586854} - 114: {fileID: 2049586853} m_Layer: 0 m_Name: LuaScript @@ -9537,14 +9634,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: - executeAfterTime: 1 - repeatExecuteTime: 1 - repeatEveryTime: 1 - executeAfterFrames: 1 - repeatExecuteFrame: 1 - repeatEveryFrame: 1 - hasFailed: 0 - executeMethods: 2 luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: '-- Use a Fungus flowchart to show a character portrait @@ -9557,6 +9646,25 @@ MonoBehaviour: pass()' runAsCoroutine: 1 +--- !u!114 &2049586854 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2049586851} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: + executeAfterTime: 1 + repeatExecuteTime: 1 + repeatEveryTime: 1 + executeAfterFrames: 1 + repeatExecuteFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + executeMethods: 2 --- !u!1 &2087053783 GameObject: m_ObjectHideFlags: 0 @@ -9864,14 +9972,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: - executeAfterTime: 1 - repeatExecuteTime: 1 - repeatEveryTime: 1 - executeAfterFrames: 1 - repeatExecuteFrame: 1 - repeatEveryFrame: 1 - hasFailed: 0 - executeMethods: 2 luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: diff --git a/Assets/Tests/Lua/LuaEnvironmentTests.unity b/Assets/Tests/Lua/LuaEnvironmentTests.unity index d9ef8990..3ffe33bb 100644 --- a/Assets/Tests/Lua/LuaEnvironmentTests.unity +++ b/Assets/Tests/Lua/LuaEnvironmentTests.unity @@ -186,6 +186,7 @@ GameObject: serializedVersion: 4 m_Component: - 4: {fileID: 113453956} + - 114: {fileID: 113453958} - 114: {fileID: 113453957} m_Layer: 0 m_Name: LuaScript @@ -218,14 +219,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: - executeAfterTime: 1 - repeatExecuteTime: 1 - repeatEveryTime: 1 - executeAfterFrames: 1 - repeatExecuteFrame: 1 - repeatEveryFrame: 1 - hasFailed: 0 - executeMethods: 2 luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: 'check(dummycollection.stringList[1] == "hi") @@ -242,6 +235,25 @@ MonoBehaviour: ' runAsCoroutine: 1 +--- !u!114 &113453958 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 113453955} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: + executeAfterTime: 1 + repeatExecuteTime: 1 + repeatEveryTime: 1 + executeAfterFrames: 1 + repeatExecuteFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + executeMethods: 2 --- !u!1 &156811089 GameObject: m_ObjectHideFlags: 0 @@ -250,6 +262,7 @@ GameObject: serializedVersion: 4 m_Component: - 4: {fileID: 156811091} + - 114: {fileID: 156811092} - 114: {fileID: 156811090} m_Layer: 0 m_Name: LuaScript @@ -270,17 +283,11 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: - executeAfterTime: 1 - repeatExecuteTime: 1 - repeatEveryTime: 1 - executeAfterFrames: 1 - repeatExecuteFrame: 1 - repeatEveryFrame: 1 - hasFailed: 0 - executeMethods: 2 luaEnvironment: {fileID: 0} luaFile: {fileID: 0} - luaScript: pass() + luaScript: '-- Basic test to check that the Lua environment inits ok + + pass()' runAsCoroutine: 1 --- !u!4 &156811091 Transform: @@ -294,6 +301,25 @@ Transform: m_Children: [] m_Father: {fileID: 1887843215} m_RootOrder: 1 +--- !u!114 &156811092 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 156811089} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: + executeAfterTime: 1 + repeatExecuteTime: 1 + repeatEveryTime: 1 + executeAfterFrames: 1 + repeatExecuteFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + executeMethods: 2 --- !u!4 &236999594 stripped Transform: m_PrefabParentObject: {fileID: 495584, guid: 49031c561e16d4fcf91c12153f8e0b25, type: 2} @@ -419,6 +445,7 @@ GameObject: serializedVersion: 4 m_Component: - 4: {fileID: 305346651} + - 114: {fileID: 305346653} - 114: {fileID: 305346652} m_Layer: 0 m_Name: LuaScript @@ -450,6 +477,24 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: + luaEnvironment: {fileID: 0} + luaFile: {fileID: 0} + luaScript: "-- Test the timeout works in fungus.waitfor\nlocal value = false\n\nfunction + fn()\n return value\nend\n\nt = gettime()\nwaitfor(fn, 1)\ncheck(gettime() - + t >= 1)\n\n-- Test fungus.waitfor() exits if the function returns true\n-- If + this doesn't work the test will timeout and fail\nvalue = true\nwaitfor(fn, 1)\n\npass()" + runAsCoroutine: 1 +--- !u!114 &305346653 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 305346650} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: executeAfterTime: 1 repeatExecuteTime: 1 repeatEveryTime: 1 @@ -458,13 +503,6 @@ MonoBehaviour: repeatEveryFrame: 1 hasFailed: 0 executeMethods: 2 - luaEnvironment: {fileID: 0} - luaFile: {fileID: 0} - luaScript: "-- Test the timeout works in fungus.waitfor\nlocal value = false\n\nfunction - fn()\n return value\nend\n\nt = gettime()\nwaitfor(fn, 1)\ncheck(gettime() - - t >= 1)\n\n-- Test fungus.waitfor() exits if the function returns true\n-- If - this doesn't work the test will timeout and fail\nvalue = true\nwaitfor(fn, 1)\n\npass()" - runAsCoroutine: 1 --- !u!1001 &364012152 Prefab: m_ObjectHideFlags: 0 @@ -725,6 +763,7 @@ GameObject: serializedVersion: 4 m_Component: - 4: {fileID: 681659774} + - 114: {fileID: 681659776} - 114: {fileID: 681659775} m_Layer: 0 m_Name: LuaScript @@ -756,14 +795,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: - executeAfterTime: 1 - repeatExecuteTime: 1 - repeatEveryTime: 1 - executeAfterFrames: 1 - repeatExecuteFrame: 1 - repeatEveryFrame: 1 - hasFailed: 0 - executeMethods: 2 luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: '-- Test storing persistant data @@ -786,6 +817,25 @@ MonoBehaviour: ' runAsCoroutine: 1 +--- !u!114 &681659776 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 681659773} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: + executeAfterTime: 1 + repeatExecuteTime: 1 + repeatEveryTime: 1 + executeAfterFrames: 1 + repeatExecuteFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + executeMethods: 2 --- !u!1 &715881501 GameObject: m_ObjectHideFlags: 0 @@ -1025,6 +1075,7 @@ GameObject: serializedVersion: 4 m_Component: - 4: {fileID: 1124932172} + - 114: {fileID: 1124932174} - 114: {fileID: 1124932173} m_Layer: 0 m_Name: LuaScript @@ -1056,14 +1107,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: - executeAfterTime: 1 - repeatExecuteTime: 1 - repeatEveryTime: 1 - executeAfterFrames: 1 - repeatExecuteFrame: 1 - repeatEveryFrame: 1 - hasFailed: 0 - executeMethods: 2 luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: '-- Test time functions and time scaling @@ -1111,6 +1154,25 @@ MonoBehaviour: pass()' runAsCoroutine: 1 +--- !u!114 &1124932174 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1124932171} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: + executeAfterTime: 1 + repeatExecuteTime: 1 + repeatEveryTime: 1 + executeAfterFrames: 1 + repeatExecuteFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + executeMethods: 2 --- !u!4 &1167396341 stripped Transform: m_PrefabParentObject: {fileID: 495584, guid: 49031c561e16d4fcf91c12153f8e0b25, type: 2} @@ -1220,6 +1282,7 @@ GameObject: serializedVersion: 4 m_Component: - 4: {fileID: 1309386183} + - 114: {fileID: 1309386185} - 114: {fileID: 1309386184} m_Layer: 0 m_Name: LuaScript @@ -1251,14 +1314,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: - executeAfterTime: 1 - repeatExecuteTime: 1 - repeatEveryTime: 1 - executeAfterFrames: 1 - repeatExecuteFrame: 1 - repeatEveryFrame: 1 - hasFailed: 0 - executeMethods: 2 luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: '-- Test if module importing via require works @@ -1269,6 +1324,25 @@ MonoBehaviour: pass()' runAsCoroutine: 1 +--- !u!114 &1309386185 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1309386182} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: + executeAfterTime: 1 + repeatExecuteTime: 1 + repeatEveryTime: 1 + executeAfterFrames: 1 + repeatExecuteFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + executeMethods: 2 --- !u!1 &1394431693 GameObject: m_ObjectHideFlags: 0 @@ -1690,6 +1764,7 @@ GameObject: serializedVersion: 4 m_Component: - 4: {fileID: 1738134228} + - 114: {fileID: 1738134230} - 114: {fileID: 1738134229} m_Layer: 0 m_Name: LuaScript @@ -1721,14 +1796,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: - executeAfterTime: 1 - repeatExecuteTime: 1 - repeatEveryTime: 1 - executeAfterFrames: 1 - repeatExecuteFrame: 1 - repeatEveryFrame: 1 - hasFailed: 0 - executeMethods: 2 luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: '-- Test string table localisation system @@ -1777,6 +1844,25 @@ MonoBehaviour: pass()' runAsCoroutine: 1 +--- !u!114 &1738134230 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1738134227} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: + executeAfterTime: 1 + repeatExecuteTime: 1 + repeatEveryTime: 1 + executeAfterFrames: 1 + repeatExecuteFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + executeMethods: 2 --- !u!1 &1818482578 GameObject: m_ObjectHideFlags: 0 @@ -1785,6 +1871,7 @@ GameObject: serializedVersion: 4 m_Component: - 4: {fileID: 1818482579} + - 114: {fileID: 1818482581} - 114: {fileID: 1818482580} m_Layer: 0 m_Name: LuaScript @@ -1816,14 +1903,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: - executeAfterTime: 1 - repeatExecuteTime: 1 - repeatEveryTime: 1 - executeAfterFrames: 1 - repeatExecuteFrame: 1 - repeatEveryFrame: 1 - hasFailed: 0 - executeMethods: 2 luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: '-- Test if object binding works @@ -1834,6 +1913,25 @@ MonoBehaviour: ' runAsCoroutine: 1 +--- !u!114 &1818482581 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1818482578} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: + executeAfterTime: 1 + repeatExecuteTime: 1 + repeatEveryTime: 1 + executeAfterFrames: 1 + repeatExecuteFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + executeMethods: 2 --- !u!1 &1828947831 GameObject: m_ObjectHideFlags: 0 @@ -2129,6 +2227,7 @@ GameObject: serializedVersion: 4 m_Component: - 4: {fileID: 1932132174} + - 114: {fileID: 1932132176} - 114: {fileID: 1932132175} m_Layer: 0 m_Name: LuaScript @@ -2161,14 +2260,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} m_Name: m_EditorClassIdentifier: - executeAfterTime: 1 - repeatExecuteTime: 1 - repeatEveryTime: 1 - executeAfterFrames: 1 - repeatExecuteFrame: 1 - repeatEveryFrame: 1 - hasFailed: 0 - executeMethods: 2 luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: '-- Test GameObject methods like find, instantiate, spawn, etc. @@ -2204,6 +2295,25 @@ MonoBehaviour: pass()' runAsCoroutine: 1 +--- !u!114 &1932132176 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1932132173} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: + executeAfterTime: 1 + repeatExecuteTime: 1 + repeatEveryTime: 1 + executeAfterFrames: 1 + repeatExecuteFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + executeMethods: 2 --- !u!1 &1960220030 GameObject: m_ObjectHideFlags: 0