This page lists a few 'recipes' that will teach you in a few steps how to do common tasks.

Introduction

Want to get started quickly with the TopDown Engine? This page contains simple steps you can follow for a number of basic situations, no explanations, just quick steps. Don’t hesitate to check the rest of the documentation to learn more about how the engine works! Note that most of these will provide TDE / Unity versions, that’s just to provide the context they were first written in. But it’s safe to assume that they should work on any higher versions of both Unity and TDE.

Creating a basic 2D playable character

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open Minimal2D demo scene
  3. create a new, empty game object, position it at 40,-20,0, call it Test
  4. create a new sprite object, set its Sprite to Adventurer_0, sorting layer to Characters, nest it under Test, at 0,0,0
  5. on Test, add a Character component
  6. press AutoBuild Player Character 2D
  7. drag the NewSprite into the CharacterModel slot
  8. under CharacterOrientation2D, set facing mode to MovementDirection, check Model Should Flip
  9. open the Koala prefab, copy the footsteps node
  10. paste in your scene
  11. nest it under Test, at 0,0,0
  12. press play

Creating a basic 2.5D playable character

If you want to create a character that evolves in a 3D world, but appears as a sprite (think Paper Mario), you can do it like so :

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open MinimalScene3D demo scene
  3. create a new, empty game object, position it at 0,0,0, call it Test
  4. create an empty child, name it Model
  5. create a new sprite renderer, set its sprite to Koala_Idle_0, drag it under Model, position it at 0,0,0, name it MySprite
  6. on Test, add a Character comp
  7. press AutoBuild Player Character 3D
  8. on Test’s Character component, drag the Model node into the CharacterModel slot
  9. on Test, remove the CharacterOrientation3D component, add a CharacterOrientation2D, set FacingMode:MovementDirection, ModelShouldFlip:true
  10. on MySprite, add a MMBillboard component, NestObject:false, OffsetDirection:0,0,1
  11. drag the Test object in your Project panel to make it a prefab, remove it from the scene
  12. select the LevelManager, drag that new prefab into the first array entry of PlayerPrefabs
  13. press play, enjoy your new 2.5D friend

Creating a basic 3D playable character

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. create a new, empty game object, position it at 0,0,0, call it Test
  3. create a new cube, drag it under Test, position it at 0,0,0, name it Model, remove its BoxCollider
  4. on Test, add a Character component
  5. press the AutoBuild Player Character 3D button at the bottom of its inspector
  6. on the CharacterController component, set Height to 1
  7. on the TopDownController3D component, set UpdateMode to Update
  8. on the Character component, drag the Model into the CharacterModel slot
  9. under CharacterOrientation3D, set Rotation Mode to MovementDirection, drag the Model into the Movement Rotating Model slot
  10. drag that Test object in your Project panel to make it a prefab, remove it from the scene
  11. select the LevelManager, drag that new prefab into the first array entry of PlayerPrefabs
  12. press play, enjoy your new friend

Extra steps : adding an Animator

  1. on the Model object inside your character, add an Animator component
  2. in your Project panel, create a new AnimatorController, name it TestAnimatorController, drag it into the Animator’s Controller slot
  3. on the same object, add a CharacterAnimationParametersInitializer component, press its AddAnimationParameters button (the component disappears, that’s normal)
  4. at the top level of your character, drag the Model into the Character component’s CharacterAnimator slot
  5. save your prefab, press Play
  6. in the Hierarchy panel, select the Model object, double click on its Controller in its Animator component, this will open the Animator panel, there you can see that its various animation parameters update. You can use all of these to setup your transitions between animations.

Creating a basic 3D enemy

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open Loft3D demo scene
  3. create an empty game object, set it at -9.5,1.5,0
  4. create a cube, set its scale to 2,2,2, set it under the empty
  5. rename the empty to “Test”
  6. on Test, add a Character component
  7. press the Autobuild AI Character 3D button
  8. in the Character inspector, set the CharacterModel to the Cube
  9. press play, grab the shotgun next to you, enjoy

Creating a simple melee weapon

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open the MinimalScene3D demo scene
  3. create a new empty game object, name it MyWeapon
  4. add a MeleeWeapon component to it, TargetLayerMask:Enemies, DamageAreaShape:Box, AreaOffset:0,0,0, AreaSize:1,1,1, Min and MaxDamageCaused:100, WeaponAttachmentOffset:-0.5,0,0, Knockback:AddForce:0,0,10
  5. add a WeaponAim3D component to it, set AimControl:PrimaryMovement
  6. drag MyWeapon into the project panel somewhere, to make it a prefab
  7. select the MinimalCharacter prefab, set MyWeapon as its InitialWeapon
  8. drop a few Loft3DBlueCube prefabs instances in the scene to act as practice dummys
  9. press play, get in front of a cube (and next to it), press E, enjoy your melee weapon. Note that you can see your weapon’s damage area’s gizmos in scene view

Creating a simple projectile weapon

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open the MinimalScene3D demo scene
  3. create a new empty game object, name it MyWeapon
  4. add a ProjectileWeapon component to it
  5. add a WeaponAim3D component to it, set AimControl:PrimaryMovement
  6. add a MMSimpleObjectPooler component, MutualizeWaitingPools:true, GameObjectToPool:LoftAssaultRifleBullet
  7. create a new cube, remove its BoxCollider, nest it under MyWeapon at 0,0,0, name it MyWeaponModel
  8. drag MyWeapon into the project panel somewhere, to make it a prefab
  9. select the MinimalCharacter prefab, set MyWeapon as its InitialWeapon
  10. press play, enjoy your cube gun!

Setting up checkpoints

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open Loft3D demo scene, add a Cube at 0,0,45, name it MyCheckpoint, on its BoxCollider, set IsTrigger:true
  3. add a Checkpoint component to it, CheckPointOrder:1 (the initial spawn point uses 0)
  4. edit the DeathSplash / ButtonRestart to have it call RestartLevel instead of ReloadLevel (that particular demo is set to reload the entire scene by default, KoalaDungeon on the other hand isn’t)
  5. press play, enter the level, walk to the Cube and touch it, then get yourself killed
  6. when the death splash appears, press the RestartLevel button, you respawn at the new checkpoint’s position

Creating an IK powered weapon

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open the Loft3D demo scene
  3. create a new empty game object in that scene, name it CubeGun
  4. create a new cube, nest it under the CubeGun node, reset its transform
  5. set the scale of the cube to 0.2,0.5,1.5
  6. on the CubeGun, add a ProjectileWeapon component
  7. unfold its Projectiles section, set the spawn offset to 0,0,1
  8. on the CubeGun, add a MMSimpleObjectPooler, drag the AssaultRifleBullet prefab from the Project view to its GameObjectToPool slot
  9. on the CubeGun, add a WeaponAim3D component, set its AimControl to SecondaryThenPrimaryMovement, and its weapon rotation speed to 0
  10. drag the CubeGun into your Project panel to make it a prefab.
  11. select the LoftSuit prefab, and in its CharacterHandleWeapon component, drag the CubeGun in its InitialWeapon slot
  12. press play
  13. you can now move around and shoot with your cube weapon, which is correctly positioned

From there, if you want to setup IK, you’d need to do the following :

  1. make sure IK is correctly setup on your character (see the IK section of the documentation), on the LoftSuit character that’s already the case
  2. open the CubeGun prefab
  3. create a new empty game object, nest it under CubeGun, name it Left, position it at -0.15,0,-0.1
  4. create a new empty game object, nest it under CubeGun, name it Right, position it at 0.1,-0.1,-0.65
  5. on the CubeGun’s ProjectileWeapon, under the IK section, drag Left into the LeftHandHandle slot, and Right into the RightHandHandle slot
  6. save your prefab, press play
  7. your character’s hands are now correctly positioned

Creating a simple projectile weapon and its projectiles

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open the Loft3D demo scene
  3. create a new empty at 0,0,0, name it MyProjectile (layer Projectile), add a Projectile component to it (LifeTime:1, BoundsBasedOn:Collider, Speed:300), add a Health component, add a DamageOnTouch (TargetLayerMask:Obstacles, DamageTakenEveryTime:50), add a BoxCollider (isTrigger:true, size 0.1,0.1,1), add a Rigidbody (isKinematic:true)
  4. add a Cube under it, remove its BoxCollider, set its scale to 0.1,0.1,1, make MyProjectile a prefab
  5. create a new empty game object, name it MyWeapon
  6. add a ProjectileWeapon component to it, TimeBetweenUses:0.1
  7. add a WeaponAim3D component to it, set AimControl:PrimaryMovement
  8. add a MMSimpleObjectPooler component, MutualizeWaitingPools:true, GameObjectToPool:MyProjectile, make it a prefab
  9. select the LoftSuit prefab, set MyWeapon as its InitialWeapon
  10. press play, enjoy your long cube gun!

Creating a door that requires a key to open

In this example we’ll create a “door” (technically a cube that disappears), and we’ll associate it to an interactive zone that will require a key to open.

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open Loft3D demo scene

Creating the door

  1. create a new Cube, name it “Door”, position it at -15,0.5,0, set its scale to 1,5,1
  2. create a new Cube, name it “DoorZone”, set its BoxCollider to trigger, position it at -14,0,0
  3. add a KeyOperatedZone to the DoorZone object, add an event to OnActivation, drag the Door into its slot, and select GameObject > SetActive (here we’re just making the door disappear, but if you had a door with an actual Open() method, that’s where you’d bind it too)
  4. at the bottom of its inspector, set RequiresKey to true, and in the KeyID field put “MyKey”

Creating the key

  1. in your project, create a folder, name it Resources
  2. in it, right click, Create > More Mountains > Top Down Engine > Inventory Engine Key, name it MyKey
  3. set its ItemID to MyKey, description to “a key”, icon to Koala_Items_MetalKey, TargetInventoryName to SuitMainInventory
  4. in the Loft3D scene, create a new sphere, name it “MyKeyPicker”, set its collider to IsTrigger, position it at -9,1,0
  5. add a ItemPicker component to it, drag the MyKey asset we’ve created into its Item slot, add a PickableItem, check DisableObjectWhenDepleted

Testing

  1. press play, DO NOT grab the sphere/key, and walk on top of the small cube next to our “door” (our DoorZone object), press space, nothing happens, as we don’t have the required key
  2. move right, walk on top of the sphere/key to grab it, press I to open your inventory, notice it’s now in there
  3. walk on top of the small cube next to the “door”, press space, notice the Door disappears as expected

Getting the new input system to work

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. import InputSystem 1.0.1 via the package manager
  3. open the MinimalScene3D_InputSystem_Multiplayer demo scene
  4. Unity usually loses some references to the new input system assets, so you may have to bind them again. That’s done like in any project, inside the TopDownEngineInputActions make sure that the Keyboard and Gamepad schemes have the right bindings (Keyboard should be Keyboard and Mouse, gamepad should be gamepad).
  5. on the InputSystemManager_Player1 (and 2), bind events if references were lost
  6. press play

Switching from the old to the new input system in an existing demo scene

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. from the package manager, import the InputSystem package
  3. open MinimalScene2D
  4. on its KoalaUICamera, remove the InputManager component
  5. on a new empty, add an InputSystemManager
  6. in the hierarchy, select the EventSystem object, in its inspector, click its “Replace with InputSystemUIInputModule” button
  7. press play in your editor, your scene is now using the new input system!

Setting up two characters with separate input

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open the MinimalScene3D demo scene
  3. select the LevelManager, set its PlayerPrefabs array size to 2
  4. select the Suspenders prefab, set its PlayerID to Player2, drag it in the LevelManager in slot 2 (element 1)
  5. select the UICamera, copy the InputManager comp, paste it as new
  6. in the newly pasted InputManager, change the PlayerID to Player2
  7. press play, you can now control the minimal char with wasd, the suspenders with arrows

Creating a weapon with ammo

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open the KoalaDungeon demo scene
  3. create a new empty object, name it TestWeapon
  4. add a ProjectileWeapon component to it, under Magazine, check MagazineBased, set MagazineSize to 10, under Settings check InitializeOnStart
  5. add a MMSimpleObjectPooler component to it, drag a KoalaRifleBullet in its GameObjectToPool slot (for these steps I didn’t create new ammo, it’ll be using the rifle ammo)
  6. add a WeaponAmmo component to it, set AmmoID to KoalaRifleAmmo, AmmoInventoryName to KoalaMainInventory, Max Ammo to 100, and make sure ShouldLoadOnStart is checked
  7. drag the TestWeapon object into your project to make a prefab out of it, remove it from the scene
  8. in a Resources folder, right click > MoreMountains > TopDownEngine > InventoryWeapon to create a weapon asset
  9. name it TestWeapon, set its ItemID and ItemName to TestWeapon, set its TargetInventoryName to KoalaMainInventory, check its Equippable checkbox, set its TargetEquipmentInventoryName to KoalaWeaponInventory, in its EquippableWeapon slot, drag the TestWeapon prefab, set its ItemClass to Weapon
  10. in the scene, select the KoalaRiflePicker, and in its ItemPicker comp, drag the TestWeapon asset
  11. press play, move over the rifle and ammo picker to grab them
  12. press T, this will equip the weapon (it won’t look like much, we didn’t setup its visuals or anything), press E to shoot, do it 10 times to empty the clip, press R to reload, do it again, weapons empty and refill as expected

Creating a prefilled inventory

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open the Suspenders prefab
  3. in its CharacterInventory, set AutoPick items to 3 : handgun ammo 10, assault rifle 1, assault rifle ammo 10
  4. in AutoEquipWeaponOnStart, drag the Handgun
  5. open the Loft3D demo scene, press play, you now spawn with a handgun in hand, press T, you now have an assault rifle, press T again, now it’s a handgun, repeat as much as you want

Setting up projectiles for damageables and non damageables

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open the MinimalScene3D demo scene
  3. select the MinimalCharacter prefab, in its CharacterHandleWeapon component, drag the AssaultRifle prefab
  4. in the scene, select the Border node (under Level/Models/), set its y value to 0.5
  5. select the AssaultRifleBullet prefab, open it
  6. in it you’ll find two ready made feedbacks, in the HitDamageable one, add a DebugLog feedback, set its debug message to “hit damageable”
  7. in the HitNonDamageable one, add a debug log feedback, set its debug message to “hit non damageable”
  8. save the prefab, go back to the scene
  9. create a new cube, set its position to 3.5,1,-8, add a Health component to it, change its layer to Enemies
  10. press play, shoot at the cube, then shoot at the walls, you should see something like this in your console

Setting up a weapon model enabler

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open the Koala prefab, create an empty child, name it TestWeaponModel, add a SpriteRenderer, set the sprite to HornyBlue_0, sorting layer Characters, order in layer 1, move it to 0,2,0
  3. add an animator to it, set the controller to HornsBlueAnimator
  4. add a MMAnimatorMirror component (that will replicate the state of animation parameters from animator A to animator B). Set its SourceAnimator as the KoalaModel node’s animator, and TargetAnimator as the animator component just above it
  5. disable the TestWeaponModel node
  6. on the Koala node, add a WeaponModelEnabler, set Bindings’ size to 1, drag the TestWeaponModel into the slot, WeaponAnimationID to 10 (arbitrary unique ID)
  7. select the KoalaRifleAmmoBased prefab, unfold its AnimationParametersName panel, set the WeaponAnimationID to 10
  8. in the same panel, set the StartAnimationParameter to SwordAttack (the parameter that triggers an attack on the Horns animator)
  9. open the KoalaModel’s KoalaAnimatorController animator controller, add a SwordAttack bool parameter to it
  10. open the KoalaDungeon demo scene, press play, grab the assault rifle above the spawn point, the weapon model (the blue dude) appears
  11. shoot, the blue dude will attack

That’s just one of the ways to do it, you could also have a single animator (in this case the Koala one) in which you’d have animations for the weapon/blue dude, which would always play but only be visible if the weapon model enabler is activating the model.

Setting up damage on touch

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open MinimalScene3D
  3. create a new cube, position it at -5,0-,5
  4. set its box collider to trigger
  5. add a DamageOnTouch component to it, set its TargetLayerMask to Player, set its DamageCausedKnockbackForce to 20,20,0
  6. press play, walk towards the cube, you’ll get knockback when colliding with it

Creating an enemy that follows and attacks the Player

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open the MinimalScene3D demo scene
  3. create a new, empty game object, position it at 3,0,3, call it Test
  4. create a new cube, drag it under Test, position it at 0,0,0, name it Model, remove its BoxCollider
  5. under the cube, add a new empty at 0,0,1, name it WeaponAttachment
  6. on Test, add a Character component, press AutoBuild AI Character 3D
  7. on the Character component, drag the Model into the CharacterModel slot
  8. under CharacterOrientation3D, set Rotation Mode to Weapon Direction, drag the Model into the Movement Rotating Model slot
  9. add a CharacterHandleWeapon ability, set the LoftAIAssaultRifle as its InitialWeapon, WeaponAttachment as its WeaponAttachment
  10. add an AIBrain, AIActionSetPlayerAsTarget, AIDecisionNextFrame AIActionMoveTowardsTarget3D, AIDecisionDistanceToTarget, AIActionShoot3D, AIActionRotateTowardsTarget3D
  11. on the AIBrain, create three states :
    • SetTarget (AIActionSetPlayerAsTarget, AIDecisionNextFrame.TrueState:Move)
    • Move (Actions : Move and Rotate, AIDecisionDistanceToTarget.TrueState:Shoot)
    • Shoot (Actions: Rotate and Shoot, AIDecisionDistanceToTarget.FalseState:Move)
  12. Set AIDecisionDistanceToTarget ComparisonMode to LowerThan:5
  13. press play, run away from the enemy and it’ll stop shooting and will start chasing you, get closer, it’ll shoot at you

Creating a simple, turret-like, rotating AI

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. import TDE v1.10.1 (check version in the readme)
  3. open the MinimalScene3D
  4. create a new empty game object, name it Test
  5. under it, create a new cube, name it Model
  6. on the Test node, add a Character component, press its Autobuild AI Character 3D button, drag the Model node into the Character’s CharacterModel slot
  7. on the CharacterOrientation3D uncheck ShouldRotateToFaceWeaponDirection, check ForcedRotation, bind the Model into the MovementRotatingModel slot, set RotationMode to MovementDirection,
  8. on the Test node, add AIBrain, AIActionDoNothing, AIDecisionDetectTargetRadius3D and AIActionRotateTowardsTarget3D components
  9. on the AIDecisionDetectTargetRadius3D comp, set the TargetLayerMask to Player
  10. on the AIActionRotateTowardsTarget3D, check LockRotationX
  11. on the AIBrain, create a new state, call it Wait, set AIActionDoNothing as its action, AIDecisionDetectTargetRadius3D as its transition’s decision, TrueState:Rotate
  12. create a second state, call it Rotate, set its Action as AIActionRotateTowardsTarget3D
  13. press play, enjoy your tiny AI!

Creating a turret-like enemy AI that shoots at the player

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open the MinimalScene3D demo scene
  3. create a new, empty game object, position it at 0,0,0, call it Test
  4. create a new cube, drag it under Test, position it at 0,0,0, name it Model, remove its BoxCollider
  5. on Test, add a Character component, press AutoBuild AI Character 3D
  6. on the Character component, drag the Model into the CharacterModel slot
  7. under CharacterOrientation3D, set Rotation Mode to Weapon Direction, drag the Model into the Movement Rotating Model slot
  8. add a CharacterHandleWeapon ability, set the LoftAIAssaultRifle as its InitialWeapon
  9. add an AIBrain, AIActionDoNothing, AIDecisionDetectTargetRadius3D (TargetLayerMask:Player), AIActionShoot3D, AIActionRotateTowardsTarget3D
  10. on the AIBrain, create two states : Detect (DoNothing and DetectRadius, TrueState:Shoot) and Shoot (Actions: Rotate and shoot)
  11. of course that AI will never stop shooting once it’s detected the player, but from there you can modify its brain to have it do more things if you’d like

Creating a simple AI that will follow and rotate towards the player

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open the MinimalScene3D
  3. create an empty game object, name it “MyChar”, position it at 0,0,0
  4. create a cube, position it at 0,0,0, nest it under MyChar, name it MyModel
  5. via the AddComponent dropdown in its inspector, add a Character component to MyChar, press AutoBuild AI Character 3D
  6. in CharacterOrientation3D, drag MyModel to the MovementRotatingModel slot, set rotation mode to MovementDirection
  7. add an AI brain, AIDecisionDetectTargetRadius3D, AIActionMoveTowardsTarget3D, AIActionRotateTowardsTarget3D
  8. in the brain, add a new state, name it Detect, add a transition to it, set the decision to DetectTargetRadius, TrueState to Move
  9. add a new state, name it Move, no Transition, set its Actions to Move and Rotate towards target
  10. in the Detect target radius set the TargetLayerMask to Player
  11. press play, move around, AI follows and rotates towards target

Setting up 2D cones of vision powered AIs

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open KoalaDungeon
  3. select the first ninja to the left, right click, unpack it completely
  4. rename it to NinjaWithCone (or whatever), and make a prefab of it
  5. open the Koala prefab, select its ConeOfVision node, copy it
  6. open the NinjaWithCone prefab, paste the ConeOfVision into it, put it at the same level as the NinjaModel or the Feedbacks (under the top level), position it at 0,0,0
  7. at the top level of that prefab, remove AIDecisionTargetRadius2D
  8. add a MMConeOfVision2D, set ObstacleMask to Obstacles, TargetMask to Player, and drag the ConeOfVision into the VisionMeshFilter slot at the bottom
  9. add a AIDecisionDetectTargetConeOfVision2D, and in the AIBrain, change the first State’s transition’s decision to AIDecisionDetectTargetConeOfVision2D
  10. press play, walk into the Ninja’s cone, notice it acquires the Player as the target and starts attacking it

Bonus steps if you want the cone to move too :

  1. add an AIActionRotateConeOfVision2D
  2. add an AIActionMoveRandomly2D
  3. in the AIBrain’s first state, replace the action (AIActionDoNothing) with AIActionMoveRandomly2D, and add a second action, and make it AIActionRotateConeOfVision2D

Setting up auto aim and auto shoot

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager, open MinimalSword3D
  2. edit the LoftTie prefab, set its CharOrientation3D’s RotationMode to WeaponDirection
  3. edit the LoftSwordFast prefab, set its WeaponAim3D’s AimControl to Script
  4. add a WeaponAutoAim3D component, TargetsMask:Enemies
  5. add a WeaponAutoShoot component
  6. while this would be enough for it to “work”, you’ll probably want to at least uncheck PreventAllAimWhileInUse on all the sword’s MeleeWeapon components (that weapon really isn’t setup for auto shoot)
  7. press play, get close to an enemy, enjoy the chaos

Setting up a direction marker

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open MinimalScene3D, edit the MinimalCharacter prefab
  3. add a SpriteRenderer on an empty parented under the root of MinimalCharacter, name it MarkerContainer, position 0,0,0
  4. add a sprite renderer on an empty under MarkerContainer, name it Marker, set its sprite to button-A, position:0,0.1,0, Rotation:90,0,0, Scale:3,3,3
  5. on MinimalCharacter, add a CharacterDirectionMarker ability, DirectionMarker:MarkerContainer
  6. press play in the editor, your direction marker is done and working
  7. you can now tweak your CharacterDirectionMarker ability’s settings to have it interpolate, reflect your aim direction, etc

Setting up a hitscan weapon

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open KoalaDungeon
  3. create an empty game object, name it TestHitscan
  4. create an empty child to it, name it Model, add a SpriteRenderer to it, set its sprite to Koala_Weapons_Rifle, SortingLayer:Above
  5. on the top level object (TestHitscan), add a HitscanWeapon component, under HitscanSpawn, set the projectile spawn offset to 0.8, .1,0
  6. under the Hitscan section, set Mode to TwoD, HitscanTargetLayers to Enemies, Obstacles
  7. add a WeaponAim2D component, set its AimControl to Mouse, WeaponRotationSpeed:0
  8. drag the TestHitscan object into your project to make it a prefab, remove it from the scene
  9. select the Koala prefab, drag the TestHitscan prefab into its CharacterHandleWeapon’s InitialWeapon slot
  10. press play, you’re now wielding a weapon that will damage/destroy enemies/clay pots in a straight line when aimed at them (now you can start working on its feedbacks to make it feel better!)

Setting up a character model switch ability

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open the MinimalScene2D demo scene
  3. open the MinimalCharacter2D prefab
  4. create a new empty game object to it, name it AltModel, to it, add a SpriteRenderer, and set its Sprite to Adventurer_0, then set its position to 0,0.4,0, and disable the object
  5. at the top level (MinimalCharacter2D) add a CharacterSwitchModel ability 
  6. add two entries to its CharacterModels array, drag the MinimalCharacterModel to its first slot, and the AltModel node to its second slot
  7. save the prefab, press play on the MinimalScene2D, you can now move around, and switch models by pressing P

Creating a new loading screen

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. duplicate the LoadingScreen demo scene, name it NewLoadingScreen
  3. add it to your build settings (file, build settings, drag your NewLoadingScreen into the “Scenes in Build” panel)
  4. open it, select the Main Camera, and on its Camera component, let’s change the background color to some red (you can make other changes in the scene if you want to, but that red is how we’ll make sure we’re using the correct one)
  5. save the scene
  6. open Minimal2DDoors1, in its LevelManager, set the LoadingSceneName to NewLoadingScreen
  7. press play, move up/right through the green door, then move right until you see a blue gate, enter it (press space), notice we’re loading our new scene using our newly created loading screen

Setting up a Weapon Model

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open the Colonel demo scene

Setup the weapon model :

  1. under its HandR node, create an empty object, name it MyWeaponModel
  2. add a WeaponModel comp to it, set its WeaponID to MyWeapon
  3. under it, create a new cube, remove its box collider, set its scale to 0.003,0.003,0.003
  4. on MyWeapon’s WeaponModel inspector, drag the cube into the TargetModel slot
  5. press play, notice the cube disappears, that’s normal, its weapon is not equipped

Setup the weapon :

  1. duplicate the Loft3D’s AssaultRifle prefab, name it MyWeapon
  2. in its ProjectileWeapon’s ID section, set WeaponName to MyWeapon
  3. open that new prefab, remove its ModelContainer node and everything under it, remove the feedback too
  4. clear its ProjectileWeapon’s animators and animation parameter names
  5. at its top level remove the animator
  6. save the prefab, and on the Colonel’s CharacterHandleWeapon, assign it as its InitialWeapon
  7. press play, you now have a nice shooting cube

Creating a melee weapon with a separate damage area

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open the Loft3D demo scene
  3. create a new empty game object, name it MyWeapon, set its layer to Player
  4. add an empty child to it, name it MyDamageOnTouch, add a BoxCollider to it (isTrigger:true), add a DamageOnTouch to it, TargetLayerMask:Enemies+Obstacles
  5. on MyWeapon, add a MeleeWeapon component, MeleeDamageAreaMode:Existing, ExistingDamageArea:MyDamageOnTouch
  6. drag MyWeapon into your project panel to make a prefab out of it, remove it from the scene
  7. edit the LoftSuit prefab, set its CharacterHandleWeapon’s InitialWeapon to MyWeapon
  8. press play in the editor, move close to some of the blue cubes, press E to attack

How to setup a character with separate colliders for movement and damage (hitbox)?

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager, open Loft3D
  2. add an empty child to the PatrolSeekAndDestroyReloadingAI’s SuitModel in the scene, name it SeparateHealth
  3. add a Rigidbody to it, IsKinematic:true
  4. add a BoxCollider to it, size:5,5,0.5, isTrigger:true
  5. move the Health from the top level to SeparateHealth
  6. on the PatrolSeekAndDestroyReloadingAI’s Character component, drag SeparateHealth into the CharacterHealth slot
  7. press play, your enemy now enjoys different colliders for movement and damage

How to setup a portal to load a new level?

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open the MinimalScene2D demo scene
  3. create a new game object, name it Portal, add a SpriteRenderer to it, set its sprite to Min2D_OrangePortal, SortingLayer:Above, set its position to 5,0,0
  4. add a box collider 2D to it, isTrigger:true
  5. add a GoToLevelEntryPoint component to it, AutoActivation:true, and at the bottom of its inspector, in the LevelName field, type MinimalSandbox2D
  6. go to File > Build Settings and make sure that your destination scene (in this case MinimalSandbox2D) is present. If it’s not, add it.
  7. press play, walk right to enter the portal, the new level loads

Setting up a HealthBar

  1. in Unity 6000.0.23f1 (or higher), create a new project and import TopDown Engine v4.2 via the Package Manager
  2. open KoalaDungeon, drag a DungeonPot prefab into it, position it at 50,-21,0, set its Health’s Initial and Maximum Health to 300
  3. add a MMHealthBar component to it, set its SortingLayerName to Above
  4. press play, walk up to grab the rifle and ammo, then shoot at the pot, and you’ll notice its healthbar update as it loses health