- Home /
Shuriken: Make Particle System Completely Scale
Hi all, I've got a bit of an issue. In my game I need my entire map to be able to scale up or down, this means the particle systems do too. Some are local and some are world space. Is there any way to make it so that the same system scaled 10x as big would look exactly the same as the original but 10x the size? this means the velocities, gravity, dampening etc would also scale
Ins$$anonymous$$d of scaling the whole thing, I think it would be easier to move your rendering camera closer to /farther from the map (perspective) or change the camera size (orthographic), this way you don't need extra script to manually scale the particle system parameters which aren't automatically scaled with transform.scale.
Answer by QFSW · Sep 25, 2017 at 07:02 AM
Here's a start. It wont cover everything, but should get people started. Any time you notice a param that doesn't scale you'll need to add it. (Also use hierarchy scaling mode).
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ParticleSystemScaler : MonoBehaviour
{
private ParticleSystem ThisSystem;
private ParticleSystem.MainModule ThisMain;
private ParticleSystem.NoiseModule ThisNoise;
private ParticleSystem.LimitVelocityOverLifetimeModule ThisLimitVelocity;
private float CurrentScale;
private float InitialGravity;
private float InitialNoiseStrength;
private float InitialNoiseFrequency;
private float InitialMaxVelocity;
private void Start()
{
Initialise();
ResizeSystem(transform.lossyScale.x);
}
private void Initialise()
{
ThisSystem = GetComponent<ParticleSystem>();
if (ThisSystem)
{
ThisMain = ThisSystem.main;
ThisNoise = ThisSystem.noise;
ThisLimitVelocity = ThisSystem.limitVelocityOverLifetime;
InitialGravity = ThisMain.gravityModifierMultiplier;
InitialNoiseStrength = ThisNoise.strengthMultiplier;
InitialNoiseFrequency = ThisNoise.frequency;
InitialMaxVelocity = ThisLimitVelocity.limitMultiplier;
}
}
private void ResizeSystem(float NewScale)
{
CurrentScale = NewScale;
if (ThisSystem)
{
ThisMain.gravityModifierMultiplier = InitialGravity * NewScale;
if (ThisMain.simulationSpace == ParticleSystemSimulationSpace.World)
{
ThisNoise.strengthMultiplier = InitialNoiseStrength * NewScale;
ThisNoise.frequency = InitialNoiseFrequency / NewScale;
ThisLimitVelocity.limitMultiplier = InitialMaxVelocity * NewScale;
}
}
}
private void Update()
{
if (transform.lossyScale.x != CurrentScale) { ResizeSystem(transform.lossyScale.x); }
}
}
Answer by IgorAherne · Sep 25, 2017 at 06:14 AM
You can scale particles with their parent
http://answers.unity3d.com/answers/621713/view.html
Not sure if it will affect the gravity etc though
From what I can see, at least some of the physics is not scaled properly
Your answer
![](https://koobas.hobune.stream/wayback/20220612135530im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple trails behind one particle? 1 Answer
PS Custom Vertex Streams to Particle Trail 0 Answers
Shuriken "Distance" emission mode not working 1 Answer
ParticleSystem.Stop or particleEmitter.enabled = false; 1 Answer
Why is Shurikan particle system variable textureSheetAnimation scripting not recognised? 1 Answer