Helper Scripts and Other Utilities
The asset includes some extra scripts and utilities that can come in handy in some cases. Here’s a list of all of them:
The first group lives in the asset’s Scripts folder and is part of the core asset. The ones marked as demo scripts live under Demo & Assets instead, so they disappear if you delete the demo, which First Steps says you can do.
Particle System Helper (AllIn1ParticleHelperComponent.cs)
Section titled “Particle System Helper (AllIn1ParticleHelperComponent.cs)”Covered in the Particle System Helper Component section.
Look At (AllIn1LookAt.cs)
Section titled “Look At (AllIn1LookAt.cs)”Used to make a GameObject face in a particular direction. You can choose if you want the facing direction to update every frame or only on start. You can choose a Transform to be the target or target the Main Camera. Finally you can choose what axis of the transform should face the target, by default the Forward vector will be the one to face the target. But you can choose whatever axis you prefer.
Bounce Animation (AllIn1VfxBounceAnimation.cs)
Section titled “Bounce Animation (AllIn1VfxBounceAnimation.cs)”It will animate the transform position back and forth over time. The starting position will be the origin point and then you can choose a Target Offset and a speed to tweak the animation.
Auto Rotate, demo script (AllIn1AutoRotate.cs)
Section titled “Auto Rotate, demo script (AllIn1AutoRotate.cs)”Rotates the transform over time around the axis of your choosing.
Auto Destroy, demo script (AllIn1VfxAutoDestroy.cs)
Section titled “Auto Destroy, demo script (AllIn1VfxAutoDestroy.cs)”The GameObject will get destroyed in N seconds after getting instantiated. This can be used when instantiating certain meshes that need to be destroyed after some time for example. If you want to clean up Particle Systems, set the Stop Action to Destroy instead (it’s a better practice since it’s cleaner and more performant).
Scroll Shader Property (AllIn1VfxScrollShaderProperty.cs)
Section titled “Scroll Shader Property (AllIn1VfxScrollShaderProperty.cs)”Takes the name (as a string, see Effects and Properties Breakdown to see the properties names) of the shader of the current Material used in the Renderer of the current GameObject or the Material we pass in as a parameter and increases or decreases its value over time. If needed it can apply a modulo operator, this is useful if we always want to keep the property in a certain range, like 0-360 for example. A new back and forth toggle has been added too, this will ensure that the property goes from the initial value to the max value back and forth, use the Scroll Speed property to choose the speed of the back and forth.
Scroll Shader Texture (AllIn1VfxScrollShaderTexture.cs)
Section titled “Scroll Shader Texture (AllIn1VfxScrollShaderTexture.cs)”The same idea for a texture rather than a float. It scrolls a named texture property over time, either its offset or its scale, and takes a Vector2 speed so the two axes move independently. It has the same three modifiers as the one above: back and forth between an initial and a maximum value, a modulo to keep the value in range, or stopping once a target value is reached. Leave the Material slot empty and it works on an instance of whatever material the Renderer is using.
Screen Shaker and DoShake, demo scripts (AllIn1Shaker.cs and AllIn1DoShake)
Section titled “Screen Shaker and DoShake, demo scripts (AllIn1Shaker.cs and AllIn1DoShake)”These 2 components combined can shake any GameObject Transform, but it was created as a simple but effective camera shaker that is currently used in the Demo. You can take a look at the Demo scene to see how it’s setup but the idea is to have an empty parent object for the camera and then have a child object with the actual Camera component in the 0,0,0 position. This will allow the camera to shake correctly regardless of the position and rotation of the parent object.
The DoShake component can be added to any effect that needs to shake the camera when instantiated. This component will call AllIn1Shaker.i.DoCameraShake(shakeAmount); on Start. Since the Shaker component follows a singleton pattern you can use the above function call to activate a shake wherever needed.
Scale Tween, demo script (AllIn1DemoScaleTween.cs)
Section titled “Scale Tween, demo script (AllIn1DemoScaleTween.cs)”This component will create a Scale Down, Scale Up procedural code animation when the function ScaleUpTween() or ScaleDownTween() is called. This is used in the Demo buttons and can be handy to polish UI and gameplay interactions. There are many ways to do this, but I decided to document in case it is useful for someone.
