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:
Particle System Helper (AllIn1ParticleHelperComponent.cs): Covered in the Particle System Helper Component section.
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): 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 (AllIn1AutoRotate.cs): Rotates the transform over time around the axis of your choosing.
Auto Destroy (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): 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.
Screen Shaker and DoShake (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 (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.
Last updated