private IEnumerator Start() { ProcedureBase[] procedures = new ProcedureBase[m_AvailableProcedureTypeNames.Length]; for (int i = 0; i < m_AvailableProcedureTypeNames.Length; i++) { Type procedureType = Utility.Assembly.GetType(m_AvailableProcedureTypeNames[i]); if (procedureType == null) { Log.Error("Can not find procedure type '{0}'.", m_AvailableProcedureTypeNames[i]); yield break; } procedures[i] = (ProcedureBase)Activator.CreateInstance(procedureType); if (procedures[i] == null) { Log.Error("Can not create procedure instance '{0}'.", m_AvailableProcedureTypeNames[i]); yield break; } if (m_EntranceProcedureTypeName == m_AvailableProcedureTypeNames[i]) { m_EntranceProcedure = procedures[i]; } } if (m_EntranceProcedure == null) { Log.Error("Entrance procedure is invalid."); yield break; } m_ProcedureManager.Initialize(GameFrameworkEntry.GetModule<IFsmManager>(), procedures); yield return new WaitForEndOfFrame(); m_ProcedureManager.StartProcedure(m_EntranceProcedure.GetType()); }
协程的方式执行unity的生命周期函数
标签:procedureType,AvailableProcedureTypeNames,Log,IEnumerator,yield,Start,procedures From: https://www.cnblogs.com/mcyushao/p/17714794.html