Detailed Setup
Last updated
Last updated
NOTE: You can get a quick start by adding the Generator_DemoScene_Prefab from the prefabs folder, this will have everything setup without any extra need for details below
Add an FPSController to your scene
Make sure your Main Camera has a GeneratorInteractor script attached
Make sure that your FPSController has a layer of Ignore Raycast - If you're having interaction issues
Add this set of managers from the prefabs or get the scripts from the folder (to your hierarchy or scene from the assets Prefabs folder)
InventoryManager
UIManager
AudioManager
InputManager
Look at the InventoryManager object and you will see the GeneratorInventory script attached and set references accordingly, and use values for your game.
Has Jerrycan
Should you already have a jerry can at the start?
Take a look at the InputManager object to change the settings as below:
You can choose the inputs to use in the system by selecting the dropdown.
Take a look at the AudioManager object and set the 4 ScriptableObjects as below, see the detailed page for more details on this below:
Check out the UIManager object to set the general UI elements for the package:
All the general UI elements will be children of this object and can be found as named below.
In V1.4 it now uses a CanvasGroup and sets it from 0 to 1 to show and hide the canvas
Place one or all of the Items from the prefabs folder into your scene, including a:
Jerrycan - Model
Generator - Model
FuelBarrel - Model
The Jerrycan_Model - Collectable should have:
Box Collider
GenItem script attached (Set to Jerrycan)
All of this can go on the main jerrycan model object, as the others require separate colliders so we don't accidentally pick them up
You don't require the World Space UI elements, untick the Show UI box if you don't want it
ItemType
The type of item this object is
Fuel Parameters
Set this to any value you wish your jerrycan to hold, by default it is: 100.
Show UI
Choose whether you want to 3D world canvas UI to appear when hovering over the object. False for none or true, then you must add all the world space canvas elements attached to this object
Sound Effects
Add the ScriptableObjects effects that are you in the corresponding folder.
Now the FuelBarrel will need to have a collider as a child of this object as the collider is used to interact.
Then set the FuelBarrel - Model to have the same object and similar values as below.
Box Collider
GeneratorItem script (Setup to Fuel Barrel)
Disable the ShowUI (if you don't want the world space UI elements)
Do the same setup as above
Generator Object - This will also have a Generator which will need the
Box Collider
GeneratorItem script attached (Set to Generator)
Can Burn Fuel
This should be ticked if you wish for the generator to use fuel when it is full
Fill Rate
This is the speed that you can fill the generator
Burn Rate
The higher this value the faster the generator will use up the fuel
Can Rumble
This makes the generator vibrate when it is activated. More settings will appear if true
Rumble Speed & Intensity
How fast and how intense the rumble will be
Show UI
As before with the world space canvas
Generator Events
This is when the generator is activate or deactivated, it will run events of your choice. See below or the relevant page for more information
You can press the + in the Event to create more options when you want something to happen when you activate the generator
Below is a sample script that runs the code on the UnityEvents when the generator is either activate or deactivated. This just turns emission on materials on/off, including some lights.