예제 #1
0
        public static void AddLine()
        {
            GameObject tGameObject = Selection.activeGameObject;

            if (tGameObject == null)
            {
                return;
            }

            if (WillLosePrefab(tGameObject) == false)
            {
                return;
            }

            Undo.RecordObject(tGameObject, "Add a child UI Line");                      // アンドウバッファに登録

            GameObject tChild = new GameObject(GetName <UILine>(), typeof(RectTransform));

            Transform tTransform = tChild.transform;

            tTransform.SetParent(tGameObject.transform, false);
            tTransform.localPosition = Vector3.zero;
            tTransform.localRotation = Quaternion.identity;
            tTransform.localScale    = Vector3.one;

            UILine tLine = tChild.AddComponent <UILine>();

            tLine.SetDefault();

            Selection.activeGameObject = tChild;

            UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene());
        }
예제 #2
0
        /// <summary>
        /// スンスペクター描画
        /// </summary>
        override protected void DrawInspectorGUI()
        {
            // ターゲットのインスタンス
            UILine tTarget = target as UILine;

            EditorGUILayout.Separator();                // 少し区切りスペース

            //-------------------------------------------------------------------

            // マテリアル選択
            DrawMaterial(tTarget);

            //-------------------------------------------------------------------

            EditorGUILayout.Separator();                // 少し区切りスペース

            bool tTrailEnabled = EditorGUILayout.Toggle("Trail Enabled", tTarget.trailEnabled);

            if (tTrailEnabled != tTarget.trailEnabled)
            {
                Undo.RecordObject(tTarget, "UILine : Trail Enabled Change");                    // アンドウバッファに登録
                tTarget.trailEnabled = tTrailEnabled;
                EditorUtility.SetDirty(tTarget);
                UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene());
            }

            if (tTarget.trailEnabled == true)
            {
                // 頂点が消えるまでの時間
                float tTrailKeepTime = EditorGUILayout.FloatField(" Trail Keep Time", tTarget.trailKeepTime);
                if (tTrailKeepTime != tTarget.trailKeepTime)
                {
                    Undo.RecordObject(tTarget, "UILine : Trail Keep Time Change");                              // アンドウバッファに登録
                    tTarget.trailKeepTime = tTrailKeepTime;
                    EditorUtility.SetDirty(tTarget);
                    UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene());
                }
            }

/*			bool tAutoSizeFitting = EditorGUILayout.Toggle( "Auto Size Fitting", tTarget.autoSizeFitting ) ;
 *                      if( tAutoSizeFitting != tTarget.autoSizeFitting )
 *                      {
 *                              Undo.RecordObject( tTarget, "UIImageNumber : Auto Size Fitting Change" ) ;	// アンドウバッファに登録
 *                              tTarget.autoSizeFitting = tAutoSizeFitting ;
 *                              EditorUtility.SetDirty( tTarget ) ;
 *                      }*/
        }