Set Up‐en_gb - The-best-cat/Unity_asset-2D_trail_effect-Free GitHub Wiki

Languages

English (UK)
中文(繁體)

Base

Main

Development


Set Up

Before you can use the trails, you need to set some things up.

  1. Create an empty game object, name it whatever you want, and attach the “Trail Manager” script.

  2. On the game object you want to spawn trails of, attach the “Trail Instance” script.

  3. Just freely customise the trail!

Basic Usage

Start A Trail

At a place of a script where you want to start a trail, add the following line:

BlackCatTrail.TrailManager.Instance.StartTrail(gameObject);

*PRO ONLY FEATURE Or this line:

gameObject.StartTrail();

“gameObject” is literally the game object your script is attached to. If you want to start the trail on another game object, simply pass that game object to the bracket as the parameter instead.

Note that starting a new trail on a game object that is already spawning trails will immediately stop that trail and start the new trail.


Stop A Trail

At a place of a script where you want to stop a trail, add the following line:

BlackCatTrail.TrailManager.Instance.StopTrail(gameObject);

*PRO ONLY FEATURE Or this line:

gameObject.StopTrail();

Just like StartTrail, “gameObject” is the game object your script is attached to. If you want to stop the trail of another game object, simply pass that game object to the bracket as the parameter instead.

Passing a game object that is not spawning any trails will not give you any errors.


Check If A GameObject Is Spawning A Trail

If you want to check if a game object is spawning a trail, use this line:

BlackCatTrail.TrailManager.Instance.IsObjectSpawningTrails(gameObject);

*PRO ONLY FEATURE Or this line:

gameObject.gameObject.IsSpawningTrail();