Esempio n. 1
0
        protected virtual void OnEnable()
        {
            pdfAsset = (PDFAsset)target;

            m_Background1 = new GUIStyle();
            m_Background1.normal.background = MakeTex(600, 1, new Color(1.0f, 1.0f, 1.0f, 0.1f));
            m_Background2 = new GUIStyle();
            m_Background2.normal.background = MakeTex(600, 1, new Color(1.0f, 1.0f, 1.0f, 0.0f));
            m_Background3 = new GUIStyle();
            m_Background3.normal.background = MakeTex(600, 1, new Color(1.0f, 1.0f, 1.0f, 0.05f));

            MonoScript script   = MonoScript.FromScriptableObject(this);
            string     path     = AssetDatabase.GetAssetPath(script);
            string     logoPath = Path.GetDirectoryName(path) + "/Icons/logo_pa.png";

            m_Logo = (Texture2D)AssetDatabase.LoadAssetAtPath(logoPath, typeof(Texture2D));
        }
Esempio n. 2
0
        public static void ConvertPDFToAsset()
        {
            string path    = AssetDatabase.GetAssetPath(Selection.activeObject);
            string newPath = ConvertToInternalPath(path);

            PDFAsset numSeq = AssetDatabase.LoadAssetAtPath(newPath, typeof(PDFAsset)) as PDFAsset;
            bool     loaded = (numSeq != null);

            if (!loaded)
            {
                numSeq = ScriptableObject.CreateInstance <PDFAsset>();
            }

            numSeq.Load(File.ReadAllBytes(path));

            if (!loaded)
            {
                AssetDatabase.CreateAsset(numSeq, newPath);
            }

            AssetDatabase.SaveAssets();
        }