Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

[RELEASED] Corgi Engine - Complete 2D/2.5D Platformer [new v8.0 : advanced damage system]

Discussion in 'Assets and Asset Store' started by reuno, Dec 18, 2014.

  1. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,759
    @archisan > When you say "as describe before", what exactly do you mean? How exactly did you create that AI?
    Could you provide repro steps of what you did?
    You'll find examples of such steps to create a simple AI at https://corgi-engine-docs.moremountains.com/recipes.html#creating-a-very-simple-ai-character

    Copying them here as well for convenience :

    - in Unity 2019.4.36f1, import Corgi Engine v7.5.1
    - open the MinimalLevel demo scene
    - from the project panel, drag a Platform1000x100 prefab into the scene, position it at 0,-1,0
    - create an empty game object, position it at 0,0,0, name it MyTestCharacter
    - create a new empty child game object to the MyTestCharacter node, add a SpriteRenderer to it, set its Sprite to Adventurer_0, name it MyModel
    - on the MyTestCharacter node, add a Character component, press the AutoBuild AI Character button at the bottom of it
    - drag your MyModel into the Character’s inspector’s CharacterModel field
    - edit the BoxCollider2D’s size to 0.8,0.8
    - on the AI's AIWalk component, check AvoidFalling:true
    - press play

    If your issue persists please provide similar steps of what you're doing, I'll be happy to have a look for you.
     
  2. jim00

    jim00

    Joined:
    Feb 1, 2015
    Posts:
    57
    got error message when add MMHealthBar to enemy unit. I'm using Corgi Engine ver 7.5.1 and Unity ver. 2020.3.27f1


    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.PropertyEditor.DrawEditors (UnityEditor.Editor[] editors) (at <63ccfe108ffa44728b417cb47fb2f841>:0)
    UnityEditor.PropertyEditor.RebuildContentsContainers () (at <63ccfe108ffa44728b417cb47fb2f841>:0)
    UnityEditor.InspectorWindow.RedrawFromNative () (at <63ccfe108ffa44728b417cb47fb2f841>:0)



    How to get rid of the error.
     

    Attached Files:

  3. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,759
    @jim00 > Looking at the stack, it doesn't seem to be related to the engine.
    You'll find examples of enemies in the RetroAI demo scene, most of them do have a MMHealthBar. If your issue persists, I'll need precise repro steps of what you're doing (what enemy you're adding it to, in what scene, what version of Unity/the engine), as I can't tell why you'd get that error otherwise.
     
  4. archisan

    archisan

    Joined:
    Aug 26, 2019
    Posts:
    8
    @reuno
    i i follow your step everything works because i used only one spriterender stuff.
    Using a more complex model with several sprite animated, the filp behaviour not works.
    As you can see in my first post i have a model with a body and the other body parts as child and the animator component is in tha parent body object.
    In this scenarious the model does not flip.
    if you need i can provide you by email a unitypackage with the prefab.

    regards
     
    Last edited: Mar 10, 2022
  5. JohnnyGoodpick

    JohnnyGoodpick

    Joined:
    Oct 24, 2021
    Posts:
    1
    Hello

    Same is happening is my projet, the flip() doesnt work on my 3d models when trying your method to recreate a character, but everything else is working as intended.

    Awesome package btw, please let me know what I could provide to help
     
  6. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,759
    @archisan, @JohnnyGoodpick > In the engine the process is the same regardless of what your model is (2D sprites, spine, 3D model, SDF, voxels, etc), as long as your model is correctly nested, it'll work.

    For reference, here are the same steps but with a 3D model this time :

    - in Unity 2019.4.36f1, import Corgi Engine v7.5.1
    - open the MinimalLevel demo scene- create an empty game object, position it at -60,-5,0, name it MyTestCharacter
    - create an empty child inside that object, name it ModelContainer
    - from the Project view, drag the NewCorgi model (not the prefab, the model), set its scale to 2,2,2, set its rotation to 0,90,0, drag it under the ModelContainer, and position it at 0,0,0
    - on the MyTestCharacter node, add a Character component, press the AutoBuild AI Character button at the bottom of it
    - drag your ModelContainer node into the Character’s inspector’s CharacterModel field
    - edit the BoxCollider2D’s size to 0.8,1.4, and its Offset to 0,0.7
    - on the AI's AIWalk component, check AvoidFalling:true
    - from the project panel, drag a Platform1000x100 prefab into the scene, position it at -60,-6,0
    - press play, the AI will flip just fine :

    upload_2022-3-10_10-33-0.png

    Of course from there you'd want to also add and setup an animator, but that wouldn't have an impact on flip (or rotation, if you prefer to rotate on direction change). That's all covered in details in the docs. Let me know if your issue persists!
     
  7. jim00

    jim00

    Joined:
    Feb 1, 2015
    Posts:
    57
    @reuno After a few trials I found out that, no matter what type scene, if before enter play mode and you have select (in Hierarchy click on the enemy to select it) an enemy character that has MMHealthBar component on it than enter play mode the error will appear. But if select other items beside enemy that has MMHealthBar, the error will not appear.

    I have try this in Unity version 2020.3.30f1 and 2020.3.27f1

    Not sure if it's Unity's problem or not and I know it's not a big deal but just so you know about this. thanks
     
  8. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,759
    @jim00 > I would recommend reporting this to Unity then, that's an editor bug.
     
  9. mekatama

    mekatama

    Joined:
    Feb 25, 2022
    Posts:
    8
    I want to run my own script when a specific enemy is defeated.
    When HP=0 in [AIDecisionHealth], I set my own script in [AIActionUnityEvents].
    However, the home-made script was not activated.
    Is this because the enemy fell and the AI stopped working?
    Or is there a better way?
     
  10. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,759
    @mekatama > That's probably because the brain gets turned off on death, yes. The Health component exposes hooks you can use to do things on damage / on death, I'd recommend using those instead.
     
  11. mekatama

    mekatama

    Joined:
    Feb 25, 2022
    Posts:
    8
    @reuno
    Thanks for the answer.
    I'm convinced I've identified the cause.
    My amateur programming skills do not allow me to access the Health component.
    I'm not good at it, but I can determine Unity - SetActive and determine that the enemy is down.
     
    reuno likes this.
  12. markantonybowley

    markantonybowley

    Joined:
    Mar 25, 2021
    Posts:
    1
    Is there a simple way to inflict damage with the roll and dive abilities like the dash damage ability ? Or would that need to be extended with code ?
     
  13. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,759
    @markantonybowley > No, the roll and dive don't apply damage, that'd require extending. I'd recommend looking at the CharacterDamageDash ability for reference, it does exactly that.
     
  14. wechat_os_Qy0z_aF7Nfhquhava38GLxUWU

    wechat_os_Qy0z_aF7Nfhquhava38GLxUWU

    Joined:
    Dec 22, 2021
    Posts:
    43
    I think i find a bug from this "Adds an option to auto destroy a weapon from the inventory if it's been depleted"
    It happens when "Auto destroy when magazine is empety" .The animatior parameters show the destroyed weapon is still equipped.So It influenced charater cant exit from destroyed weapon animation state.
     
  15. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,759
    @wechat_os_Qy0z_aF7Nfhquhava38GLxUWU > If you think you've found a bug, please use the support form and make sure you provide the info requested next to it, as well as repro steps to your issue, thanks.
     
  16. EarlyDarkEntertainment

    EarlyDarkEntertainment

    Joined:
    Oct 8, 2018
    Posts:
    14
    Hello would a future update include a shop or would the dialog system suffice?
     
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,237
    You could use the Dialogue System for Unity to emulate a shop (it's been done before), but a dedicated shop system would probably be better if you have the knowledge to code one up. There may also be a user-contributed shop system on Corgi's Discord server.
     
    NonhumanStoltz and reuno like this.
  18. EarlyDarkEntertainment

    EarlyDarkEntertainment

    Joined:
    Oct 8, 2018
    Posts:
    14
    Thanks I own Dialogue System, it's really useful.
     
    TonyLi likes this.
  19. mekatama

    mekatama

    Joined:
    Feb 25, 2022
    Posts:
    8
    I had an enemy hold a weapon with MagazineBased and AutoReload on and attack with AIActionShoot!
    However, it does not reload and ends up attacking only once!
    Maybe the standard functionality does not allow enemies to auto-reload?
    qa1.png
     
  20. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,759
    @mekatama > It's a bit hard to tell what exactly your setup is without repro steps, but there's an action for AIs to reload. If your issue persists, or if you have other questions, please use the support form and provide more info about what you're doing, thanks!
     
    mekatama likes this.
  21. NonhumanStoltz

    NonhumanStoltz

    Joined:
    Dec 6, 2020
    Posts:
    19
    This might be more of a unity animator question, but I figured I'd ask it here since I'm using the corgi animation parameters. I have a few asymmetrical 2d characters, meaning flipping the sprite won't work for them. I have animations already captured for when facing left or right, and I see a boolean for "FacingRight" in the animation parameters, but I don't see a demo in the corgi engine that has an example of using the Facing right boolean. I remember back when I was using Unity's 2d game kit, the player character Ellen had a whole animator controller for this since she is asymmetrical herself. I could just follow that, but is it possible to do it with corgi? States like falling, walking, idle etc. I can see easily being done, especially with an overridding layer and turning the character flipping off, but I'm a bit concened with attack animations. Though I haven't tried it I'm pretty sure if a character was in the middle of the attack, and suddenly you weren't facing right (triggering the state for attacking in the opposite direction) it sounds like it will redo the animation from the beginning. This is not to mention how turning flipping off will pretty much make the weapon flipping moot too. I feel like this is too integral to how corgi works to mess with, but I could be wrong.

    So, TL;DR, what's the best way to approach sprites that are asymmetrical? Can it be done in corgi? If there is a demo that has an example of this, which one has it? I looked and it seems like the spacepig character rotates instead of flips, is that how you're supposed to do it? I plan to run some experiments later today but I'm not sure what's the best route.
     
  22. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,759
    @NonhumanStoltz > That's indeed unrelated to the engine (it doesn't do any animation, Unity does). Typically that's something you'd handle with substates (https://docs.unity3d.com/Manual/NestedStateMachines.html), although there are plenty of other valid ways of tackling that. There's no demo of that, but you can do it in the Corgi Engine like you'd do it in any other project.
     
    NonhumanStoltz likes this.
  23. icreatepixels

    icreatepixels

    Joined:
    Aug 28, 2018
    Posts:
    30
    Hi!
    Just started using the corgi engine, and I really love. But right now I'm stuck.
    I wanted to tweak the levelselectionscene, the scene with a level selection carousel.

    I've created other scenes, but they won't load in the level selection. What am I missing?
    Even I just duplicate an already exciting scene, change one of the button the new scenes name, it wont' load.
    Except for adding the correct scene name to a button in the selection carousel, where else do I need to add my new scene?
     
  24. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,759
    @icreatepixels > Do you get any error when you try to load a new scene? If yes, which one?
     
  25. icreatepixels

    icreatepixels

    Joined:
    Aug 28, 2018
    Posts:
    30
    Yes i got an error message about the scene not being an instance.
    But I just solved it!
    I had to add my new scene to my build settings, and then it worked. I did not realize I had to do this. It fixed the problem, thanks for the quick reply :)
    Now I can continue building my awesome local multiplayer arena game, whoop! Thanks for an awesome asset
     
    reuno likes this.
  26. NonhumanStoltz

    NonhumanStoltz

    Joined:
    Dec 6, 2020
    Posts:
    19
    Oh I know Corgi doesn't do any actual animation, I meant if I can set up an animator with the character animation parameters that corgi comes with since I can't really program in my own from scratch. I'll look into substates (already made one for shooting) but if it's the best method I'll update the animator set up I have to accommodate. Thank you for pointing me to that direction!
     
    reuno likes this.
  27. NonhumanStoltz

    NonhumanStoltz

    Joined:
    Dec 6, 2020
    Posts:
    19

    Actually, I don't think it matters that much for 2d games and I'm just being overly detailed. I mean, I looked at unity's 2d game kit and Ellen, a clearly asymmetrical character, is just using sprite flipping. Sorry to bother you.
     
  28. unity_681FDFE6AE3C8B7F9F48

    unity_681FDFE6AE3C8B7F9F48

    Joined:
    Feb 6, 2022
    Posts:
    13
    1. I installed corgi version 7.5.1. I used the timeslower object from the corgi2d folder. If you use this prefab (take as character) and restart the level during its action (during time dilation), then the effect of slowing down will not disappear and will be valid for the entire game. Unity 2020.3.23f1
     
  29. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,759
  30. unity_681FDFE6AE3C8B7F9F48

    unity_681FDFE6AE3C8B7F9F48

    Joined:
    Feb 6, 2022
    Posts:
    13
    1. I have installed the Unity 2020 version.3.23f1. I have the latest version of CorgiEngine 7.5.1
    2. I opened the folder corgi2d/prefabs/itoms/ and copied time slower from there.
    3. I went to RetroAdventureDemo1 and put a prefab there.
    4. I had three lives. And everything works correctly until then, when I die with the effect of delayed time from this prefab. 5. If you die during the time when you take timeslower, the time will be slowed down even after restarting the level.
     
  31. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,759
  32. unity_681FDFE6AE3C8B7F9F48

    unity_681FDFE6AE3C8B7F9F48

    Joined:
    Feb 6, 2022
    Posts:
    13
    I sent the message
    But what could be the fastest solution for this problem?
    Reset time on death?
     
  33. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,759
  34. unity_681FDFE6AE3C8B7F9F48

    unity_681FDFE6AE3C8B7F9F48

    Joined:
    Feb 6, 2022
    Posts:
    13
    I sent everything I have
     
  35. unity_681FDFE6AE3C8B7F9F48

    unity_681FDFE6AE3C8B7F9F48

    Joined:
    Feb 6, 2022
    Posts:
    13
    This Code as well
     
  36. twinmatrix

    twinmatrix

    Joined:
    Sep 6, 2012
    Posts:
    38
    I'm in the process of using the Corgi Engine for a 3D (2.5D) platformer. However, I'm running into issues that make controlling the 3D character more difficult, and probably all have the same cause. This cause can be, for example, an incorrect orientation of the armature or for example an incorrect placement in the character structure of me, concerning the 90 degrees rotation around the y-axis (which changes in local space during from the top to the bone in the structure).

    During the process of making a character that faces in the right direction to the left and the right, one time the prefab of the imported model lies flat on the ground, the other time it always runs in the same direction with both the left and right arrow keys and does not turn around, the other time it partially sinks through the ground at a certain direction, and so on, and so on.



    I have now tried everything, and can now get the models in the right direction. But without knowing what really happens and what is the underlaying logic.


    This is the structure of your NewCorgi3D model, the model work well:

    upload_2022-4-23_1-7-47.png


    This is the structure of a model made with Blender and exported as FBX. Your structure did not work with this Blender model.
    After many attempts with twisting the various levels around an axis, I got the model in the right direction. I have absolutely no idea what I've done so I'd like to have a guideline on this.

    upload_2022-4-23_1-8-3.png


    However, the above solution of me didn't work on another blender model (maybe something to do with the armature direction?) So I had to do different twists around the axes again at different levels of the structure, and create a slightly different texture .

    upload_2022-4-23_1-8-19.png




    Those were two models I made in Blender from scratch, including armature. Normally they work absolutely as expected in Unity. But not within the Corgi Engine.


    The structure of a character downloaded from Mixamo can be much simpler to achieve a desired result with movement and direction that are synchronized and correct.

    upload_2022-4-23_1-8-37.png



    However, for all three characters (two from blender and the one from mixamo) the direction is incorrect when climbing a ladder. ALL characters do not want to turn towards the ladder, but climb sideways up the ladder. Force direction doesn't help at all. That only works with the NewCorgi3D model.


    So I have a few important questions:


    1 - Can you give a good guideline for importing blender characters? Where is best to place the Animator, it is best to choose the top level as the character model or the level with the Mesh. Are there any requirements for the local direction of the Armature? How to take care of the different rotations needed to get he character in de correct direction?

    2 - I like to use as Animation type the Humanoid type for the Rig of the imported model. I see that you have chosen Generic for the New Corgi3D model. Is there a reason for that, and does that affect the functioning within the Corgi Engine?

    3 - On which part of a character prefab (for example the NewCorgi3D prefab) does the Force Direction of the ladder component work. On the top level or on the Mesh level or Animator level? How to get the 90 degrees rotation to face the ladder?

    I hope you can help me out this complex structure problem. For the rest I like the Corgi Engine so far.
     
  37. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,759
    @twinmatrix > Unfortunately the engine doesn't have anything to do with your issue, it's a regular Unity issue. I don't have guidelines on importing blender characters (also there's no one way to do it, it depends on what you've done in blender and the result you're after). All the engine needs is a "model", in the abstract sense, some visual representation. That can be a square, a cube, a 3D model, a sprite, voxels, SDF, etc, it's outside of the engine. The engine will control an object, what you put under it can be anything.

    So here what you'll want is learn how to export stuff from blender into Unity in a cohesive way, and nest your model properly. The examples in the engine show one way to do it. Usually two levels of nesting are more than enough to let you orient any object. And there are absolutely no requirements in that regard on the engine's side, as it simply doesn't interact with your model, or doesn't even know about it. As far as it's concerned, you could not have one, or have it be a cube, it'd be the same thing.

    To answer your other questions, what animator type you pick is irrelevant as far as the engine is concerned, as again it's on Unity's side, not on the engine's. All the engine does is update animation parameters, that can be used by any type of animator. The Corgi3D uses a generic rig because that's how I built that specific character in blender.

    And all logic is applied at the controller level, the mesh or the animator don't "have" forces. Rotation would have to be baked in your animation.

    I hope this will answer all your questions!
     
  38. caokai1982

    caokai1982

    Joined:
    Feb 29, 2020
    Posts:
    4
    Hello, in the Demo scene, I simply created a new Sprite with 2D collider, and added code for the event of
    private void OnCollisionEnter2D(Collision2D collision)
    {
    Debug.Log("Collided");
    }

    When I was using the Player character that generated by the engine to enter the Collider, nothing was printed out.
    The collision was not detected.

    I tried creating another object with collider, and it worked.

    It seems Corgi Engine overwrites some collision detection of Unity?
    How could I define my own object with collider that can interact with the Player character?
     
  39. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,759
    @caokai1982 > No, the engine doesn't overwrite collision detection (that's not really possible in Unity), what happened is you probably just weren't meeting the requirements for OnCollisionEnter (see Unity's docs about that).
    I'd recommend using Trigger collisions instead. You'll find plenty of examples of that throughout the engine and its demos. The ButtonActivated class for example uses it, you'll find one at the start of the PixelLevel demo scene, for example.
     
  40. caokai1982

    caokai1982

    Joined:
    Feb 29, 2020
    Posts:
    4
    Hi, I changed to Trigger and it works now. I thought I was clear with the mechanism between them. But it seems I'm not. :confused:
    Thank you for the help.
     
  41. caokai1982

    caokai1982

    Joined:
    Feb 29, 2020
    Posts:
    4
    Hello again,
    While using some tools, I am required to assign the GameObject.
    For example, I want to create a dialogue between the NPC and the Player.
    upload_2022-5-6_15-41-10.png
    The NPC is created by myself, and it's easy to drag and drop the GameObject.
    But our Player is created by code when the game starts. So I can't assign a GameObject at this moment.
    How to solve it?
     
  42. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,759
    @caokai1982 > I'd highly recommend having hard bindings like that between your player and your scenes, it'll quickly become impossible to maintain. But if that's really what you're after, you can have your player already in the scene if you want to. The documentation explains in details how to do that, I'd recommend checking it out.
     
  43. caokai1982

    caokai1982

    Joined:
    Feb 29, 2020
    Posts:
    4
    Thank you. I'll try this unbinding way first. And change when I got more familiar with the engine.
     
    reuno likes this.
  44. nitekrawler

    nitekrawler

    Joined:
    Dec 8, 2013
    Posts:
    13
    I’m using 4 reposition-able joysticks for my project with the Minimal4Players scene. Only the first one seems to move its respective player. All 4 are bound to their respective InputManagerPlayerX.SetMove. Each player prefab is set as player 1,2,3 and 4 respectively. Is there something else that I’m missing that prevents joysticks 2-4 from moving their respective player?
     
  45. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,759
    @nitekrawler > There's no SetMove method, so you'll want to make sure you bind them to the SetMovement method (the Vector2 signature), and that their input managers are set to mobile mode. Just gave it a try, it works out of the box.
     
  46. nitekrawler

    nitekrawler

    Joined:
    Dec 8, 2013
    Posts:
    13
    Pardon. I meant SetMovement. My panel isn't quite as wide working on a laptop so it cuts off the end of the word movement.

    Even though they were already bound, rebinding each one seems to have done the trick. Thank you ever so kindly.
     
  47. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,759
    @nitekrawler > It's likely you had the wrong method signature bound. Unity doesn't make that very obvious. I'm glad it's working now!
     
  48. bwlgeo

    bwlgeo

    Joined:
    May 10, 2022
    Posts:
    9
    Wondering if anybody here has any experience trying to integrate Naninovel with Corgi Engine. I'm able to setup cameras and initialize Naniengine, but I've been trying to get scripts to trigger by using a Button Activated script to call the Play function from the Playscript and having no dice, and the DialogueTrigger script from Naninovel's integration demo doesn't really work for the way Corgi Engine does stuff. I'm positive I'm gonna have to do some coding to make it work I'm just pretty new to this and not really sure where to start
     
  49. NEHWind2

    NEHWind2

    Joined:
    Jan 7, 2016
    Posts:
    27
    Hello Reuno! I have a question about the 'MMSoundManager Track Control' Feedback. I'm running Corgi Engine v7.6 with Unity 2021.1.7f1

    My goal is to have an audio clip pause when the game is paused and resume when the game is un-paused. My current setup is one Feedback Player that gets activated when the player character uses the Character Pause ability. It has two 'MMSoundManager Track Control' feedbacks attached to it. The first one pauses the UI Track at 0.00s while the second one plays the UI Track at 0.05s. This works to pause the audio but when the game is un-paused the audio clip starts from the beginning as though it had been stopped rather than paused. If I use the manual Play buttons under the Track Control feedbacks to activate them while the game is running in the editor they will pause and resume the audio clip the way they should so I'm sure I'm doing something wrong. Do you have any advice on how to go about this?

    Thank you for your time and for your hard work on this engine. The Feedback system is incredible! I'm still wrapping my head around it properly but I've been able to do so much cool and fun stuff with it that was impossible for me to do in my previous projects.
     
  50. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,759
    @NEHWind2 > No, I have to admit I don't know what could be causing this. You should have the same behaviour when pressing the debug buttons or when calling the actual methods from script, as the buttons are just doing that too.