Unity Cookbook
  • 2D
    • New Input System - 2D Move
    • Pixel Sprite Setup
    • Animations
    • Animator in Script
    • Tilemap
    • 2D Camera Follow Player
  • UI OnlyFans
    • 9-Splice Sprite
    • Interactible Game Objects
      • NPCs
      • Items
      • Interactible Marker
    • Dialogue System
      • Conversa Plugin
      • DiaManager.cs
      • DiaTrigger.cs
      • DiaManager.cs Alternate
      • Choices in Dialogue
    • New Input System - Interact
    • Designing the General Menu
    • New Input System - Open Menu
      • UI Buttons
      • GeneralMenu.cs
    • Controls Explanation UI
    • Items Menu
Powered by GitBook
On this page
  1. UI OnlyFans

Interactible Game Objects

This could be an NPC or an item.

Previous9-Splice SpriteNextNPCs

Last updated 1 year ago

We need to make sure only things that are interactive are going to be triggers. We wouldn't want rock conversation when it should be the thing next to it. We'll eventually use the Physics2D system to create a Raycast object to hit this NPC and then start the conversation.

private Conversation conversation;

Setup

Drag and drop a sprite from the project folder into the scene window. It'll create the GameObject already.

We're going to edit the Unity Layers.

Add three layers: Ground, Interactibles, Player

  • Assign the Interactible GameObject to the Interactibles Layer.

  • Assign the Tilemaps/ground to the Ground layer.

  • Player GameObject to Player layer.

Then, add a Collider2D. When the Player sends out a Raycast (Like an invisible ray, like "Shoot me a message"), it needs to hit something.