Beispiel #1
0
        /// <summary>
        /// Opens the source code of a BDD Component.
        /// </summary>
        /// <param name="component">The component.</param>
        /// <param name="unityInterfaceWrapper">The unity interface wrapper.</param>
        public static void OpenSourceCode(Component component, IUnityInterfaceWrapper unityInterfaceWrapper)
        {
            MonoScript script = MonoScript.FromMonoBehaviour((MonoBehaviour)component);
            string     relativeDocumentUrl = AssetDatabase.GetAssetPath(script);
            string     absoluteDocumentUrl = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + relativeDocumentUrl;

            unityInterfaceWrapper.UnityEditorInternalInternalEditorUtilityOpenFileAtLineExternal(absoluteDocumentUrl, 0);
        }
Beispiel #2
0
        /// <summary>
        /// Opens the source code of a BDD Component positioning the cursor to the method.
        /// </summary>
        /// <param name="methodInfo">The method information.</param>
        /// <param name="unityInterfaceWrapper">The unity interface wrapper.</param>
        /// <param name="assemblyDefinition">The assembly definition.</param>
        public static void OpenMethodSourceCode(MethodInfo methodInfo, IUnityInterfaceWrapper unityInterfaceWrapper, AssemblyDefinition assemblyDefinition)
        {
            SequencePoint sp          = GetSequencePointForMethod(methodInfo, assemblyDefinition);
            Document      document    = sp.Document;
            string        documentUrl = document.Url;

            unityInterfaceWrapper.UnityEditorInternalInternalEditorUtilityOpenFileAtLineExternal(documentUrl, sp.StartLine);
        }