Comments

Log in with itch.io to leave a comment.

(+1)

thnks i managed to make a pretty solid base for the game i am making, so right now i can play with the graphics

Note, to anyone using this, if you're using this and try to playtest in the editor, you cannot move, you can only do it in the Player and not in the Editor. I think this may have something to do with the Input Manager being used.

(3 edits)

New to unity, downloaded on 2022.3.4f1 with 2 errors

Assets\TopDownController2D\Scripts\TopDownCharacter2D\UI\EntityHealthGaugeUpdater.cs(4,19): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)

Assets\TopDownController2D\Scripts\TopDownCharacter2D\UI\EntityHealthGaugeUpdater.cs(13,34): error CS0246: The type or namespace name 'Slider' could not be found (are you missing a using directive or an assembly reference?)

How to fix? And yes, Cinemachine and Input System are installed

Edit: Seems that UnityEngine.UI (Line 4) isn't a proper namespace type and removing it seems to fix it. And "Slider" (Line 13)... isn't a real thing? Did you mean SliderEditor?

UnityEngine.UI is indeed a valid Unity namespace https://docs.unity3d.com/Packages/com.unity.ugui@1.0/api/UnityEngine.UI.html and it's a built-in package in Unity, Maybe you have it disabled in the package manager? (Window->Package Manager ->Select Package: Built-in -> Search for the package named "UI") It's strange since it's also supposed to be a dependency of the Input System package.  Either way the UI elements are not really supposed to be used as-is, it's mostly an implementation example so you could just remove those files either way and use your own UI.

And the reason the type "Slider" is not recognized is most probably because you don't have the UI package not because I don't know how to type (Errors like that are usually caused by how your project is setup since Unity has a lot of package that can be enabled or disabled)

What exactly do you mean by "the UI package"? If you're talking about Unity UI, I installed it and still nothing. I have both UI and UIElements built-in and enabled.

I mean that if you remove "using UnityEngine.UI" from the file that use the type "Slider" it will cause issues either way because it's the namespace that contains the "Slider" type. 

Did you try to install my package on a new project? If you have Unity UI installed it should work. But it seems to be a common issue maybe you can find more info on how to solve that here https://forum.unity.com/threads/solved-the-type-or-namespace-ui-does-not-exist-i... 

(1 edit)

Ok, so after reinstalling the package, along with Unity UI and the other 2, it works without any errors. I don't know exactly how it worked, but apparently it just does lol

Either the package or Unity is running off some real spaghetti 

Deleted 66 days ago

If it helps by the way, I found multiple missing scripts in the "Player" "Enemy_Range" "Enemy_Contact" and "Player_Close" prefabs.

2022.3.9f

This plugin has only been tested up to Unity 2021, I'll try to look into what could be causing the issue and update it when I have time

hi, I'm also new to unity, I downloaded this asset and I have only 2 errors

this  first error

Assets\TopDownController2D\Scripts\TopDownCharacter2D\Controllers\TopDownInputController.cs(30,16): error CS1503: Argument 1: cannot convert from 'UnityEngine.Vector2' to 'UnityEngine.InputSystem.InputValue'

this second error

Assets\TopDownController2D\Scripts\TopDownCharacter2D\Controllers\TopDownInputController.cs(48,20): error CS1503: Argument 1: cannot convert from 'UnityEngine.Vector2' to 'UnityEngine.InputSystem.InputValue'

tell me how to fix it please

Hello, which Unity version are you using?

I don't seem to have any issue using Unity 2022.3, so please make sure that you :

  • Install the Input System and Cinemachine package (To install a package from Unity go to Window -> Package Manager -> Search for the name of the package and install the plugin (if you can't find it in the results make sure that you set the list of packages to display the content of Unity registry at the top left of the window))
  • Make sure your project uses the new Input System package (Edit -> Project Settings -> Player -> Other Settings -> Active Input handling -> Input System Package (new)

and restart the editor afterward, if you still face some issues try to re-import the plugin after that, if even after that it still doen't work, feel free to tell me

(1 edit)

Hey new to unity, why do i get an error when trying to Import this in?

"Assets\TopDownController2D\Scripts\TopDownCharacter2D\Controllers\TopDownInputController.cs(2,19): error CS0234: The type or namespace name 'InputSystem' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)"

"Assets\TopDownController2D\Scripts\TopDownCharacter2D\UI\EntityHealthGaugeUpdater.cs(4,19): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)"

"Assets\TopDownController2D\Scripts\TopDownCharacter2D\UI\EntityHealthGaugeUpdater.cs(13,34): error CS0246: The type or namespace name 'Slider' could not be found (are you missing a using directive or an assembly reference?)"

"Assets\TopDownController2D\Scripts\TopDownCharacter2D\Controllers\TopDownInputController.cs(25,28): error CS0246: The type or namespace name 'InputValue' could not be found (are you missing a using directive or an assembly reference?)"

"Assets\TopDownController2D\Scripts\TopDownCharacter2D\Controllers\TopDownInputController.cs(35,28): error CS0246: The type or namespace name 'InputValue' could not be found (are you missing a using directive or an assembly reference?)"

"Assets\TopDownController2D\Scripts\TopDownCharacter2D\Controllers\TopDownInputController.cs(54,28): error CS0246: The type or namespace name 'InputValue' could not be found (are you missing a using directive or an assembly reference?)"

those are the errors in question.

(3 edits)

Hey, which Unity version are you using ? Also from what I see most of those error are caused by a missing dependency, the sample project use the new input system so it needs to be installed in the package manager and activated for those errors to go away https://docs.unity3d.com/Manual/com.unity.inputsystem.html

What license do the sprites fall into?

You can use them however you want without having to credit me, they where created solely for this project.

(+2)

I couldn't get it to work for a while because the new input system (even when assigning keys) wouldn't detect any presses, and playing wouldn't let me move or shoot.

The fix was: 

Edit -> Project Settings -> Player -> Other Settings -> Configuration, and set "Active Input Handling" to "Both"

It worked suddenly after restarting.

A very excellent work, Thanks.

Hello , thx for awesome pack , I am new Input sistem , If i wand player move where i clip Mouse , what do i need? thx

i'm unable to see where it explain how to switch to the sword hit, can u give me a hint ?

In the sample project you can look at the "Player_Close" game object (which is disabled by default), but in a general case you need to add a "Top Down Melee" component to your character (in which you will need to add a reference to a prefab containing a "Melee Attack Controller" component), and changes its "attack config" in its "Character Stats Handler" component to be a Melee attack config (in the sample project there is the "PlayerSwordSlash" config. I don't know if that's what you wanted. 

hello sir, i am very interested. It's just what I need, but my project is designed for mobile(android), is there any way to include touch controls?

You could theoretically just edit the InputAction file of your Player to add ways to triggers the Move, Look and Fire events with touch controls. However i don't think just doing this would work very well so you might need some kind of virtual joystick and buttons or at least a custom version of my "TopDownInputController" script. I might try to implement touch controls later but not in the near future.

You can code two joysticks and decide its movement by the left joystick and decide attack direction with a right joystick or vice versa.

hey i purchased this asset the other day and was curious as to how i would go about adding a player dodge/dash mechanic? and what i would have to disable to go about doing that.

(+1)

In order to add a new mechanic (something that needs a new input other than the existing ones) you have a few steps to do:

  1. Edit the Unity's Input asset (located in Sample/Input/Top Down Controller 2D in the example) to add a new input to read
  2. Create a new event for this input in the TopDownCharacter2D.Controllers.ControllerEvent class by following the existing examples (for a dodge mechanic I think you want your event to extend the UnityEvent<Vector2> 'class' since you want to dodge in a specific direction I would imagine)
  3. Add your new event to the TopDownCharacterController class (simply add a private readonly field and a public getter like the other events)
  4. Now if you want the player to be able to use your new mechanic you need to update your player controller (your class extending the TopDownCharacterController class / the TopDownInputController class in the example). 
  5. In this class you will need to create a method to receive the input from the input system (like the OnMove and OnLook methods of this class) for a dodge mechanic i think you will need to keep a direction in memory and when you press the button you create a OnDodgeEvent with the direction stored (using the look direction should work quite well)
  6. Now you only need to create a new component to handle this specific event. In order to write this component you can look at the TopDownMovement, TopDownAimRotation, TopDownShooting... classes which basically work the same way. 
    1. You need to store your controller using "GetComponent<TopDownCharacterController>" in the Awake method
    2. Add a listener to the event you want to handle (OnDodgeEvent in this example)
    3. And finally, actually perform the logic of the mechanic in the method

Now as for the dodge mechanic in itself i think you should use a Coroutine (https://docs.unity3d.com/Manual/Coroutines.html) which will simply disable collision between the player and enemies / bullets and some components like TopDownMovement and HealthSystem for a given time. I think this page can be a good start https://docs.unity3d.com/ScriptReference/Physics.IgnoreLayerCollision.html

If you want a specific animation for the dodge you can look into the TopDownAnimation class and add a listener on the OnDodgeEvent.

These steps should help you to add a new mechanic to the controller, but if you encounter any problem or don't understand a step don't hesitate to ask me in the future i plan on writing a small documentation properly to answer those kind of questions.

wow, amazing response, very detailed, and very quick, i'll be sure to give it a go today or tomorrow at some point, and i'll keep you posted! Thanks!

Nice, I was looking for something like this for months, good controller.

but it gives me 4 errors when I import it

first error:  Assets\Scripts\TopDownCharacter2D\Controllers\TopDownInputController.cs(2,19): error CS0234: The type or namespace name 'InputSystem' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)

second error:  Assets\Scripts\TopDownCharacter2D\Controllers\TopDownInputController.cs(24,28): error CS0246: The type or namespace name 'InputValue' could not be found (are you missing a using directive or an assembly reference?)

third error: Assets\Scripts\TopDownCharacter2D\Controllers\TopDownInputController.cs(34,28): error CS0246: The type or namespace name 'InputValue' could not be found (are you missing a using directive or an assembly reference?)

and forth error:

Assets\Scripts\TopDownCharacter2D\Controllers\TopDownInputController.cs(53,28): error CS0246: The type or namespace name 'InputValue' could not be found (are you missing a using directive or an assembly reference?)

(+1)

Dont worry, I fixed it, it was because I didnt had the input system package.

Assets\Scripts\TopDownCharacter2D\Controllers\TopDownCharacterController.cs(21,51): error CS0144: Cannot create an instance of the abstract class or interface 'UnityEvent<Vector2>'

help plz

Which Unity version are you using ?

2019.4.28f1

(+1)

I'm working on porting it to Unity 2019, however if that's not a problem for you you can try to use Unity 2020 and it should work properly.

well i like to use 2019 verson so hope you fix the problem thankyou

(+1)

I uploaded a new version compatible with Unity 2019

it seems that this project is built on the new Input System, maybe should stress this in the description?

It was only mentioned in the installation instructions but its easy to miss so I added it in the description now. However if it's a problem for you, porting it to the old input system should be really easy since only the controller would need to be reworked (I might add an example with the old input system later)

No I'm ok with that, I just feel like it's better to mention in the description in case someone miss that. Btw it's a really good asset:)

I will study this for my next project, thanks