将脚本加入Editor,右键点击相应的特效即可,面板上更改这个psScaleFloat
自定义修改特效大小
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.IO;
using System;
using UnityEditor.Experimental.SceneManagement;
using UnityEditor.SceneManagement;
using I2.Loc;
public class PartialScale : EditorWindow
{
private static PartialScale window;
public static double psScaleFloat = 100f;
private static string patchMSize = "100";
static GameObject seGameObject;
[MenuItem("GameObject/缩放当前特效", false, 12)]
static void CreatePatch()
{
if (seGameObject == null)
{
seGameObject = Selection.activeGameObject;
}
if (seGameObject == null)
{
Debug.LogError("请选择游戏物体");
return;
}
window = (PartialScale)GetWindow(typeof(PartialScale)); //初始化一个操作窗口
window.minSize = new Vector2(400, 600);
window.maxSize = new Vector2(800, 900);
window.Show();
}
void ResetParticle()
{
foreach (var item in seGameObject.transform.GetComponentsInChildren<ParticleSystem>())
{
var main = item.main;
main.scalingMode = ParticleSystemScalingMode.Local;
item.transform.localScale = new Vector3((float)psScaleFloat, (float)psScaleFloat, (float)psScaleFloat);
}
}
private void OnGUI()
{
patchMSize = EditorGUILayout.TextField("缩放大小:", patchMSize);
psScaleFloat = Convert.ToDouble(patchMSize);
EditorGUILayout.Space();
if (GUILayout.Button("确认缩放"))
{
ResetParticle();
seGameObject = null;
window.Close();
}
}
}
用法图一
对应的编辑器图二: