FPS ENGINE DOCUMENTATION
  • Welcome to FPS Engine!
  • BEFORE WE START
    • Early Considerations
    • List of Tutorials
    • List of Add-Ons & Compatible Packages
  • GETTING STARTED
    • 01. Basic set-up
    • 02. Roadmap
  • CONTENT
    • 03. Content
      • 03.1 CAMERA
        • MoveCamera
        • CameraFOVManager
      • 03.2 MOVEMENT
        • PlayerMovement
      • 03.3 PLAYER
        • PlayerStats
        • PlayerMultipliers
        • PLAYER STATES
          • PlayerStates
          • PlayerBaseState
          • PlayerStateFactory
        • WEAPON STATES
          • WeaponStates
          • WeaponBaseState
          • WeaponStateFactory
        • Player Debugging
      • 03.4 WEAPONS
        • Weapon_SO
        • WeaponIdentification
        • WeaponController
        • Bullet
        • ATTACHMENTS
          • Attachment.cs
            • Barrel.cs
            • Flashlight.cs
            • Magazine.cs
            • Scope.cs
            • Stock.cs
            • Laser.cs
            • Grip.cs
          • AttachmentIdentifier_SO.cs
      • 03.5 PICK UP SYSTEM
        • InteractManager
        • Interactable
        • Item_SO
        • Identifiable
        • Pickeable
          • WeaponPickeable
          • BulletsPickeable
          • AttachmentPickeable
      • 03.6 ENEMIES
        • IDamageable
        • EnemyHealth
        • TrainingTarget
        • CIrcularTargetEnemy
        • Turret
        • TurretProjectile
      • 03.7 EFFECTS
        • CameraEffects
        • CamShake
        • CrouchTilt
        • JumpMotion
        • ProceduralShot
        • ProceduralShot_SO
        • WeaponEffects
        • WeaponSway
      • 03.8 UI
        • CowsinsButton
        • Crosshair
        • CrosshairShape
        • Hitmarker
        • UIController
        • UIEvents
        • RebindUI
      • 03.8 EXTRA
        • Checkpoint
        • Coin
        • Compass
        • CompassElement
        • Destructible
        • Crate
        • ExplosiveBarrel
        • PowerUp
        • DamageMultiplier
        • HealMultiplierPowerUp
        • Healthpack
        • DoorInteractable
        • Experience
        • GetGameInformation
        • HurtTrigger
        • JumpPad
        • Lootbox
        • PauseMenu
        • PointCapture
        • Trigger
        • DraggableButtonInSceneView
        • UTILITIES
          • DestroyMe
          • IgnoreCollision
          • LookAt
          • CowsinsUtilities
      • 03.09 MANAGERS
        • CoinManager
        • ExperienceManager
        • GameSettingsManager
        • InputManager
        • SoundManager
        • PoolManager
  • HOW TO USE
    • Getting Started: First Steps
    • Importing FPS Engine into URP / HDRP
    • Add a Player Controller
    • Adding New Weapons
    • Saving & Loading Presets
    • Changing Keybindings
    • Creating New Pickeables
    • Controllable & Not Controllable Player
    • Adding New Surfaces ( Grounds )
    • Working with Attachments
    • Modify Weapon and Camera Effects
    • Adding Custom Key Rebinds
    • Add breakable (Destructible) objects
    • Custom Shot Weapons
    • Adding Enemies
  • FAQ
    • FAQ
  • SUPPORT
    • Support
Powered by GitBook
On this page
Export as PDF
  1. CONTENT
  2. 03. Content
  3. 03.5 PICK UP SYSTEM

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

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.

PreviousInteractManagerNextItem_SO

Last updated 2 months ago

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

InteractManager