Only this pageAll pages
Powered by GitBook
Couldn't generate the PDF for 129 pages, generation stopped at 100.
Extend with 50 more pages.
1 of 100

FPS Engine Documentation

Loading...

BEFORE WE START

Loading...

Loading...

Loading...

GETTING STARTED

Loading...

Loading...

CONTENT

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

03.5 PICK UP SYSTEM

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

03.6 ENEMIES

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

03.7 EFFECTS

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

03.8 UI

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

03.8 EXTRA

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

UTILITIES

Loading...

Loading...

Welcome to FPS Engine!

Welcome to the documentation for FPS Engine, the Best Development Product Award Winner in the 15th Unity Awards.

Support Cowsins!

Thank you for purchasing FPS Engine! We hope you enjoy it as much as we love creating it. We're passionate about this project and can't wait to see what you create with the best FPS asset on the Unity Asset Store!

We'd greatly appreciate your support through a review. Join others in sharing what you love about FPS Engine!

Leave a Review.

List of Add-Ons & Compatible Packages

ADD-ONS

COWSINS AI by Comrad Elmo [ Unofficial ]

Comrad Elmo, a member of Cowsins community, is the creator of this Free AI Add-On that works exclusively with FPS Engine.

Cowsins AI Tutorials

Cowsins AI Support

Legs + IKs Add-On

List of Tutorials

Explore the different available tutorials for FPS Engine. At Cowsins, we are constantly improving FPS Engine and the content around the package, so more tutorials will be uploaded!

IMPORTANT INFORMATION REGARDING TUTORIALS Hey everyone,

Cowsins is currently experiencing some issues regarding the YouTube channel. For that reason, the tutorials are not available on YouTube right now. However, they have been backed up at the following link for now:

https://www.cowsins.com/ If you need help, feel free to reach out for support, we´ll be happy to assist you!

https://discord.gg/759gSeTT9m

We are sorry for this inconvenience and we hope to solve this issue as soon as possible. Let´s keep creating!

How to add New Weapons in FPS Engine 1.3 using the WEAPON CREATION ASSISTANT

How to Import FPS Engine in Unity 6 ( HDRP )

How to Import FPS Engine in Unity 6 ( URP )

How to Import FPS Engine in Unity 6 ( BiRP )

[ DEPRECATED FOR FPS ENGINE >0.9.6] HOW TO ADD NEW WEAPONS

CUSTOM SHOT METHODS

HOW TO ADD NEW WEAPONS ( UPDATED FOR >0.9.6 )

ENEMIES & DAMAGE 0.9.7

WORKING WITH ATTACHMENTS IN FPS ENGINE 0.9.7

ADDING VARIABLES TO CUSTOM INSPECTORS IN FPS ENGINE

How to use weapons In FPS Engine: Adding Weapon Pickeables & Initial Weapons

Exporting Weapons from Blender to Unity ( FPS Engine )

Importing FPS Engine into URP / HDRP

FIRST STEPS WITH FPS ENGINE - Standalone Installation + Getting Started

How to Set Up Grounds & Walkable Surfaces in FPS Engine

How to add Touch Input Controls in FPS Engine ( Make Mobile Phone Games with FPS Engine )

How to add Custom Interactables in FPS Engine

03.1 CAMERA

CameraFOVManager

This script handles FOV for different movement states such as running, walking or wallrunning.

  • Player: Reference to our player ( Rigidbody ).

SetFOV ( float fov )

If allowed ( Not aiming ), sets the fov to the defined value. Uses the default lerpSpeed.

  • fov: Target field of view.

SetFOV ( float fov, float speed )

If allowed ( Not aiming ), sets the fov to the defined value.

  • fov: Target field of view.

  • speed: Override the lerp speed of the camera. ( Speed to go from the current FOV to the default FOV ).

ForceAddFOV ( float fov)

Whether allowed or not, adds a desired value to the current field of view.

  • fov: field of view value to add to the current fov.

Early Considerations

00.a Cowsins Copyright and intellectual property.

Cowsins as a publisher on the Unity Asset Store, including Cowsin´s assets such as this specific one, COWSINS: FPS ENGINE, is protected under Unity Asset Store terms of service and EULA.

The Unity Asset Store terms of service and EULA protect Cowsins™ as a publisher on the marketplace, including Cowsin's™ assets such as COWSINS: FPS ENGINE.

UNITY EULA.9.1

The Assets are protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties.

UNITY EULA 6 REVERSE ENGINEERING, DECOMPILATON AND DIASSEMBLY

END USER may modify Assets. END USER shall not reverse engineer, decompile, or disassemble Services SDKs, except and only to the extent that such activity is expressly permitted under mandatory statutory applicable law.

CHANGES AND MODIFICATIONS

This document may be updated following new releases. The asset itself might undergo various changes, including updates, new content, reworks, improvements, and optimizations.

LICENSE FAQs

Can I make a game with FPS Engine and sell the game?

Yes. You can make a game with FPS Engine and sell or distribute the game.

Do I need to Credit Cowsins or FPS Engine in my game?

You don´t need to. Credit is voluntary, but much appreciated

Introduction & License Agreement | Cowsins AI

PlayerMovement

ASSIGNABLES

  • playerCam: The parent GameObject to which the main camera should be attached.

  • orientation: An object with the same height as the camera, used to rotate the player around the Y-axis for visual orientation.

  • useSpeedLines: Enables or disables speed line effects that appear when the player reaches a certain speed threshold.

    • speedLines: A reference to the particle system component that generates the speed line effects.

    • minSpeedToUseSpeedLines: The minimum speed required for speed lines to be displayed.

    • speedLinesAmount: Being 1 = default, amount of speed lines displayed.

MOVEMENT

  • autoRun:Enables automatic running without requiring the player to hold a sprint button.

  • alternateSprint: Defines the sprint behavior:

    • True: Hold to sprint, release to stop sprinting.

    • False: Press and hold to sprint continuously.

  • alternateCrouch: Defines the crouch behavior:

    • True: Hold to crouch, release to uncrouch.

    • False: Press and hold to crouch continuously.

  • canRunBackwards: Determines if the player maintains running speed while moving backward:

    • True: Running speed applies when moving backward.

    • False: Walking speed applies when moving backward.

  • canRunSideways: Determines if the player maintains running speed while moving sideways (strafing):

    • True: Running speed applies when strafing.

    • False: Walking speed applies when strafing.

  • canRunWhileShooting:Determines if the player maintains running speed while shooting:

    • True: Running speed applies while shooting.

    • False: Walking speed applies while shooting.

  • loseSpeedDeceleration: The rate at which the player's speed decreases from running to walking

  • acceleration: The player's ability to gain speed quickly.

  • runSpeed: The player's running speed

  • walkSpeed: The player's walking speed

  • allowCrouch: Enables or disables the player's ability to crouch.

  • crouchCancelMethod: Defines how the player can exit the crouch state. ( Smooth, FullStop )

  • crouchSpeed: The player's movement speed while crouching

  • crouchTransitionSpeed: The speed at which the player transitions into and out of the crouch state

  • roofCheckDistance: Distance to detect a roof above the head.

  • maxSpeedAllowed:The maximum speed the player can reach, used to clamp the player's velocity.

  • whatIsGround: A bitmask representing the layers considered ground. The player can walk on objects within these layers. Check Adding New Surfaces ( Grounds )

  • groundCheckDistance: The distance from the bottom of the player to check for ground collision.

  • frictionForceAmount: The amount of force applied to the player's movement to simulate friction.

  • maxSlopeAngle:The maximum angle (in degrees) of a slope the player can walk on.

CAMERA

WARNING: The maximum camera angle is highly recommended to be set to the maximum value, 89.7

  • maxCameraAngle: The maximum vertical angle (in degrees) allowed for the camera rotation. This limits how far the player can look up or down

WARNING: The Player Sensitivity (Mouse & Controller) values will be overridden if you open the scene from the Main Menu. Check GameSettingsManager.cs for more information.

  • sensitivityX: Horizontal sensitivity (X Axis)

  • sensitivityY: Vertical sensitivity (Y Axis)

  • controllerSensitivityX: Horizontal sensitivity (X Axis) using controllers

  • controllerSensitivityY: Vertical sensitivity (Y Axis) using controllers

  • aimingSensitivityMultiplier: Sensitivity will be multiplied by this value when aiming

  • normalFOV: Default field of view of your camera

  • runningFOV: Running field of view of your camera

    • wallrunningFOV: Wallrunning field of view of your camera

    • fovToAddOnDash: Amount of field of view that will be added to your camera when dashing.

  • fadeInFOVAmount: Fade Speed - Start Transition for the field of view

  • fadeOutFOVAmount: Fade Speed - Finish Transition for the field of view

    • slidingCameraTiltAmount: Rotation of the camera when sliding. The rotation direction is defined by the sign of the value.

  • cameraTiltTransationSpeed: Speed of the tilt camera movement. This is essentially used for wall running

SLIDING

Enabling this unlocks new customization variables under "CAMERA"

  • allowSliding: Enables or disables sliding for the player.

  • slideForce: Forward Force added to the Player on sliding.

  • slideCounterMovement: The amount of force applied in the opposite direction of the player's movement during a slide

JUMPING

  • allowJump: Enables or disables the player's ability to jump.

    • maxJumps: Amount of jumps you can do without touching the ground

    • resetJumpsOnWallrun: Gains jump amounts when wallrunning.

    • resetJumpsOnWallBounce: Gains jump amounts when wallrunning.

  • directionalJumpMethod: Method to apply on jumping when the player is not grounded, related to the directional jump

  • directionalJumpForce: Force applied on an object in the direction of the directional jump

  • jumpForce: The higher this value is, the higher you will get to jump.

  • controlAirborne: How much control you own while you are not grounded. Being 0 = no control of it, 1 = Full control.

  • allowCrouchWhileJumping: Turn this on to allow the player to crouch while jumping

  • canJumpWhileCrouching: Allow the player to jump mid-air.

  • jumpCooldown: Interval between jumping

  • coyoteJumpTime: Coyote jump allows users to perform more satisfactory and responsive jumps, especially when jumping off surfaces

AIM ASSIST

  • applyAimAssist: Determine wether to apply aim assist or not.

    • maximumDistanceToAssistAim: Maximum distance to keep the Aim Assist

    • aimAssistSpeed: CamerDefine wallrunnable wall layers. By default, this is set to the same as whatIsGround.aOur Slider UI Object. Stamina will be shown here Snapping speed.

    • aimAssistSensitivity: size of the aim assist range.

STAMINA

  • usesStamina: You will lose stamina on performing actions when true.

    • minStaminaRequiredToRun: Minimum stamina required to being able to run again.

    • maxStamina: Max amount of stamina.

    • staminaRegenMultiplier: Stamina Regeneration Speed

    • LoseStaminaWalking: Loses Stamina Walking if true.

    • staminaLossOnJump: Amount of stamina lost on jumping

    • staminaLossOnSlide: Amount of stamina lost on sliding.

    • staminaLossOnDash: Amount of stamina lost on dashing (Introduced in 1.3).

    • staminaSlider: Our Slider UI Object. Stamina will be shown here

ADVANCED MOVEMENT

WALL RUN

  • canWallRun: When enabled, it will allow the player to wallrun on walls

    • whatIsWallRunWall: Define wallrunnable wall layers. By default, this is set to the same as whatIsGround.

    • useGravity: When enabled, gravity will be applied on the player while wallrunning. If disabled, the player won´t lose height while wallrunning.

      • wallrunGravityCounterForce: Since we do not want to apply all the gravity force directly to the player, we shall define the force that will counter gravity. This force goes in the opposite direction from gravity.

    • maxWallRunSpeed: Maximum speed reachable while wall running.

    • normalWallJumpForce: When wall jumping, force applied on the X axis, relative to the normal of the wall

    • upwardsWallJumpForce: When wall jumping, force applied on the Y axis.

    • stopWallRunningImpulse: Impulse applied on the player when wall run is cancelled. This results in a more satisfactory movement. Note that this force goes in the direction of the normal of the wall the player is wall running.

    • wallMinimumHeight: Minimum height above ground (in units) required to being able to start wall run. Wall run motion will be cancelled for heightsMethod to determine length of wallRun. below this

    • cancelWallRunMethod: Method to determine length of wallRun.

WALL BOUNCE

  • canWallBounce: When enabled, it will allow the player to wall bounce on walls.

    • wallBounceForce: Force applied to the player on wall bouncing. Note that this force is applied on the direction of the reflection of both the player movement and the wall normal.

    • wallBounceUpwardsForce: Force applied on the player on wall bouncing ( Y axis – Vertical Force ).

    • oppositeWallDetectionDistance: maximum Distance to detect a wall you can bounce on. This will use the same layer as wall run walls.

DASHING

  • canDash: When enabled, it will allow the player to perform dashes.

    • dashMethod: Method to determine how the dash will work

    • infiniteDashes: When enabled, it will allow the player to perform dashes.

    • amountOfDashes: maximum ( initial ) amount of dashes. Dashes will be regenerated up to “amountOfDashes”, you won´t be able to gain more dashes than this value, check dash Cooldown.

    • dashCooldown: Time to regenerate a dash on performing a dash motion

    • damageProtectionWhileDashing: When enabled, player will not receive damage

    • dashForce: force applied when dashing. Note that this is a constant force, not an impulse, so it is being applied while the dash lasts

    • dashDuration: Duration of the ability ( dash ).

    • canShootWhileDashing: When enabled, it will allow the player to shoot while dashing.

GRAPPLING HOOK

  • allowGrapple: If true, allows the player to use a customizable grappling hook.

    • maxGrappleDistance: Maximum distance allowed for the player to begin a grapple action

    • grappleCooldown: Once the grapple has finished, time to enable it again.

    • distanceToBreakGrapple: If the distance between the grapple end point is equal or less than this value ( in Unity units ), the grapple will break.

    • grappleForce: Force applied to the player on grappling.

    • grappleSpringForce: Spring Force applied to the rope on grappling.

    • grappleDamper: Damper applied to reduce ropes´ oscillation.

    • drawDuration: Time that takes the rope to draw from start to end.

    • ropeResolution: Amount of vertices the rope has. The bigger this value, the better it will look, but the less performant the effect will be.

    • waveAmplitude: Size of the wave effect on grappling. This effect is based on sine.

    • waveAmplitudeMitigation: Speed to decrease the wave amplitude over time

CLIMBING LADDERS

  • canClimb: If true, allows the player to climb Ladders.

    • maxLadderDetectionDistance: Maximum Distance to detect a Ladder

    • climbSpeed: Speed to Climb up the Ladder

    • topReachedUpperForce: On reaching the top, this is the upwards force applied to the Player

    • topReachedForwardForce: On reaching the top, this is the forward force applied to the Player

    • allowVerticalLookWhileClimbing: Enable this to allow the Player to move the Camera vertically

    • hideWeaponWhileClimbing: Hides the Weapon when Climbing

OTHERS

  • sounds: Player Movement Sounds

  • grappleSounds: Player Grapple Sounds

  • footstepVolume: Volume of the AudioSource.

  • footstepSpeed: Play speed of the footsteps.

  • footsteps: Footstep clips for all the ground layers

  • events

Functions | PlayerMovement.cs

RegainDash()

Adds a dash to the dash count of the player.

ResetDashes()

Reset all the dashes to the maximum amount of the dash count of the player.

TeleportPlayer(Vector3 position, Quaternion rotation)

Teleport the player to the specified position and rotation.

  • position: Vector3 to teleport the player to.

  • rotation: Rotation for the camera to aim at on teleport.


PlayerMovementEditor.cs can be found as an external script.

02. Roadmap

Welcome to FPS ENGINE by Cowsins.

At Cowsins™ we have always been passionate about videogames, and specially about game development, and that´s why we built this asset with all our love, dedication, attention to detail and knowledge we could deliver.

We are so excited to see how the project evolves in a new thrilling journey for us.

So, what´s coming next? Upcoming updates will feature major improvements and adjustments, as well as feature introductions!

You can suggest new features in our discord server!

Check the official Trello board!

https://discord.gg/9eYPeHg4fh
https://trello.com/b/Fl0xc5Er/fps-engine-roadmap

MoveCamera

This script places the camera at its correct position and makes sure it is properly situated.

  • Head: Reference to our head = height of the camera. This is a transform inside the Player Prefab.

03.2 MOVEMENT

03. Content

You will find all the information you want in this area, together with an explanation of each variable, to comprehend how the scripts included in the package operate.

Please notice that the information for each variable can be found within the Unity Editor as well ( hover any FPS Engine variable and wait until you can see a message pop up ). In this section, you won´t only find these, but also methods that you can use from each script to expand FPS Engine.

Remember also that all the code is well documented with comments.

All these scripts belong to the namespace cowsins, so if you are trying to access them externally, please make sure you are using the cowsins library.

using cowsins;

DOCUMENTATION LEGEND

Inspector Variable: A variable that can be edited through the Unity inspector.

Public Function: A function that can be accessed through code.

Accessors ( Variable Type )

The scripts will be arranged similarly to how they are here, within the appropriate directories.

Explore the content organization:

03.1 – CAMERA

03.2 – MOVEMENT

03.3 – PLAYER

03.4 – WEAPONS

03.5 – PICK UP SYSTEM

03.6 – ENEMIES

03.7- EFFECTS

03.8 – UI

03.9 – EXTRA

03.10 – MANAGERS

01. Basic set-up

BEFORE READING: This tutorial covers the essential information discussed in this section (Package Installation & First Steps).

If you're new to using FPS Engine, we highly recommend watching it!

STEP 01 – INSTALLING UNITY -------------------------------------

  1. If you already have a version of Unity that supports FPS ENGINE (2021.1.16 or above), you can skip to the next step. Otherwise, please visit the Unity Download Archive to select and install a compatible version.

  2. Afterwards, download and install Unity Hub, which helps you manage all your projects and versions in one place. If you already have Unity Hub, you'll be directed to its download page.

Keep in mind that the asset was using Unity 2021.1.16.

STEP 02 – PROJECT CREATION -----------------------------------

  1. After installing your desired version of unity, open the Unity Hub.

  2. Select "New Project" under "Projects" in the menu. A new window will then open as a result.

  3. The render pipelines that Unity provides will be available for you to choose from here. The default standalone render pipeline was used to create the package. Choose 3D out of all the possibilities if you want to maintain all the materials and graphic settings for the project that the asset includes.

You can select a different render pipeline, but keep in mind that you will need to translate each material into the materials used by that render pipeline.

You can use FPS Engine with URP or HDRP, here´s a tutorial you can watch to import FPS Engine in either URP or HDRP:

Step 05 also covers URP & HDRP Import instructions.

https://youtu.be/bopNm-g5uwc

STEP 03 – IMPORTING PACKAGE ---------------------------------

  1. Once Unity is fully loaded, we´ll import the asset. To do that, go to the Unity Package Manager (Window/Package Manager).

  2. On the new window, select “My Assets” which stands for the assets you own.

  3. Search “FPS Engine” and click download.

  4. Once it is downloaded, click import.

IMPORTANT: During the installation process, import the dependencies, and enable the new Input System.

STEP 04 – DEPENDENCIES ----------------------------------------

Have in mind that the asset includes dependencies, such as TextMeshPro, InputManager or PostProcessing.

( ONLY FOR URP & HDRP ) STEP 05 – URP OR HDRP USERS ----

Note that even though FPS Engine is fully compatible with URP and HDRP, you may lose the world space shader as well as you will need to replace all the materials from the Built-in pipeline to the one you chose: Apart from that, FPS Engine should work as usual!

To upgrade built-in Shaders:

  • Open your Project in Unity, and go to Edit > Render Pipeline > Universal Render Pipeline. This menu option has changed in 2022.3 LTS: it's now Window > Rendering > Render Pipeline Converter.

  • According to your needs, select either Upgrade Project Materials to URP Materials or Upgrade Selected Materials to URP Materials.

Additionally, you will require to update the Grid material manually, as it requires a custom shader that cannot be used in URP or HDRP. This Grid material can be found under the path: Cowsins\Materials\Environment\Grid\GridMaterial.

If you encounter issues with the Camera (you can´t see anything, or your screen is blue). Navigate to WeaponCamera under your Player and set the RenderType of the Camera Component to “Overlay”. Then, set it as “Stacked Camera” in the Main Camera inspector.

Check Unity´s official documentation regarding this for more information.

What to do next? Check Getting Started:First Steps.

Following these steps, your project ought to be operational. If you have any problems or inquiries, you can get in touch with Cowsins™.

Support

E-mail : cowsinsgames@gmail.com

Discord: https://discord.gg/mqdnyYZ894

Twitter: https://twitter.com/cOWsins

Discord is the preferred support method and response times are faster.

PlayerBaseState

Establishes the fundamental structure of the states. This layout applies to all Player States.

03.3 PLAYER

PlayerStates

Allows the player to utilize and access the Player States.

Functions and Accessors | PlayerStates.cs

CurrentState ( PlayerBaseState ) / Public get / Private set

Returns the current state of the state machine ( which inherits from PlayerBaseState )

_States ( PlayerStateFactory ) / Public get / Private set

Returns all the PlayerStates.

ForceChangeState(PlayerBaseState newState)

Forces the state machine to switch states.

Take a look at an example of implementation for ForceChangeState ( Assuming you previously have a reference for PlayerStates )

PlayerBaseState myNewState = playerStates._States.Default();
playerStates.ForceChangeState(myNewState);
Click on Install to Install the desired Unity Versiob

WEAPON STATES

The FPS Engine utilizes two distinct state machines: one dedicated to player movement and the other managing the weapon system. Within this folder, you will find all the various weapon states implemented in the FPS Engine, alongside the corresponding state machine logic.

PlayerStateFactory

Contains all the available Player States.

How can I add a new State?

First, make a new script that inherits from PlayerBaseState. Take a look at the provided example code:

using UnityEngine;
namespace cowsins
{
    public class PlayerCustomState : PlayerBaseState
    {

        public PlayerCustomState (PlayerStates currentContext, PlayerStateFactory playerStateFactory)
            : base(currentContext, playerStateFactory) { }

        public override void EnterState()
        {
            // Do something on entering the state
        }

        public override void UpdateState()
        {
            CheckSwitchState();
        }

        public override void FixedUpdateState() { }

        public override void ExitState() {
            // Do something on exiting the state
        }

        public override void CheckSwitchState() { }

        public override void InitializeSubState() { }

    }
}

Once you have this, we need to register this state in the PlayerStateFactory.cs as shown:

public PlayerBaseState Die() { return new PlayerCustomState(_context, this); }

List of Available PlayerStates

  1. PlayerDefaultState

  2. PlayerJumpState

  3. PlayerDeadState

  4. PlayerDashState

  5. PlayerCrouchState

  6. PlayerClimbState

PlayerStats

PlayerStats inherits from IDamageable.cs, which is an interface. Notice that all Damageable objects in FPS Engine inherit from IDamageable.cs

PLAYER STATES

  • maxHealth: The initial amount of health points the player has.

  • maxShield: The initial amount of shield points the player has.

FALL DAMAGE

  • takesFallDamage:Enables or disables fall damage. When true, the player takes damage when falling from a great height.

    • minimumHeightDifferenceToApplyDamage: The minimum distance (in units) the player must fall to take fall damage.

    • FallDamageMultiplier A multiplier applied to the base fall damage to determine the final damage dealt. Higher values mean greater damage per unit fallen.

AUTO HEAL

  • enableAutoHeal: Enables or disables automatic player healing over time.

    • healRate: The rate at which the player's health regenerates.

    • healAmount: The amount of health regained with each heal tick (alternative to healRate for discrete healing).

    • restartAutoHealAfterBeingDamaged:When true, being damaged resets the auto-heal timer, delaying healing until the timer expires again.

      • restartAutoHealTime: The time (in seconds) it takes for auto-heal to resume after being disabled by damage (if restartAutoHealAfterBeingDamaged is true).

Functions and Accessors | PlayerStats.cs

Controllable ( bool ) / Public get / Private set

Returns true if the player can be controlled.

Returns the value of "controllable"

Grant Control()

Force Controllable to be true.

Lose Control()

Force Controllable to be false.

CheckIfCanGrantControl()

Checks if the game is paused before providing control to the player.

Recommended usage over GrantControl to avoid issues.

Respawn( Vector3 position )

Respawns the player at a given position.

  • position: Position to teleport the player to.


PlayerStatsEditor.cs can be found as an external script.

WeaponStates

Allows the player to utilize and access the Player States.

Functions and Accessors | PlayerStates.cs

CurrentState ( WeaponBaseState ) / Public get / Private set

Returns the current state of the state machine ( which inherits from WeaponBaseState )

_States ( WeaponStateFactory ) / Public get / Private set

Returns all the WeaponStates.

ForceChangeState(WeaponBaseState newState)

Forces the state machine to switch states.

Take a look at an example of implementation for ForceChangeState ( Assuming you previously have a reference for WeaponStates )

WeaponBaseState myNewState = weaponStates._States.Default();
weaponStates.ForceChangeState(myNewState);

WeaponBaseState

Establishes the fundamental structure of the states. This layout applies to all Weapon States.

WeaponStateFactory

Contains all the available Weapon States.

How can I add a new State?

First, make a new script that inherits from WeaponBaseState. Take a look at the provided example code:

using UnityEngine;
namespace cowsins
{
    public class WeaponCustomState : WeaponBaseState
    {

        public WeaponCustomState (WeaponStates currentContext, WeaponStateFactory weaponStateFactory)
            : base(currentContext, weaponStateFactory) { }

        public override void EnterState()
        {
            // Do something on entering the state
        }

        public override void UpdateState()
        {
            CheckSwitchState();
        }

        public override void FixedUpdateState() { }

        public override void ExitState() {
            // Do something on exiting the state
        }

        public override void CheckSwitchState() { }

        public override void InitializeSubState() { }

    }
}

Once you have this, we need to register this state in the WeaponStateFactory.cs as shown:

public WeaponBaseState Die() { return new WeaponCustomState(_context, this); }

List of Available WeaponStates

  1. WeaponDefaultState

  2. WeaponShootingState

  3. WeaponReloadingState

  4. WeaponInspectState

  5. MeleeState

Player Debugging

Introduced in 1.3

This component enables you to display handy debugging information about the Player. By default, none of the Player Controllers include this component. If you need to access these debug values, follow these instructions:

  1. Locate the Player object within your PlayerController prefab. Ensure this Player object includes components such as PlayerMovement, WeaponController, etc...

  2. Assign the PlayerDebugger component

This way, you can now visualize important information related to your Player Controller. In case you do not need this debug information anymore, simply remove PlayerDebugger from your player or disable it.

03.4 WEAPONS

Bullet

Used for Bullets instantiated by the Player only

This script must be attached to the projectile of a Projectile Shoot Style Weapon. Let´s take a look at the provided Rocket Launcher. As you can see, it only accepts Prefabs with the Bullet component attached as a reference for the projectile.

This projectile must have a Trigger Collider assigned as well, otherwise no collision will be detected.

You can see the BulletTest example under the following path: Assets/Cowsins/Prefabs/Projectiles

To create new projectiles, you can just duplicate the BulletTest prefab and modify the graphics inside.

WeaponIdentification

This component identifies a weapon prefab. It enables the WeaponController to determine which weapon is currently unholstered and its corresponding Weapon_SO. This functionality is also highly beneficial for managing weapon attachments.


BASIC

  • Weapon: This Weapon_SO must match the Weapon_SO that contains this WeaponIdentification.

  • FirePoint: Every weapon, excluding melee, must have a firePoint, which is the point where the bullet comes from. Make an empty object, call it firePoint for organization purposes and attach it here. Refer to Adding New Weapons for more information.

  • AimPoint: Transform that defines the aiming point. Generally placed on the Iron Sights / Scope.

ATTACHMENTS

  • defaultAttachments: Defines the default attachments for your weapon. The first time you pick it up, these attachments will be equipped.

  • compatibleAttachments: Defines all the attachments that can be equipped on your weapon.

Refer to Working With Attachments

WeaponController

INVENTORY

  • inventorySize: Maximum amount of weapons you can have

  • initialWeapons: An array that includes all your initial weapons.

REFERENCES

  • mainCamera: Attach your main camera

  • cameraPivot: Attach your camera pivot object

  • weaponHolder: Attach your weapon holder

VARIABLES

  • resizeCrosshair: Do you want to resize your crosshair on shooting ?

  • autoReload: If true you won´t have to press the reload button when you run out of bullets

  • alternateAiming: If false, hold to aim, and release to stop aiming.

  • hitLayer: What objects should be hit

  • removeCrosshairOnAiming: Do not draw the crosshair when aiming a weapon

  • canMelee: Enables and Disables the Melee Attack ( Press F to Attack )

    • holsterMotionObject: Animator the plays an animation to hide the Weapon

    • meleeDuration: How much time the melee lasts

    • meleeDelay: Delay time to hit the target

    • meleeAttackDamage: Damage to deal.

    • meleeRange: How far you are able to land a hit

    • meleeCamShakeAmount: Camera Shake on Melee

    • reEnableMeleeAfterAction: Enable Time to elapse after executing a Melee Attack

EFFECTS

  • effects

EVENTS

  • events


WeaponControllerEditor.cs can be found as an external script.

Attachment.cs

The available attachments are the following:

  • Barrel

  • Flashlight

  • Grip

  • Laser

  • Magazine

  • Scope

  • Stock

All of these attachments and their respective scripts inherit from Attachment.cs, so they also share the following variables:

  • attachmentIdentifier: Identifier of the attachment. You can have the same attachment within different weapons as long as they share this attachment identifier scriptable object.

  • weightAdded: Weight to add to the weapon. If it weighs less, set a negative value.

  • reloadSpeedIncrease: Percentage added to the base reload speed

  • aimSpeedIncrease: Percentage added to the base aim speed

  • fireRateIncrease: Percentage added to the base fire rate

  • damageIncrease: Percentage added to the base damage

  • cameraShakeMultiplier

  • penetrationIncrease: Percentage added to the base penetration

Weapon_SO

INTRODUCTION

Weapon_SOs are at the heart of the FPS Engine's weapon systems. They define all the characteristics and stats for the different weapons in your project. A Weapon_SO is a scriptable object, which means you can create a unique one for each weapon by right-clicking in your Project folder, going to Create → COWSINS → New Weapon.

FPS Engine comes with various showcase weapons that have Weapon_SOs fully configured. You can find them under Cowsins/ScriptableObjects/Weapons.

Understanding the importance of Weapon_SOs is crucial for adding new weapons. If you're unsure how to add weapons in the FPS Engine, be sure to check out the following tutorial:

WEAPON_SO

BASIC

  • Name: You weapon´s name. Ex: Glock

  • WeaponObject: Attach your weapon prefab here. This weapon prefab will be instantiated on your screen when you equip this weapon.

  • Pick Up Graphics: Visuals that will appear on a dropped weapon.

  • Icon: Custom image of your weapon

When you assign an icon, it will be displayed in the inspector to ensure it is the appropriate one

SHOOTING

  • ShootStyle: Type of shooting.

    • Hitscan = This weapon fires and instantly hits its target at any range.

    • Projectile =Fires a physical bullet that travels through the world and can be affected by gravity

    • Melee: Close range weapons such as swords or knives.

  • ShootMethod: Defines how Input is processed to shoot.

    • Press

    • PressAndHold

    • HoldAndRelease

    • HoldUntilReady

  • FireRate: Time between each shot

  • BulletRange: How far the bullet is able to travel

  • BulletsPerFire: Bullets instantiated per each shot. Grants the possibility of making shotguns, burstguns etc.

    • TimeBetweenShots: Elapsed time until the next bullet spawns.

Keep TimeBetweenShots at 0 to make shotguns. Change its value to make burst weapons.

  • AmmoCostPerFire: How much ammo you lose per each fire ( & per each fire point )

  • ApplyBulletSpread:Apply spread per shot

    • SpreadAmount:How much spread is applied.

    • AimSpreadAmount:How much spread is applied while aiming.

  • ApplyRecoil:Apply recoil on shooting

    • RecoilX: Horizontal Recoil Animation Curve

  • RecoilY: Vertical Recoil Animation Curve

These two movements are mixed to create the pattern.

  • xRecoilAmount: Horizontal Recoil Distance

  • yRecoilAmount: Vertical Recoil Distance

  • RecoilRelaxSpeed: : When the user is not shooting, speed to go from the current recoil point to the origin point of the recoil.

  • ApplyDifferentRecoilOnAiming: Enable this to set different recoil amounts while aiming.

  • xRecoilAmountOnAiming: Distance of the recoil on the X axis while aiming.

  • yRecoilAmountOnAiming: Distance of the recoil on the Y axis while aiming.

  • PenetrationAmount: Amount of bullet penetration ( Wallbang )

  • PenetrationDamageReduction: Damage reduction multiplier. From 0 to 1 ( 0% to 100% )


PROJECTILE WEAPONS ONLY:

  • Projectile: Attach your projectile here. It must have a Bullet.cs script attached to it.

  • ProjectileUsesGravity: When enabled, your projectiles will use gravity and describe a parabola. It is important to set a rigidbody to the projectile attached above. You can easily adjust the parabola with the rigidbody and projectile speed settings

  • Speed: Speed of the instantiated projectile

  • ShootDelay: Time to wait for the bullet to be shot.

  • BulletDuration: Bullet Lifetime.

  • HurtsPlayer: When enabled, projectiles will also hurt the player. Generally used for explosive weapons.

  • ExplosionOnHit: When enabled, the projectile will cause an explosion on hit. Check new features unlocked under the “Visuals” tab.

    • ExplosionRadius: Area to deal damage and apply explosion forces to.

    • ExplosionForce: Force applied on nearby rigid bodies ( with the explosion radius ).

If explosionOnHit is true, new customization features unlocked under the "Visuals" Tab

MELEE WEAPONS ONLY:

  • AttackRange: How far you are able to land a hit

  • AttackRate: Attacking pace. TheTime to delay the melee hit lower, the faster.

  • HitDelay: Time to delay the melee hit

STATS

  • Infinite Bullets: If true, you will never run out of bullets. Bullets and Magazine UI won´t be displayed for infinite bullets weapons.

    • MagazineSize: Magazine capacity. Amount of bullets per magazine.

    • : If true, your weapon will have a certain amount of bullets, so you can run out of ammo.

      • TotalMagazines: Amount of initial magazines. Amount of initial bullets = magazineSize * TotalMagazines.

  • DamagePerBullet: Amount of damage dealt per each body shot.

  • CriticalDamageMultiplier: If a headshot is landed, base damage (DamageperBullet) will be multiplied by this.

  • ApplyDamageReductionBasedOnDistance: if true, damage will decrease or increase depending on how far you are from the target

    • MinimumDistanceToApplyDamageReduction: Damage reduction will be applied for distances larger than this

    • DamageReductionMultiplier: Adjust the damage reduction amount

  • ReloadStyle: The way the weapon reloads

    • DefaultReload

    • Overheat

  • ReloadTime: Time required to fully reload your weapon.

  • AllowAim: Enable this if you want the players to be able to aim the weapon. Check new options unders spread options.

    • AimDistance: Distance of the camera from the aim point

    • AimingRotation: : Rotation of the weapon while aiming.

    • AimingSpeed: Interpolation speed between states.

    • AimingFOV: Camera field of view while aiming.

    • AllowAimingIfReloading: Allows the player to aim even when reloading. False by default.

    • SetMovementSpeedWhileReloading: If true, you will be able to determine a velocity for your player while you are aiming.

      • MovementSpeedWhileAiming: Speed of the player while aiming.

  • ApplyWeight: If true, the weight of the weapon will affect the speed of the player.

    • WeightMultiplier: Being 1 the lightest, and 2 the heaviest.

VISUALS

  • useProceduralShot: Set this to true if you want to use a procedural shot instead of an animation.

    • proceduralShotPattern: Attach your procedural shot pattern here.

  • GrapplesFromTip: : if your player can use the grappling hook, enable this to draw the rope ( or grapple hook ) from the tip of your gun. This position will be the position of your first firePoint.

  • CamShakeAmount: Amount of camera shake per shot. Recommended = .15f

  • CamShakeCrouchMultiplier: Multiplier applied to the cam shake amount when crouching

  • CamShakeAimMultiplier: Multiplier applied to the cam shake amount when aiming.

  • ApplyFOVEffectOnShooting: If true it will apply a different FOV value when shooting to add an extra layer of detail. FOV will automatically lerp until it reaches its default value.

    • FOVValueToSubstract: : FOV Value to substract to the current fov value.

    • AimingFOVValueToSubstract: FOV Value to substract to the current fov value when aiming.

  • ShowBulletShells: If enabled, bullet shells will be instantiated on shooting.

    • BulletGraphics: Bullet shells 3D gameObject. This will be instantiated on shooting

  • BulletHoleImpact: Array of visual effects on bullets hitting objects. Attach each layer its own impact effect.

  • BulletTrail: Assign a Trail Renderer prefab that follows the bullet.

AUDIO

  • audioSFX: Array of AudioClips for each specified event, such as firing or reloading. Add your clips individually for each situation

  • pitchVariationFiringSFX: Per each shot, pitch will be modified by a number between - pitchVariationFiringSFX and +pitchVariationFiringSFX

UI

  • crosshairResize: Crosshair size when shooting.

  • crosshairPreset: Crosshair preset for the specific weapon


Weapon_SOEditor can be found within Weapon_SO.cs

ATTACHMENTS

Inside the Cowsins/Scripts/Weapons folder, there's a subfolder called Attachments. This is where you'll find all the necessary scripts for the Attachment System to function.

For more information regarding using Attachments with Weapons in FPS Engine, please check the following tutorial found in the List of Tutorials:

Flashlight.cs

  • lightSource: Light for the flashlight

  • turnOnSFX: SFX for turning the flashlight on.

  • turnOffSFX: SFX for turning the flashlight off.

Functions | Flashlight.cs

CheckIfCanTurnOn(bool cond)

If the provided condition is met, the flashlight will turn on.

  • cond: condition to be met for the flashlight to be turned on.

EnableFlashlight(bool cond)

Forces the flashlight to turn on if the condition is met.

Light source will be enabled or disabled too.

  • cond: condition to be met for the flashlight to be turned on.

Flashlight.cs inherits from . Please check the base variables.

Attachment.cs

Magazine.cs

  • magazineCapacityAdded: Capacity to add to the default magazine. If this magazine supports less bulletst than the original, set a negative value.

Magazine.cs inherits from Attachment.cs. Please check the base variables.

Stock.cs

You can define custom variables and functions for Stocks if you need them.

Stock.cs inherits from Attachment.cs. Please check the base variables.

PlayerMultipliers

Updated in 1.3.6

PlayerMultipliers can be used to create custom Power-Ups.

  • damageMultiplier: Used by WeaponController to determine Damage Power-Up.

  • healMultiplier: Used by the PlayerStats to determine Heal Power-Up.

  • playerWeightMultiplier: Used by PlayerMovement to determine Weight Power-Up

HOW TO CREATE CUSTOM MULTIPLIERS / POWER-UPS.

First, we need to add a new variable in PlayerMultiplier.cs. We'll name it playerSpeedMultiplier. Keep in mind that creating custom multipliers or power-ups can be very specific, so this tutorial will not cover the exact steps or requirements for your case.

 [ReadOnly] public float playerSpeedMultiplier;

NOTE: You can use ReadOnly to display the value in the Inspector for easier debugging, while keeping it unmodifiable ( from the Inspector, keep in mind this variable is public and can be modified programmatically )

To define the default value for playerSpeedMultiplier, set it to 1, since it acts as a multiplier (i.e., currentSpeed * playerSpeedMultiplier = currentSpeed when playerSpeedMultiplier is 1).

For a variable like playerSpeedAddition, which represents an additive value, set its default to 0. This ensures that currentSpeed + playerSpeedAddition = currentSpeed when playerSpeedAddition is 0.

Now, let's determine the default value for this new variable.

 private void Awake()
 {
     damageMultiplier = 1;
     healMultiplier = 1;
     playerWeightMultiplier = 1;
     // Our new variable
     playerSpeedMultiplier = 1;
 }

Locate the section in your code where a multiplication operation is required for your Custom Power-Up to function. Use your custom multiplier by referencing the PlayerMultipliers script.

If you need assistance, feel free to reach out for support!


PlayerMultipliers.cs can be found inside the same script.

Barrel.cs

  • supressedFireSFX: SFX played instead of the original Fire SFX. You cannot leave this unassigned.

  • uniqueMuzzleFlashVFX: You can leave this unassigned to use the default muzzle flash VFX on your weapon scriptable object

Barrel.cs inherits from Attachment.cs. Please check the base variables.

PLAYER STATES

The FPS Engine utilizes two distinct state machines: one dedicated to player movement and the other managing the weapon system. Within this folder, you will find all the various player states implemented in the FPS Engine, alongside the corresponding state machine logic.

Interactable

Allows interaction between the Player ( Thanks to the InteractManager ) and this object.

Using Interactable.cs, there are different ways you can achieve custom interactions, simple and advanced.

  1. Attach the component to your interactable object:

  • For simple interactable objects assign the Interactable Component to an object with a box collider, you can subscribe to the OnInteract event to add your custom behaviour.

  • For advanced interactable objects:

    • Create a new C# script.

    • This new C# script must inherit from Interactable.cs

    • override the base Interact method from Interactable.cs

 public class CustomInteractable : Interactable
    {
        
        public override void Interact(Transform player)
        {
            // Custom code on interact
             base.Interact(player);
        }

    }
  1. Ensure the Interactable Layer is assigned to the same object that contains the Collider & Interactable Component ( or script that inherits from it )

For the Interactable.cs:

  • interactText

  • interactableEvents

  • instantInteraction: If true, Progress Required To Interact from InteractManager will be overrided and set to instant interaction only for this interactable.

Functions | Interactable.cs

player ( Transform ) | Protected ( only accessible from scripts that inherit from Interactable.cs )

Player that interacts with the Interactable.

Since 1.3, InteractManager passes the player directly to the Interactables.

Interact(Transform player) -> Virtual Method

Interact with the Interactable object.

  • player: Transform that interacts with this interactable

Highlight() -> Virtual Method

Triggers when an Interactable is highlighted.

  • player: Transform that interacts with this interactable

Unhighlight() -> Virtual Method

Triggers when an interactable is no longer highlighted.

  • player: Transform that interacts with this interactable

IsForbiddenInteraction is only available in >1.3.6

IsForbiddenInteraction(WeaponController weaponController) -> Virtual Method, Returns a Boolean

Returns whether the interaction is valid or not. Returns false by default, meaning that the interaction can be performed.

  • weaponController: You can use the WeaponController to access specific components or properties to determine if an interaction is valid, in case you need it.

Scope.cs

  • aimingPosition: Vector3 added to the position of th weapon when aiming with this scoped equipped.

  • aimingRotation: Rotation of the weapon when aiming with this scope equipped.

Scope.cs inherits from Attachment.cs. Please check the base variables.

InteractManager

Allows the interaction between interactable objects and the player. To set up custom Interactable objects or learning more about them, please check Interactable.cs

This component can be found on the Player object.

REFERENCES

  • mask: Bitmask that defines the interactable layer

  • weaponGenericPickeable: Attach the generic weapon pickeable object here

  • attachmentsGenericPickeable: Attach the generic attachment pickeable object here

INTERACTION

  • detectInteractionDistance: Distance from the player to detect interactable objects

  • progressRequiredToInteract: How much time player has to hold the interact button in order to successfully interact

  • interactInterval: Adjust the interaction interval, the lower, the faster you will be able to interact

  • Duplicate Weapon Adds Bullets: If true, when picking up a weapon that already exists in your inventory, you will add bullets instead of the weapon. ( Introduced in 1.3 )

  • canDrop: Enables and disables the Player´s ability to drop the weapons

    • droppingDistance: Distance from the player where the pickeable will be instantiated

  • canInspect: If true, the player will be able to inspect the current weapon.

    • realtimeAttachmentsCustomizationOnly: Allows the player to equip and unequip attachments while inspecting. It also displays a custom UI for that.

      • displayCurrentAttachmentsOnly: When inspecting, display current attachments only. Otherwise you will be able to see all compatible attachments through the UI.

EVENTS

  • events


InteractManagerEditor.cs

Renders the InteractManagerREFERENCES Custom Inspector

AttachmentIdentifier_SO.cs

The Attachment Identifier SO (Scriptable Object) functions similarly to a Weapon_SO. As a scriptable object, an attachment identifier defines a unique attachment, ensuring that no two different attachments share the same identifier.

To create a new unique AttachmentIdentifier_SO, right-click on the Project folder, then select Create → Cowsins → New Attachment Identifier.

Since each AttachmentIdentifier_SO defines a different Attachment, you will find the following variables:

  • attachmentName: Name of the attachment that will be displayed on pick up UI elements etc

  • attachmentIcon: Icon (Sprite) of the attachment

  • pickUpGraphics: Graphics to be displayed for the pickeable object...

Laser.cs

You can define custom variables and functions for Lasers if you need them.

Laser.cs inherits from Attachment.cs. Please check the base variables.

Item_SO

Introduced in 1.3.6. Required by the Inventory Pro + Save & Load Add-On

Scriptable Object that defines an Item. From Base FPS Engine, Weapon_SO & AttachmentIdentifier_SO both inherit from Item_SO.

  • _name: Your item name. Ex: Glock

  • icon: Custom image of your item

  • pickUpGraphics: Visuals that will appear on a dropped item.

  • applyWeight: Velocity will be decreased depending on the weight of the weapon if this is true.

    • weightMultiplier: Represents the weight of an entire stack of this item.


Item_SOEditor can be found within item_SO.cs

Weapon_SO
AttachmentIdentifier_SO.cs

Grip.cs

You can define custom variables and functions for Grips if you need them.

Grip.cs inherits from Attachment.cs. Please check the base variables.

BulletsPickeable

A generic Bullets Pickeable Prefab can be found under the following path: Assets/Cowsins/Prefabs/DragAndDropExtras/BulletPickeableGeneric

Drag and drop the prefab and assign the amount you want to pick up. You will then be able to interact with the pickeable and collect your bullets.

  • amountOfBullets: Amount of bullets to add.

  • bulletsIcon: Icon to display.

  • bulletsGraphics: Object that will be instantiated on the Pickeable and represents the bullets to pick up.

FAQ: WHY CAN´T I COLLECT THE BULLETS?

If you see a "Not Compatible" message on-screen, you won't be able to collect the bullets. This happens if you either don't have a weapon unholstered or your current weapon doesn't use Limited Magazines. Collecting bullets for a weapon with infinite bullets doesn't make sense. To enable bullet collection for your weapon, navigate to the desired Weapon_SO, set LimitedMagazines to true, and adjust the number of initial magazines.

4o

AttachmentPickeable

A generic Attachment Pickeable Prefab can be found under the following path: Assets/Cowsins/Prefabs/DragAndDropExtras/AttachmentPickeableGeneric

Drag and drop the prefab and assign the attachment identifier you want to pick up. You will then be able to interact with the pickeable and collect your new weapon.

  • attachmentIdentifier: AttachmentIdentifier_SO of the Attachment to pick up.

Pickeable

Pickeable.cs inherits from Interactable.cs. To set up custom Interactable objects or learning more about them, please check Interactable.cs

Pickeable.cs defines the basic structure for the rest of the main Pickeables:

  • WeaponPickeable

  • BulletsPickeable

  • AttachmentPickeable

  • events

  • rotates: Apply rotation to the Pickeable

    • rotationSpeed: Change the speed of the Rotation effect

  • translates: Apply vertical translation to the Pickeable

    • translationSpeed: Change the speed of the Translation effect

  • image: Image that displays the Pickeable icon

  • graphics: Parent transform where the graphics will be stored at

WeaponPickeable

A generic Weapon Pickeable Prefab can be found under the following path: Assets/Cowsins/Prefabs/DragAndDropExtras/WeaponPickeableGeneric

Drag and drop the prefab and assign the weapon you want to pick up. You will then be able to interact with the pickeable and collect your new weapon.

  • weapon: Weapon_SO for this specific weapon

EnemyHealth

Reworked in 1.3 Update

Oriented at enemies only.

Check some examples of EnemyHealth usage:

  • TrainingTarget

  • CircularTargetEnemy

Identity

  • _name: Name of the enemy. This will appear on the killfeed

Statistics

  • maxHealth: initial enemy health

  • maxShield: initial enemy shield

If DestroyOnDie is set to false, your object won’t be destroyed once you kill it.

  • destroyOnDie: When the object dies, decide if it should be destroyed or not.

    • deathEffect

UI

  • showUI: If true, it will display the UI with the shield and health sliders

    • healthSlider: Slider to display the health

    • shieldSlider: Slider to display the shield

Click on Create Default UI to generate and automatically assign Health & Sliders

  • showDamagePopUps: Enables and disables Damage Pop Ups, which appear on hitting enemies.

    • damagePopUp: Damage Pop Up object, stored at Cowsins/Prefabs/Others

    • xVariation: Horizontal randomness variation

Click on Assign Default Damage Pop Up to automatically add a reference to the default Damage Pop Up in FPS Engine ( Recommended to use )

  • showKillFeed: If true, it will display the KillFeed UI on eliminating an enemy

  • events

Functions and Accessors | EnemyHealth.cs

isDead ( bool ) / Protected ( only accessible from scripts that inherit from Interactable.cs )

Returns true if the enemy is dead

Player ( Transform )

Returns the player transform.

health ( float ) / ReadOnly

Returns the current health of the enemy.

shield ( float) / ReadOnly

Returns the current shield of the enemy.

Start() / virtual function

Update() / virtual function

Damage(float _damage, bool isHeadshot) / virtual function

Damage the enemy.

  • damage: Damage to apply on damageable´s health.

  • isHeadshot: Whether the shot landed on critical areas or not.

Die() / virtual function

IDamageable

IDamageable.cs is the core of the FPS Engine's damage system. Any damageable object, from the player to enemies and even destructible props, inherits from IDamageable.cs.

Please notice IDamageable is an interface. Learn more about interfaces in the official Unity documentation.

Damage(float damage, bool isHeadshot)

Damages the IDamageable.cs object.

  • damage: Damage to apply on damageable´s health.

  • isHeadshot: Whether the shot landed on critical areas or not.

Identifiable

Introduced in 1.3.6 and required by the Save & Load Add-On to function properly.

Identifiable assigns a unique ID to objects in a scene, allowing the Save & Load system to track them. Unlike Unity's default object IDs, these remain consistent across sessions.

Accessors | Identifiable.cs

UniqueIDValue ( string ) | Public Getter, Private Setter

Returns an unique identification string, assigned to that specific object.

CIrcularTargetEnemy

Example of EnemyHealth.cs implementation. You can find a training target prefab at Assets/Cowsins/Prefabs/Models/TrainingTarget.prefab

  • movementDirection: Direction of the movement. Whenever it reaches the end, it will go the opposite direction

  • directionDuration: Amount of time that the target will keep moving on the same direction

  • speed: Target velocity magnitude

  • timeToRevive

TrainingTarget

Example of EnemyHealth.cs implementation. You can find a training target prefab at Assets/Cowsins/Prefabs/Models/TrainingTarget.prefab

  • timeToRevive:

TurretProjectile

Turret Projectiles are only used by Turrets. Bullets or projectiles used by the Player are found in Bullet.cs

CamShake

Functions and Accessors | CamShake.cs

Trauma ( Float ) / Public

Controls the intensity of the shake.

instance ( CamShake )

Singleton Reference of CamShak

Shake(float amount, float _power, float _movementAmount, float _rotationAmount)

Shake the camera

  • amount: Camera Shake amount

  • power: power of the shake affecting speed.

  • movementamount: Determines the positional movement during the shake.

  • rotationAmount: Determines the rotational movement during the shake.

ShootShake(float amount)

Shake the camera for shots.

  • amount: Camera Shake amount

ExplosionShake(float distance)

Shake the camera for explosions.

  • distance: Distance from the explosion

ProceduralShot

This script is already located at the GunsEffects object ( child of Player )

Functions and Accessors | ProceduralShot.cs

instance ( ProceduralShot )

Singleton Reference of ProceduralShot

Shoot( ProceduralShot_SO shot )

Start a Procedural Shot motion given a ProceduralShot_SO ( Procedural Shot Pattern )

  • shot: ProceduralShot_SO file that contains the information for the procedural shot to be played accordingly.

CameraEffects

Tilt

  • tiltSpeed: Speed to reach the Maximum Camera Tilt ( tiltAmount )

  • tiltAmount: Maximum Camera Tilt

Head Bob

  • headBobAmplitude: Maximum Head Bob

  • headBobFrequency: Speed to reach the Maximum Head Bob ( headBobAmplitude)

Breathing

  • breathingAmplitude: Maximum Breathing Amount

  • breathingFrequency: Breathing Speed

  • applyBreathingRotation: Enables Rotation for the Breathing Effect

CrouchTilt

Crouch Tilt is a Weapon Effect that can be found within the Weapon Prefab. ( Found on CrouchTilt Transform )

  • tiltRot: Target CrouchTilt Rotation

  • tiltPosOffset: Target CrouchTilt Position Offset

  • tiltSpeed: Velocity to reach the Crouch Tilt Position & Rotation

WeaponEffects

New in FPS Engine 1.2

Merges the Weapon Effects in one place. It can be found attached to the Player.

WEAPON BOB

  • bobMethod: Defines the bobbing Pattern / Bobbing

  • gunsEffectsTransform: Guns Effects Transform

  • speed: Controls the overall speed of the bobbing effect. Higher values result in faster bobbing, while lower values produce slower bobbing.

  • distance: Defines the amplitude or magnitude of the bobbing effect.

  • aimingMultiplier: A multiplier applied to the bobbing effect when the player is aiming down sights. This typically reduces the bobbing to provide a steadier aim.

    • rotationMultiplier: Adjusts the amount of rotational bobbing applied to the gun. This affects how much the gun rotates during the bobbing motion.

    • translationSpeed: Specifies the speed at which the gun's position changes during the bobbing effect. It controls the rate of positional movement.

    • rotationSpeed: Specifies the speed at which the gun's rotation changes during the bobbing effect. It controls the rate of rotational movement.

    • movementLimit: Sets the maximum limit for the gun's movement during the bobbing effect. This constrains how far the gun can move from its original position.

    • bobLimit: Sets the maximum limit for the bobbing effect itself.

JUMP MOTION

  • jumpMotion: Animation Curve ( Start Jump Motion )

  • groundedMotion: Animation Curve ( Stop Jump Motion / Land )

  • distance: Amount of Jump Motion Effect

  • rotationAmount: Amount of Jump Motion Rotation

  • evaluationSpeed: How fast the Animation Curve is played

WEAPON SWAY SETTINGS

Weapon Sway can be modified in each Weapon Prefab ( Located at the root of the prefab )


WeaponEffectsEditor can be found at the end of WeaponEffects.cs

Turret

  • displayGizmos: Displays the Turret detection area in the Editor.

  • animator: Reference to the Turret Animator that contains the shoot animation.

  • turretHead: The part of the turret that rotates.

  • detectionRange: Distance within the player is detectable. If displayGizmos is true this will be visible in the Editor.

  • allowVerticalMovement: Allow the turret to aim vertically

  • lerpSpeed: Speed of rotation interpolation

  • wallLayer: Defines the wall layers so the Turret cannot shoot through them.

  • projectilePrefab: TurretProjectile to instantiate.

  • projectileSpeed: TurretProjectile forward velocity.

  • projectileDamage: TurretProjectile damage on hitting an IDamageable

  • projectileDuration: Time to destroy the projectile

  • firePoint: Transform where the Turret will shoot from.

  • muzzleFlash: VFX to display on shooting.

  • fireRate: Fire Speed.

JumpMotion

In FPS Engine 1.2, JumpMotion.cs is no longer assigned in the WeaponHolder object, but has been merged into the WeaponEffects.cs, found in the Player object.

  • player: PlayerMovement Reference

  • jumpMotion: Animation Curve ( Start Jump Motion )

  • groundedMotion: Animation Curve ( Stop Jump Motion / Land )

  • distance: Amount of Jump Motion Effect

  • rotationAmount: Amount of Jump Motion Rotation

  • evaluationSpeed: How fast the Animation Curve is played

WeaponSway

Adds movement realism to the Weapons ( similar to Weapon lag )

  • swayMethod: Different Sway Methods, Simple and Pivot Based

SIMPLE

  • amount: Sway Amount applied to the Weapon

  • maxAmount: Maximum Allowed Sway

  • tiltAmount: Tilt Amount applied to the Weapon ( Sideways sway )

  • maxTiltAmount: Tilt Amplitude

PIVOT BASED

  • pivot: Defines a Transform that acts as a pivot for the effect.

  • swaySpeed: The higher the value, the faster the effect will be.

  • swayMovementAmount: Sway Amount applied to the Weapon

  • swayRotationAmount: Rotational Sway Amount applied to the Weapon

  • swayTiltAmount: Tilt Amount applied to the Weapon ( Sideways sway )

  • aimingMultiplier: Modifies the amount of sway applied when aiming

Added in 1.3

SPRING

  • Spring Stiffness: Higher stiffness values make the Spring less flexible and more resistant to changes.

  • Spring Damping: Effect that reduces the amplitude of oscillations

Based on the Spring Settings, you can visualize directly through the Weapon Sway Inspector the curves of the Spring:

CowsinsButton

New in FPS Engine 1.2

CowsinsButton extends the base Unity Button class and can be used for MainMenus and UI, provides extended functionalities to switch scenes and sections.

  • clickSFX: Sound Effect to play on Clicking.

  • buttonType: Select the behaviour of the button.

    • SECTION TRANSITION: Allows you enable and disable gameObjects in the UI. You can add a CanvasGroup to these objects to seamlessly play a fade in effect

    • SCENE TRANSITION: Load new Scenes. Notice that your desired scene must be assigned in the Build Settings. More info.

    • OTHER: Default Button behaviour.

SECTION TRANSITION

  • sectionToEnable: GameObject to enable. You can add a CanvasGroup to this object to seamlessly play a fade in effect

  • sectionsToDisable: GameObjects to disable. No fade effect is played on these.

SCENE TRANSITION

  • sceneIndex: Index of the scene to load.

Please ensure the Scene Index corresponds to a valid scene in the build settings.

File -> Build Settings

More info.

ProceduralShot_SO

ProceduralShot_OS defines the characteristics of a procedural shot effect for the Weapons.

This ProceduralShot_SO is a Scriptable Object, and must be placed in the visuals tab of your Weapon_SO ( if eligible to use ProceduralShot_SO, if not, you can disable the feature ).

You can create a unique one for each weapon by right-clicking in your Project folder, going to Create → COWSINS → New Procedural Shot.

  • playSpeed: Animation Play Speed

TRANSLATION

  • xTranslation: Translation on the X axis. The movement follows this Animation Curves from 0 to 1

  • yTranslation: Translation on the Y axis. The movement follows this Animation Curves from 0 to 1

  • zTranslation: Translation on the Z axis. The movement follows this Animation Curves from 0 to 1

  • translationDistance: Effect Amount

  • aimingTranslationMultiplier: Effect Multiplier when Aiming

ROTATION

  • xRotation: Rotation on the X axis. The movement follows this Animation Curves from 0 to 1

  • yRotation: Rotation on the Y axis. The movement follows this Animation Curves from 0 to 1

  • zRotation: Rotation on the Z axis. The movement follows this Animation Curves from 0 to 1

  • rotationDistance: Effect Amount

  • aimingRotationMultiplier: Effect Multiplier when Aiming


ProceduralShot_SOEditor can be found at the end of ProceduralShot_SO.cs

UIController

The UI Controller is placed at the Root of the Player UI Prefab

The UI Controller includes several references that are already properly assigned, configured, and equipped with tooltips within the Unity Inspector. These references do not require modification. For clarity, only the customization settings will be displayed here, omitting the predefined references.

If you need help, feel free to contact Support.

HEALTH

BarHealthDisplay: Use Sliders to display player statistics.

NumericHealthDisplay: Use Numbers through text ( TextMeshPro ) to display player statistics.

ATTACHMENTS

usingAttachmentColor: Color of an attachment UI element when it is equipped.

notUsingAttachmentColor: Color of an attachment UI element when it is unequipped. This is the default color.

More information regarding Attachments.

EXPERIENCE

lerpXPSpeed: Speed at which the XP bar is filled when collecting XP points.

UI EVENTS

displayEvents: An object showing death events will be displayed on kill

Crosshair

FAQ: How can I modify the Crosshair?

To modify the crosshair, simply search "Crosshair" within your Player. this object has the Crosshair component attached.

To modify the Crosshair Shape, please refer to CrosshairShape

Crosshair is drawn through GUI, not UI

CROSSHAIR

HideCrosshairOnPaused: Determines whether the crosshair should be hidden when the game is paused.

HideCrosshairOnInspecting: Determines if the crosshair should be hidden when the player is inspecting their weapon.

Size: Defines the length of the crosshair.

Width: Defines the width of the crosshair lines.

Enemy Spotted Width: Defines the width of the crosshair lines when an enemy is spotted.

Defaul Spread: Defines the default spread of the crosshair, indicating the baseline accuracy.

Walk Spread: Adjusts the crosshair spread when the player is walking, reflecting decreased accuracy.

Run Spread: Adjusts the crosshair spread when the player is running, showing increased inaccuracy.

Crouch Spread: Adjusts the crosshair spread when the player is crouching, usually indicating improved accuracy.

Jump Spread: Adjusts the crosshair spread while the player is jumping, typically showing significant inaccuracy.

Default Color: Defines the color of the crosshair in its default state.

Enemy Spotted Color: Adjusts the crosshair color when an enemy is spotted

Resize Speed: Controls the speed at which the crosshair resizes, in response to changes in player movement or actions.

HITMARKER

Hitmarker: Enables or disables hitmarkers.

HitmarkerObj: The Hitmarker objet that controls the appearance and behavior of hitmarkers, which provide visual feedback when the player hits a target.

For more information, please refer to Hitmarker

RebindUI

Defines a Rebind UI Button. These objects work alongside the InputManager, since it contains all the rebinding related logic. Please check the MainMenu scene in Cowsins/Demo for more information

You can find a Checkpoint Prefab under Cowsins/Prefabs/Others/UI

  • inputActionReference: Reference to the Action to rebind. In selectedBinding you can modify the binding to customize.

  • excludeMouseFromBinding: If True, mouse will not be eligible to be assigned on rebind.

  • selectedBinding: Allows you to select which binding to rebind. You can display which binding you are currently customizing in the "Input Binding" read only dropdown, under "Path". As you can see, right now we are modifying space, which is part of the Keyboard.I

CrosshairShape

Defines the shape of the Crosshair, given different parameters.

How can I modify the Crosshair Shape for a specific weapon?

Navigate to the UI Tab in your Weapon_SO and assign a Crosshair Shape Preset there. You can either choose one of the provided or create your own one.

Useful links:

How to work with Presets.

How to make a Weapon.

If you want to modify the width, length, colors, spread, etc... Please refer to Crosshair.

PARTS

  • Top

  • Left

  • Right

  • Bottom

  • Center

You can enable and disable any of these parts.

UIEvents

Static Action Events to subscribe to for triggering various behaviors, typically focused on UI-related actions.

Compass

Allows to easily visualize the location of enemies, checkpoints, and more.

  • camera: Camera Transform Reference. Because the compass is part of the PlayerUI, we always have the Camera Reference available.

  • compassText: Text to display distance:

  • compassElementIcon: Prefab already stablished for the CompassElement.

Crate

Crate is a Destructible, which implements IDamageable

You can find a Crate Prefab uner Cowsins/Prefabs/DragAndDropExtras

  • maxHealth: Initial health of the destructible"

  • lootInside: Instantiate something cool when the object is destroyed, such as coins, a weapon, or any kind of loot, whatever you want! If this is empty, no reward will be instantiated

  • destroyedSFX: AudioClip to play on destruction.

  • destroyedObject: Object to get instantiated when the Crate is destroyed.

HealMultiplierPowerUp

Inherits from PowerUp. Check PowerUp to see the base variables.

You can find a HealMultiplierPowerUp Prefab uner Cowsins/Prefabs/DragAndDropExtras

  • healMultiplierAddition: percentage to multiply the base Heal. Being 0 = 0%, 1 = 100%

DamageMultiplier

Inherits from PowerUp. Check PowerUp to see the base variables.

You can find a DamageMultiplier Prefab uner Cowsins/Prefabs/DragAndDropExtras

  • damageMultiplierAddition: percentage to multiply the base damage. Being 0 = 0%, 1 = 100%

Checkpoint

Defines a universally visible waypoint for navigation

You can find a Checkpoint Prefab under Cowsins/Prefabs/DragAndDropExtras

  • text: Attach the text where you want the distance to be displayed

  • measureType: Select a measure unitzamong the following

    • metres

    • kilometres

    • inches

    • feet

    • yards

    • miles

  • decimals: number of decimals to display ( From 0 to 10 )

  • updatePeriod: How fast you want the text to display the new distance

Destructible

Implements from IDamageable, so it can be damaged and destroyed.

This component must be added to ANY destructible object in your environment. However, you might want to check other examples such as Crate.cs or ExplosiveBarrel.cs. Although they are different objects with different functionalities, both are destructible and can be destroyed. How does this work? Their custom scripts inherit from Destructible.cs, which in turn inherits from MonoBehaviour and implements IDamageable. So, even though they perform different actions, they are fundamentally the same type of object. Since Die() is a virtual void method, you can override it in your custom script that inherits from this one.

  • maxHealth: Initial health of the destructible"

  • lootInside: Instantiate something cool when the object is destroyed, such as coins, a weapon, or any kind of loot, whatever you want! If this is empty, no reward will be instantiated

  • destroyedSFX: AudioClip to play on destruction.

Functions & Accesors | Destructible.cs

Damage ( float damage, bool isHeadshot )

Damages the IDamageable

  • damage: Damage to apply on the IDamageable

  • isHeadshot: Generally false for Destructibles.

Die( )

Destroys the Destructible

Coin

You can find a Coin Prefab under Cowsins/Prefabs/DragAndDropExtras

  • minCoins: Minimum Coins to be collected on Trigger

  • maCoins: Maximum Coins to be collected on Trigger

  • collectCoinSFX: AudioCLip to play on collecting

The player can collect a Coin and use it to purchase items, etc... Check to discover how to add coins into your game.

CoinManager

Experience

The player can collect XP and use it to purchase items, etc... Check ExperienceManager to discover how to add XP into your game.

You can find an Experience Prefab uner Cowsins/Prefabs/DragAndDropExtras

  • minXp: Minimum XP to add to the player on collect.

  • maxXp: Maximum XP to add to the player on collect.

  • pickUpSFX: AudioClip to play on collect.

  • onCollect: Event that triggers on collect.

  • graphics: Graphics object reference

  • rotates: Apply rotation to the Pickeable

    • rotationSpeed: Change the speed of the Rotation effect

  • translates: Apply vertical translation to the Pickeable

    • translationSpeed: Change the speed of the Translation effect

  • image: Image that displays the Pickeable icon

  • graphics: Parent transform where the graphics will be stored at

DoorInteractable

Inherits from Interactable, since you can interact with the door.

You can find a Door Prefab uner Cowsins/Prefabs/DragAndDropExtras

  • openInteractionText: Text to display for interaction if the door is closed. ( Generally "Open" )

  • closeInteractionText: Text to display for interaction if the door is opened. ( Generally "Close" )

  • lockedInteractionText: Text to display for interaction if the door is Locked. ( Generally "Locked" )

  • isLocked: Whether the door should be locked.

  • doorPivot: The pivot point for the door

  • offsetPosition: "The Vector3 to add to the door on opened ( Introduced in 1.3 )

  • openedDoorRotation: How much you want to rotate the door in degrees

  • speed: rotation speed

  • openDoorSFX

  • closeDoorSFX

  • lockedDoorSFX

Functions & Accesors | DoorInteractable.cs

Lock( )

Locks the door so it cannot be opened

UnLock( )

Unlocks the door so it can be opened

ToggleLock( )

If Locked, unlocks it.

If Unlocked, locks it.

Lootbox

Container that holds randomized rewards, such as weapons, power-ups, coins and more. Inherits from Interactable and can be Free or Paid. Check CoinManager for more info.

You can find a Lootbox Prefab uner Cowsins/Prefabs/DragAndDropExtras

  • loot: Array that contains all the possible loot to be instantiated. On interact, a random item will be selected.

  • price: Price to unlock the Lootbox. Set to 0 for it to be Free.

  • delayToReceiveLoot: Specifies the time interval between opening the lootbox and receiving the loot.

  • spawnDistance: Distance to spawn the loot from the Lootbox Position

  • directionDependsOnPlayerPosition: If true, the loot will be instantiated in fron of the player always. Recommended to be true.

PowerUp

Allows to create PowerUps. Check the current available ones:

  • DamageMultiplier

  • HealMultiplier

  • Healthpack

You can make a new script that inherits from PowerUp to create your own Power Ups.

  • reappears: Enables or disables reappearance after being used.

    • reappearTime: Time to re-enable the power up.

    • Timer: Image that displays the time remaining to re-appear.

Healthpack

Inherits from PowerUp. Check PowerUp to see the base variables.

You can find a Healthpack Prefab uner Cowsins/Prefabs/DragAndDropExtras

  • healAmount: Amount to heal.

HurtTrigger

Hurts the player on Trigger.

You can find an Experience Prefab uner Cowsins/Prefabs/DragAndDropExtras

  • damage: Damage to deal to the player.

Hitmarker

A Hitmarker provides the player with visual and auditory feedback when a hit is successfully landed.

Hitmarkers are handled through UI

hitmarkerSoundEffect: SFX to play on playing the hitmarker. FPS Engine provides them already.

animator: Allows to play an animation for enhanced feedback.

image: Assign the Hitmarker Image. Headshots will display a Red Hitmarker.

GetGameInformation

Displays valuable game information. It can be found within the PlayerUI

  • showFPS: A boolean variable indicating whether the Frames Per Second (FPS) counter is displayed on the screen.

  • fpsRefreshRate: Defines the frequency at which the FPS counter is updated

  • FPS Object: TextMeshPro Text that displays all the FPS

  • showMinimumFrameRate: Defines whether the minimum recorded frame rate should be displayed.

  • showMaximumFramerate: Defines whether the maximum recorded frame rate should be displayed.

  • appropriateValueColor: Defines the color used to display FPS values that are considered acceptable or optimal. Typically, this color is green, indicating good performance.

  • intermediateValueColor: : Defines the color used to display FPS values that are considered average or moderate. This color is usually yellow or orange, indicating medium fair performance.

  • BadValueColor: Defines the color used to display FPS values that are considered poor or suboptimal. This color is typically red, indicating bad performance.

DestroyMe

Destroys the GameObject after an amount of time.

  • timeToDestroy: Time To Destroy this GameObject

DraggableButtonInSceneView

Introduced in 1.3

Creates a Button that can be dragged. On clicked, it opens a menu with different options that will help you do more in less time with FPS Engine

How to disable

Disabling DraggableButtonInSceneView is very simple,

  1. Go to the top toolbar and Click on Cowsins/FPS Engine Start Up

  2. Click on "Show Draggable Button in Scene View" to turn it off.

How to add Custom Buttons to the Draggable Menu?

In ExternalButtonRegister.cs you can find all the template code you need.

Take a look at the following code:

#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;

namespace cowsins
{
    [InitializeOnLoad]
    public static class ExternalButtonRegister
    {
        static ExternalButtonRegister()
        {
            DraggableButtonInSceneView.OnAddExternalButtons += AddCustomButtons;
        }

        private static void AddCustomButtons(Rect menuRect)
        {
            float itemWidth = menuRect.width / 3;
            float itemHeight = menuRect.height;

            /// OVERRIDE BUTTON COUNT ( NECESSARY ) 
            DraggableButtonInSceneView.buttonCount = 5;

            /// ADD 5TH BUTTON
            Texture2D customButtonImage = AssetDatabase.LoadAssetAtPath<Texture2D>("Assets/CustomButton.png");
            // Add custom button
            if (GUI.Button(new Rect(DraggableButtonInSceneView.GetButtonPosition(menuRect, 4), menuRect.y, itemWidth, itemHeight), customButtonImage))
            {
                Debug.Log("Custom Button Clicked");
            }
        }
    }
}
#endif

/// OVERRIDE BUTTON COUNT ( NECESSARY ) 
DraggableButtonInSceneView.buttonCount = 5;

As you can see, the button Count is set to 5. The original button count for the Draggable Menu is 4, since there are 4 buttons. As we are adding a new button, we must update the button count to 5.

 /// ADD 5TH BUTTON
 Texture2D customButtonImage = AssetDatabase.LoadAssetAtPath<Texture2D>("Assets/CustomButton.png");
 // Add custom button
 if (GUI.Button(new Rect(DraggableButtonInSceneView.GetButtonPosition(menuRect, 5), menuRect.y, itemWidth, itemHeight), customButtonImage))
 {
    Debug.Log("Custom Button Clicked");
 }

This is the code necessary to add a new Button.

First we gather the Texture or Image we want to display on the button. Change "Assets/CustomButton.png" with your own path.

Inside the creation of the Rect, make sure 5 corresponds to the current button index being added, in this case, it is correct, as we are making a 5th button. GetButtonPosition(menuRect, 5) Inside the if statement, you can add all the code you need to perform on clicking the button. Right now, it only displays a message.

 Debug.Log("Custom Button Clicked");

PauseMenu

Handles the Paused Game state. By default, you can pause and unpause the game by pressing Escape key ( Esc ) or Start on Controllers.

It can be found within the Player UI.

  • PlayerUI: Reference to the entire Player UI object.

  • DisablePlayerUIWhenPaused: Enables or disables the Player UI when the Game is paused. Recommended to be true

  • Menu: CanvasGroup that represents the Pause Menu

  • FadeSpeed: Speed at which the fade effect is played for both fading in and fading out.

Functions & Accesors | PauseMenu.cs

Instance ( PauseMenu ) / Public Static Singleton

PauseMenu Singleton

isPaused ( bool ) / Public Getter, Private Setter, Static

Returns whether the game is paused or not

UnPause( )

Resumes the game

TogglePause( )

if Paused, unpauses the game.

If Not Paused, Pauses the game.

QuitGame( )

Exits to desktop

JumpPad

When the Player steps on the JumpPad, they will be propelled according to the specified parameters and settings.

You can find a JumpPad Prefab uner Cowsins/Prefabs/DragAndDropExtras

  • forceModeType: Specifies the Jump Method.

    • PlayerOrientation: player will be launched based on the forward orientation of the camera.

    • PlayerMovementDirection: player will be launched based on the movement direction.

    • JumpPadLocalAxis: player will be launched based on the forward orientation of the jump pad.

  • verticalForceMagnitude: Defines the strength of the force applied in the vertical direction when the Player steps on the JumpPad. This value determines how high the Player is propelled upward.

  • horizontalForceMagnitude: Defines the strength of the force applied in the horizontal direction when the Player steps on the JumpPad. This value determines how far the Player is propelled horizontally.

  • jumpSound: Represents the sound effect played when the Player steps on the JumpPad.

PointCapture

Allows the Player to Capture a Point and perform custom events.

You can find a PointCapture Prefab uner Cowsins/Prefabs/DragAndDropExtras

  • captureSpeed: how fast the point will be captured

  • loseProgressIfNotCapturing: If true, progress will gradually be lost when player leaves the point

  • losingProgressCaptureSpeed: Speed of progress loss

  • events

Functions & Accesors | PointCapture.cs

OnCapture( )

This is called whenever you capture the point

Since it is a public virtual void, you can override this method on a new script that inherits from PointCapture. However, do not forget to use base.OnCapture(); if you still want to perform the base actions on that new script, which is recommended.

IgnoreCollision

Attach this component to any GameObject with a Collider to avoid Collisions with the Player

Trigger

Trigger allows you to detect Trigger Collisions of an object with the Player, and perform behaviours in response.

Attach this component on a GameObject and ensure to assign a Collider and enable isTrigger.

You can subscribe any behaviour you want to each of the provided events from the Inspector:

  • events:

    • onEnter

    • onStay

    • onExit

CompassElement

Defines a Compass Element that appears on the Compass. Check TrainingTarget Prefab, for instance.

  • icon: Icon to display on the compass.

  • addOnStart: Adds the compass element to the compass on start

Functions & Accesors | CompassElement.cs

Add ()

Adds this Compass Element to the Compass

Remove ()

Removes this Compass Element from the Compass

Logo

ExplosiveBarrel

ExplosiveBarreli s a Destructible, which implements IDamageable

You can find a ExplosiveBarrel Prefab uner Cowsins/Prefabs/DragAndDropExtras

  • explosionRadius: Defines the radius of the explosion, indicating how far the impact of the explosion reaches from its center. Measured in units

  • explosionForce: Specifies the force exerted by the explosion, affecting objects within the explosion radius.

  • hurtPlayer: A boolean variable indicating whether the player character is affected by the explosion.

  • damage: Represents the amount of damage inflicted by the explosion on IDamageables

  • destroyedSFX: AudioClip to play on destruction.

  • destroyedObject: Object to get instantiated when the Crate is destroyed.