< Summary

Class:ScriptableObjectFactory
Assembly:MainEditor
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/Editor/ScriptableObjectFactory.cs
Covered lines:0
Uncovered lines:6
Coverable lines:6
Total lines:30
Line coverage:0% (0 of 6)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
CreateScriptableObject()0%6200%
GetAssembly()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/Editor/ScriptableObjectFactory.cs

#LineLine coverage
 1using System;
 2using System.Linq;
 3using System.Reflection;
 4using UnityEditor;
 5using UnityEngine;
 6
 7/// <summary>
 8/// A helper class for instantiating ScriptableObjects in the editor.
 9/// </summary>
 10public class ScriptableObjectFactory
 11{
 12    [MenuItem("Assets/Create/ScriptableObject")]
 13    public static void CreateScriptableObject()
 14    {
 015        var assembly = GetAssembly ();
 16
 17        // Get all classes derived from ScriptableObject
 018        var allScriptableObjects = (from t in assembly.GetTypes()
 019            where t.IsSubclassOf(typeof(ScriptableObject))
 20            select t).ToArray();
 21
 22        // Show the selection window.
 023        ScriptableObjectWindow.Init(allScriptableObjects);
 024    }
 25
 26    /// <summary>
 27    /// Returns the assembly that contains the script code for this project (currently hard coded)
 28    /// </summary>
 029    private static Assembly GetAssembly () { return Assembly.Load (new AssemblyName ("MainScripts")); }
 30}