POLISH your Game with Damage Popups! (Unity Tutorial)

Поділитися
Вставка
  • Опубліковано 20 жов 2024

КОМЕНТАРІ • 349

  • @CodeMonkeyUnity
    @CodeMonkeyUnity  5 років тому +34

    This was a really cool effect to make!
    What other things would you add to it?

    • @selmansavas586
      @selmansavas586 5 років тому

      Hello, its not the place to ask a question, but i really wanna know another alternative. In a game im making, sometimes there are so much point popups, it affects the performance significantly. Is using text mesh pro more performance option, or is there someway i can use sprite renderers to circumvent unity's ui system?

    • @CasualCosta
      @CasualCosta 5 років тому

      Hi! Found your channel last week and I've been watching your videos whenever I have time. Don't know if have anything on that, but I would really like to see something turn-based, like RPGs, tactical games and card games.

    • @lhorbrum1818
      @lhorbrum1818 5 років тому

      @@CasualCosta Turn base system would rock, add my vote too.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 років тому +1

      If you have so many popups that is causing issues what I would do would be make a mesh based system.
      Game Objects are very computationally expensive so if instead of creating thousands of objects you simply have one with a mesh it will be much more performant.
      However that does require you to build a mesh system and handle building the quads to display each number, etc.
      Takes a lot of work but if you're sure that's the bottleneck then look into it.
      Yeah I would like to do a Turn Based tutorial, I created a simple Turn Engine for the Livestream game and I'm looking into how I can make a video about it.

    • @MARUTI96
      @MARUTI96 4 роки тому

      I want to deal attacks to multiple enemy(1 shot 4 hit ,like that)

  • @NewbNinjas
    @NewbNinjas 2 роки тому +50

    If you get the following error:
    ArgumentExeption: "The thing that you want to instantiate is null."
    Make sure you've put the GameAssetrs prefab inside the Resources folder in your project hierarchy.
    This had me racking my brains for about an hour :)

    • @4SheR
      @4SheR 2 роки тому +4

      u're my savior mate

    • @y01cu_yt
      @y01cu_yt 2 роки тому +1

      Thanks!

    • @NewbNinjas
      @NewbNinjas 2 роки тому +1

      @@4SheR Yeah it had my mind in bits for hours :D

    • @runedova126
      @runedova126 2 роки тому +1

      Legend. Thanks man.

    • @hydrozen01
      @hydrozen01 2 роки тому

      After hours of headaches, I was about to give up on this video. Really thank you very very much.

  • @electromorphous
    @electromorphous 4 роки тому +15

    This was amazing! That's a lot!!
    Highly underrated channel. It's one of the best gameDev channels I've found.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому +1

      Thanks!

    • @beri4138
      @beri4138 4 роки тому

      It's not very popular because he codes at mach 10 speed and no one can understand his complicated scripts.

    • @Zac_Bacs
      @Zac_Bacs 3 роки тому

      @@beri4138 ok boomer

    • @beri4138
      @beri4138 3 роки тому

      @@Zac_Bacs ok zoomer

    • @cityjudez
      @cityjudez 7 місяців тому

      why you lying???

  • @tigwykplaysgames
    @tigwykplaysgames 2 роки тому +4

    I know it's been a while since this video was published but I used it yesterday to add really sexy damage popups to my game. Thanks so much for the tutorial!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +1

      I'm glad the video helped you! Best of luck with your game!

  • @mario_actually
    @mario_actually 3 роки тому +5

    It’s crazy how often you have the exact videos that I’m looking for. So prolific.

  • @grandmasterhsu
    @grandmasterhsu Рік тому +1

    Thank you so much for this tutorial, it really helped a lot and i learned a lot. since this is a 4 year old video there are a few issues that came up for me, ill list it here for anyone else in the future:
    * GameAssets requires the GameAsset to be created in the Resource folder
    * i had some issues with the Utils class because i'm using the new input system so i wrote my own camera to world pos for the clicking portion.
    * Utils class also gave me problems with the hex color conversion. so i replaced that portion of the code with new Color(R,G,B)
    and since im working with 16x16 grid i had to downscale the font size and some of the small float tweaks to fit my scene better. overall it worked out great and im really grateful.

    • @seanmartiin
      @seanmartiin Рік тому

      jesus?
      This was exactly what i was looking for, thank you.

  • @kerzengrenzen6383
    @kerzengrenzen6383 5 років тому +4

    Your ad brought me here. This was the First usefull commercial ive ever saw

  • @vernavictor868
    @vernavictor868 4 роки тому +1

    to me he is at another level in programming, since i am myself a beginner(new to c# programming), its really hard to catch up. But i do learn from him how to make my program more cleaner and thank you. this video really help me a lot.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому +2

      It's all about experience, I've been writing code for 20 years so just keep at it and you'll get there one day!

  • @bramvanwambeke1859
    @bramvanwambeke1859 5 років тому +26

    Is that intro new? Its the first time i noticed it, it looks really nice.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 років тому +6

      Yeah trying out a couple of new things, glad you like it!

  • @garathiel84
    @garathiel84 2 роки тому

    Instantly subscribed after this , and added to my RPG Game!!!

  • @puceaumesquin235
    @puceaumesquin235 Рік тому

    You're the best. Really, I did not believe I could implement that so easily !

  • @jasielt.2006
    @jasielt.2006 4 роки тому +1

    this really helped me with my game mane, thanks a lot for the tutorial much appreciated

  • @mmabnoob814
    @mmabnoob814 5 років тому +5

    Keep up the good work... thanks 🙏🏻

  • @LeFede
    @LeFede 4 роки тому +1

    UNDERRATED videogames developing channel.
    You are a beast and surely deserve more views per video.
    Thank you and greetings from Argentina.

  • @beri4138
    @beri4138 4 роки тому +1

    If you get runtime errors, use the type TextMeshProUGUI instead of TextMeshPro. I've had errors for DAYS and the thing didn't work until I had the bright idea to use TextMeshProUGUI. Now it works perfectly.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      That depends on what object you used when making the prefab. The UGUI version is the UI version whereas the normal one is a world space text object. Both of them work the same but you do need to use the same type in code and in the editor.

  • @KrazyKain
    @KrazyKain 4 роки тому +3

    Hey thanks for the video, got yourself another subscriber :) I was looking for a way to get cool looking damage numbers in a JRPG combat system, and this works great with a bit of tweeking to encorporate different colours for diferent damage elements and the like. I'm very happy with the results.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому +1

      You can even combine it with custom fonts to make it crazier ua-cam.com/video/nBcP7FaDPE0/v-deo.html

    • @KrazyKain
      @KrazyKain 4 роки тому +1

      @@CodeMonkeyUnity haha nooo, why would you do this to me? I'm trying to stay focused on my development goals, I can't fall down a tangent... but it does look like it could be useful... I should probably watch it....

  • @JoseORosario
    @JoseORosario 4 роки тому

    This is pure gold, i think this would benefit from the getcustomdir function of yor utilities, maybe some easing on the transition.

  • @YannickGames
    @YannickGames 5 років тому +10

    Thank you for this tutorial, it was very usefull!
    But when I tried to Refference the pfDamagePopUp with the GameAssets Skript I got the ArgumentExeption: "The thing that you want to instantiate is null."
    So I needed to get the refference with a workarround. Any Idea why this happened?
    Because I really like the Idea of the GameAssets Skript to easily acces different refferences

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 років тому +3

      The reference is in the GameAssets script which is attached to a object in the scene, drag the reference on there. That object is a prefab so make sure you update the prefab after you drag the reference.

    • @SoulsElite
      @SoulsElite 4 роки тому +21

      You are missing the "Resources" folder. Put GameAssets prefab in there. it was not explained in this video.

    • @thathurtabit
      @thathurtabit 4 роки тому

      This really confused me too. @SoulsElite kindly pointed out we're missing the Resources folder, but research into Resources points out that it shouldn't be used at all:
      "3.1. Best Practices for the Resources System
      : Don't use it." :(
      From: learn.unity.com/tutorial/assets-resources-and-assetbundles#5c7f8528edbc2a002053b5a7

    • @shao5136
      @shao5136 2 роки тому

      @@SoulsElite thx man

  • @thecaptainFR
    @thecaptainFR 5 років тому +1

    Just discovered your channel ! Quality content very well explained! Continuous like that!

  • @gideongriebenow5815
    @gideongriebenow5815 5 років тому +2

    Thanks for all the great content! I for one appreciate the reasonably fast pace your videos takes - this allows you to quickly go through and understand what gets done, then pause where you need to as you dig deeper. I am a Unity Newbie, although I've been coding (older languages, mostly not object oriented unfortunately) for many years. I am trying to adjust this demo to allow me to create temporary moving icons (images) on the UI - like a gold coin jumping smoothly from one place on the UI to another and then disappearing. I used RectTransform in place of Transform. The image gets created successfully within the UI structure by specifying the parent on the Instantiate call, and simple linear movement from point A to point B within X seconds is working already. I'm now trying to get some interesting "paths" built in, still need to see how I will parameterize the Image to be shown, and I'm struggling to implement the "Destroy()" call without hard-coding the name of the object. any pointers on the Destroy call would be appreciated.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 років тому

      In order to Destroy all you need is a reference to the object so it depends on how you are creating and animating your icons.
      If you're doing a similar pattern in the video where the icon moves itself you can do the same thing Destroy(gameObject);
      If you're spawning them in sort sort of UI Script then that script needs a list of the currently active popups and call Destroy on them when it's time.
      For some interesting paths you can either do like I did in the video and make it code based or you can also create a AnimationClip.

    • @gideongriebenow5815
      @gideongriebenow5815 5 років тому

      Do you have a Patreon or similar page for donations? I didn’t see one on the website.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 років тому

      Don't have a Patreon but if you'd like to support the channel you can pick up the Game Bundle from the website and play my games.

    • @gideongriebenow5815
      @gideongriebenow5815 5 років тому +1

      @@CodeMonkeyUnity Done!

  • @tamizhankeyframe6365
    @tamizhankeyframe6365 5 років тому +3

    I put like first blindly for cz I knw u always give good one 😂😍

  • @indieprogress7170
    @indieprogress7170 5 років тому +8

    Great video and explanation!

  • @KEM4OFFICIAL
    @KEM4OFFICIAL 5 років тому +4

    Well done CM. From a coder perspective nice, but I guess these things mostly are done with animation (moving, disappearing parts). Overall, thanks again for the great work.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 років тому

      Yeah the animation of the popup could certainly be done with a AnimationClip.

  • @neozoid7009
    @neozoid7009 Рік тому

    awesome method CM .. But I am curious that the same effect can be made with the UI Canvas sys ??

  • @FillerWorld
    @FillerWorld 3 роки тому

    Thanks you! It was very helpful for me!

  • @DeathGOD7
    @DeathGOD7 5 років тому +2

    Great for me....learning game dev so doing platformer not straight 3d

    • @indieprogress7170
      @indieprogress7170 5 років тому +1

      If want to do 3D, some of the systems between 2D and 3D are similar. I started learning 3D and a lot of the systems are similar with minor changes to the syntax as it is (x,y) vs. (x,y,z)

    • @DeathGOD7
      @DeathGOD7 5 років тому

      @@indieprogress7170 yeah

  • @truongvantam4994
    @truongvantam4994 6 місяців тому

    I am facing issue that My popup is called to Hierarchy but it is hidden whether in 2d or 3d view of the scene window

  • @dpg8409
    @dpg8409 5 років тому +3

    Bro your chanel is like a holy grail for me

  • @castlecodersltd
    @castlecodersltd 2 роки тому

    Another great video. Thanks

  • @mayankbhaisora2699
    @mayankbhaisora2699 2 роки тому +1

    If someone having Text not showing or disappearing after damage popup is spawned, this might help -
    “If you are using a mixture of normal TextMeshPro objects and TextMeshProUGUI objects which happen to share the same material preset, this can produce this behavior as the MeshRenderer and CanvasRenderer systems are fighting over the ZTest on these objects.
    Solution: If that is the case, the solution is to have a set of Material Presets for the normal text objects which are in worldspace and another set for the objects using the canvas system”

  • @JadenJin
    @JadenJin 4 роки тому +7

    It gives me an error with the gameasset one

    • @christopherlegg6200
      @christopherlegg6200 Рік тому

      Create a folder names Resources, put your prefab named GameAssets in that folder

  • @theskeleton8666
    @theskeleton8666 5 років тому +1

    I find this very useful thx 👌

  • @linuxe93
    @linuxe93 4 роки тому +3

    Very good turorial! I, however, think that the sortingOrder solution should be re-thinked. You will eventually (even though it might take a while) run into an integer overflow exception

    • @Fearofthemonster
      @Fearofthemonster Рік тому

      Not a big deal. At some point a single group would be have wrong sorting order but it would fix itself.
      However if you are concerned you can set it to 0 when there is no shown damage

  • @rethateadmiragacha4849
    @rethateadmiragacha4849 5 років тому +6

    In my case when I was following the tutorial step by step, I had to set 'disappearTimer' variable this way:
    private static float disappearTimer;
    instead of 'non static'.
    Without being 'static', that variable was set to 1f in the first frame, and then suddenly to 0 in the second frame, then to 1f in the next one, and so on.

  • @micaiahstevens8840
    @micaiahstevens8840 5 років тому +2

    NICE zoom in on the text! (Make its snap and easier to see in Visual Studio)

  • @Nazgul
    @Nazgul 4 роки тому +1

    Ppl trying to follow your guide but the speed is crazy and valuable step could be missed even using pauses

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      Dont worry about having to pause. Your goal should be to learn so don't worry if it takes you a while to follow the video, just make sure you understand it.

    • @Nazgul
      @Nazgul 4 роки тому

      @@CodeMonkeyUnity Well, I got your point about implementation this (thanks for good explanation!) however I was curious what TextMesh settings you use to get such text design.. and it was not easy because of the speed :(

  • @Jonman7502
    @Jonman7502 2 роки тому +1

    Everything seems to work fine EXCEPT getting the score to be where the mouse position is. I am in 3D and it doesnt seem to track its position. I have used the util.class and im not getting anything. Any ideas why this could be?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +1

      How are you getting the mouse position? It's a different method in 3D ua-cam.com/video/0jTPKz3ga4w/v-deo.html

  • @exmarxgames
    @exmarxgames 4 роки тому +4

    I keep getting a null error due to the Game Assets, I have tried make sure everything is like how yours is but I still get the nullpointer exception, help please!

    • @magictimm4090
      @magictimm4090 4 роки тому

      I have the same Problem. Codemonkey can you reupload the project?

    • @exmarxgames
      @exmarxgames 4 роки тому +10

      MagicTimm I figured it out, you need to create a Resources Folder and then have the GameAssets Game Object within there, he was trying to call the folder Resources to load the GameAsset object.

    • @magictimm4090
      @magictimm4090 4 роки тому

      @@exmarxgames Thank you very much !

    • @linshu6141
      @linshu6141 4 роки тому +3

      Also always be sure to type if (_i == null) instead of if (_i = null). That was my problem :D
      Dumb fail xD

    • @brendanr8828
      @brendanr8828 Рік тому

      @@exmarxgames thanks!

  • @brendanr8828
    @brendanr8828 Рік тому

    Nice tutorial! if u can help me, how can I do the same with a objectpool? to improve performance

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  Рік тому +1

      You would just replace the Instantiate(); call with a function to grab an object from a pool, everything else would be the same.

  • @chivalryfutures3666
    @chivalryfutures3666 6 місяців тому

    Thanks so much!

  • @jopastudio
    @jopastudio 3 роки тому

    Very helpful, thanks! :)

  • @322ss
    @322ss 5 років тому +1

    I haven't used TMPro, and based on your video it seems it is possible to use it without a canvas, just have the RectTransform in world space? Pretty neat, and probably more performant than having zillion World Space Canvases... but how about not having Canvas scaler? How would the text be scaling in this case? I understand this is demo, but do you use this approach in your own games? Thank you for the video like always!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 років тому +1

      Yeah I'm still new to using TMPro so not too sure how they're using a RectTransform without a Canvas, I think the RectTransform is simply translating the Width, Height and Pivots into normal Transform coordinates.
      I haven't used TMPro in any of my published games since it has a bunch of issues when dealing with Asian languages, you need to create a atlas for each language and I haven't gotten around to figuring out how to sort that so Battle Royale Tycoon is using a normal TextMesh.
      The text seems to be scaling solely based on the Main Camera so it works just fine like a normal TextMesh.

  • @kita0731
    @kita0731 8 місяців тому

    I wonder which video discusses the script for the game asset.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  8 місяців тому +1

      The GameAsset class? It's basically just a singleton, I covered it a long time ago unitycodemonkey.com/video.php?v=7GcEW6uwO8E

  • @alexw9309
    @alexw9309 5 років тому +1

    Hi nice Tutorial as always. Is there a Tutorial where u build the blood effect? I know there is one for the blood trail, but there u use the finished effect. Im asking more for the blood particle effect itself?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 років тому +1

      Haven't managed to do a video on that yet, it's on my list.
      Essentially there's a giant mesh and every blood particle is a quad in that mesh that moves and then stops.

  • @tombradmore6253
    @tombradmore6253 3 роки тому +1

    Hi. I have an issue with the opacity fading. The floating text moves up fine, however, it goes to transparent instantly and doesn't fade slowly. I have copied your code step for step. Any ideas?

    • @tombradmore6253
      @tombradmore6253 3 роки тому +2

      Solved this by initialising the "textColor = textMesh.color;"
      and "disappeartimer = 1f" in the Start function

  • @RedstoneHair
    @RedstoneHair 4 роки тому +1

    Should also make a tutorial on a tutorial dialogue, where some text teaches the player to navigate through menus

  • @ovs_cosplay
    @ovs_cosplay 4 роки тому +1

    This video is great! Helped me a lot!
    Is someone have the link to the video explaining more about the GameAssets class ?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      Its here ua-cam.com/video/7GcEW6uwO8E/v-deo.html

    • @ovs_cosplay
      @ovs_cosplay 4 роки тому

      Thanks !! You are the best ♥️

    • @TehBunnieh
      @TehBunnieh 3 роки тому

      @@CodeMonkeyUnity Thanks I was looking for this as well

  • @freecode.ai-
    @freecode.ai- 4 роки тому

    I dont have sorting layer under extra settings.. When it shows up its behind everything. Mine says geometry sorting but it doesnt show my sorting layers to choose from, any idea why?
    Thanks for the videos!

    • @freecode.ai-
      @freecode.ai- 4 роки тому

      Oops I was using text mesh pro UI

  • @flowfrog101
    @flowfrog101 3 роки тому +1

    I cant find the video where you explain the game assets singelton!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 роки тому

      I made it here ua-cam.com/video/7GcEW6uwO8E/v-deo.html

  • @TheLunarah
    @TheLunarah Рік тому

    Thank you!

  • @SolidMotionVFX
    @SolidMotionVFX 3 роки тому +1

    No doubt one of the BEST unity teachers. Love it. Code monkey is the # 1 place to to..
    I have a question. I followed the tutorial and even downloaded the project files to ensure I got every line correct. I do not have a enemy handler so I tried to use it with my own enemy script. Can you please show or explain how to set this up with an very simple enemy script?? I take damage when my bullets hit me, so I tried to put the code in there, I get error messages for the damage amount?? Please advice

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 роки тому

      What error messages? You just need to call the DamagePopup.Create(); function

  • @themirlabs
    @themirlabs 5 років тому

    Sorry about asking questions on an old vid. im just curious as to why you would make the text pop up a serialized private transform and not a public game object? is there a reason im not seeing?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 років тому +1

      If your variable is meant to be used only in a single class and not accessed from anywhere else then it should be private.
      In order to keep your code clean but also allow dragging references in the Editor you can make it serializable.
      public is essentially saying "this variable can be modified by any class anywhere" whereas private means "this variable is used in this class and this class alone, no need to worry about other classes modifying it"

  • @christopherlegg6200
    @christopherlegg6200 Рік тому

    Is there any reason to return damagePopUp in the DamagePopUp script instead of just returning null? Love the videos by the way!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  Рік тому +1

      On what function? The Create function does return the DamagePopup

    • @christopherlegg6200
      @christopherlegg6200 Рік тому

      ​@@CodeMonkeyUnity at 6:25 in the Create function

  • @tughloksiddiquee1714
    @tughloksiddiquee1714 Рік тому

    I wanted to do something like when the enemy is damaged it will show the damage popup as usual
    however if the enemy get's the same amount of damage in rapid succession then it will reset the disappearTimer and print the damage followed by x and the amount.
    For example: if enemy gets hit 30 times very fast for 2.5 damage it will print 2.5 x30.
    Really want to know how to do this, can you make an updated tutorial if you are feeling up for it?

  • @elcamp3
    @elcamp3 4 роки тому +1

    Not sure why, but when I finished up the 'Create' function, and I tried to do the damage testing, the pop-up failed to show up. I followed your instructions, but it just doesn't pop up.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      Does anything show up? Make sure you're not instantiating a null object.
      Pause the scene and look at the hierarchy, maybe you're spawning objects with a weird Z position.

    • @elcamp3
      @elcamp3 4 роки тому +1

      @@CodeMonkeyUnity Nothing shows up at all. I also reset it to 0,0,0 and it doesn't pop up. Everything else before creating the 'Create' function worked the same as yours did.

  • @MarkTheMadMan
    @MarkTheMadMan 4 роки тому +1

    Iam really struggling with the "GameAssets" class. I made it exactly how you did in this video but i just get an error "An object reference is required for the non-static field, method or property "DamagePopup.Create(Vector3, int)"

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      Sounds like you didn't make the Create(); function static

    • @SoulsElite
      @SoulsElite 4 роки тому +4

      You are missing the "Resources" folder. Put GameAssets prefab in there. it was not explained in this video. Had the same problem.

    • @MarkTheMadMan
      @MarkTheMadMan 4 роки тому

      @@SoulsElite Yes i watched his previous video and it fixed it all, thanks!

  • @snaxmiller
    @snaxmiller Рік тому

    Hey CodeMonkey! Have your opinions on prefix files based on type changed over the years?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  Рік тому

      In terms of using the "pf" prefix, nowadays I normally just add "prefab" to the end of the variable name.
      I started doing that because when people other than me are following a tutorial they might be confused as to what "pf" stands for so to avoid any confusion in the videos I just decided to switch that.

  • @Foxus_lol
    @Foxus_lol 4 роки тому +1

    Hello, I am getting an error in update function, especially in this line : textMesh.color = textColor; you are implementing this at 10:50, the script is working and everything is all right, however I am getting 60 error messages per second in console saying : NullReferenceException: Object reference not set to an instance of an object. Could you help me fix this please ?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      Sounds like you have your textMesh set to null, add some Debug.Log(); to find where it should have been set.
      Also in your console click the button that says Error Pause so your game pauses when you get an error

    • @Foxus_lol
      @Foxus_lol 4 роки тому

      @@CodeMonkeyUnity Ok I fixed it, problem was that my gameobject which was holding the script didnt contained TextMeshPro component.

  • @SoapBoy__
    @SoapBoy__ 4 місяці тому

    Would you ever redo this tutorial in 3D space? This one doesn't translate well due to the fact that gameobjects are of different sizes so at further ranges you just can't read them

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 місяці тому

      You could calculate the distance from the camera to the visual and use that to modify the transform.localScale

  • @PotatoJim
    @PotatoJim 3 роки тому

    I'm kinda stuck. I have the exact same scripts and I keep getting: CS0246: The type or namespace name 'TextMeshPro' could not be found (are you missing a using directive or an assembly reference?)

    • @PotatoJim
      @PotatoJim 3 роки тому

      I didn't have the library lol ... I missed the "using TMPro;"

  • @jasonkane7231
    @jasonkane7231 3 роки тому

    The text is just not visible in my project, any idea what could it be? I have it set as the highest layer and it's visible in the Scene view, but not in the game view.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 роки тому

      Check the Z position, it might be behind the camera, make sure it's on Z = 0

  • @mrbananaman8032
    @mrbananaman8032 4 роки тому +1

    How did you get the text to draw without a canvas?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому +3

      It's a World Text object, not UI Text, those are different classes

    • @mrbananaman8032
      @mrbananaman8032 4 роки тому

      @@CodeMonkeyUnity ahh ok, thank you!

  • @lhorbrum1818
    @lhorbrum1818 5 років тому

    Amazing! Thank you!

  • @hegemon3
    @hegemon3 3 роки тому

    Why do you use Transform for pfDamagePopUp instead of GameObject? We instantiate game objects and transform is just one of its components. Why does it work?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 роки тому +1

      GameObjects and Transforms are pretty interchangeable because very Game Object has to have a Transform and every Transform has to be attached to a Game Object.
      So since you cannot have one without the other, instantiating a Transform or a Game Object does the same thing, the difference is just the return type on Instantiate();

  • @MARUTI96
    @MARUTI96 4 роки тому

    Thank u for the video

  • @D-And-A221
    @D-And-A221 2 роки тому

    Hi, how to use this code if i use Canvas? Because if i trying use ur code its spawm, but spawn not inside canvas, so in that case i cant see any text, how to fix that?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому

      Use TextMeshPro and not TextMeshProUGUI. The first one is a world component, not a canvas component.
      If you absolutely need a Canvas then you can always use a World space Canvas and spawn that along with the popup ua-cam.com/video/Zwgj3mwOVlg/v-deo.html

    • @D-And-A221
      @D-And-A221 2 роки тому

      @@CodeMonkeyUnity i tried do it to swap i canvas for world space, but it dosent help, text spawn not inside camera, not inside canvas

  • @mrezaperdana
    @mrezaperdana 5 років тому +2

    hey i wonder how you know wich code to use at wich situation? like how to learn/ what where to read the materials

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 років тому +1

      It's all about experience, I've been writing code for 20 years and with Unity for 6 years so when I think up a system I already know what elements I'm going to need to make it work.
      In this case I knew I could instantiate a prefab on top of the Enemy, change the colors of the TextMeshPro component and modify it's position and scale, then it's just the matter of implementing it.
      The only trick is to keep writing code and making things, the more you write the easier it gets.

  • @y01cu_yt
    @y01cu_yt 2 роки тому

    Thanks!

  • @davdev793
    @davdev793 4 роки тому

    Pretty Nice! I've done a popup too in a 3d enviroment. My solution to have it over everything else was to have it's canvas in world space and 2 cams. One for the pop ups and the other for the game itself. Thing is the new URP dosent support camera stacking anymore. Any clean workaround? Had some folks telling to write a post process for this but feels like a overkill. Thanks in advance.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому +1

      Camera Stacking has been added in the latest update!
      Possible workaround would be something using RenderTextures

    • @davdev793
      @davdev793 4 роки тому

      @@CodeMonkeyUnity oh you're right! Sadly I still can't have alpha to work on my popup camera anymore and it makes everything blue besides the numbers. Will check out RenderTextures. Thanks alot!

    • @davdev793
      @davdev793 4 роки тому

      It was actually a bug in the version i was using that the Alpha in the Solid color background in the camera settings wasnt working. Updated it and it's working fine now. Thanks again for the response !

  • @user-st4ce6sb2x
    @user-st4ce6sb2x 2 роки тому

    Is it better to do the effects in code or with animations?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому

      Depends what you mean by "better", using an animation might be easier to manage and iterate on the animation

  • @jaimieself4230
    @jaimieself4230 4 роки тому

    Would it not be best to use object pooling as you are going to have a lot of numbers appearing and disappearing over the course of a game?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому +1

      Yes if you're going to implement this effect in a game with lots of shooting you should probably use object pooling.

    • @jaimieself4230
      @jaimieself4230 4 роки тому

      @@CodeMonkeyUnity Ok thanks

  • @mechtarin
    @mechtarin 3 роки тому

    can we use animations for effects

  • @carystalker1501
    @carystalker1501 5 років тому

    no matter how I follow your example I always get 'The Object you want to instantiate is null.' always around gameasset class. do you have any idea why? I followed the example directly.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 років тому

      The GameAssets class is placed on a GameObject on the scene and has a bunch of public fields, drag whatever reference is missing on there.

    • @SoulsElite
      @SoulsElite 4 роки тому +2

      You are missing the "Resources" folder. Put GameAssets prefab in there. it was not explained in this video.

  • @buho2676
    @buho2676 5 років тому

    I have this error: ArgumentException: The Object you want to instantiate is null. When I try to Instanciate the textMeshPro object. Any idea? very thanks!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 років тому +1

      Make sure the prefab you are trying to instantiate is correctly referenced. Are you trying to instantiate something from a Serialized Field? If so make sure there's a reference in the script field in the editor.

    • @buho2676
      @buho2676 5 років тому

      @@CodeMonkeyUnity I had not created the resource folder xD. I'm very noob. Very thanks !!!

  • @mehmeh8883
    @mehmeh8883 5 років тому

    I want to have similar type of popup text which says "HIT" on first bullet hit and "HIT X 2" on second hit how to do that?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 років тому +1

      The popup is using a TextMesh so you can easily swap out damage numbers for text

  • @superking9945
    @superking9945 5 років тому +2

    There are lots of tutorials to make like for 2d top down shooter rpg like game
    Shooting, enemy ai,damagable blocks, gun reload system, gun swap system etc.
    There are lots of tutorials to make
    Can you make any one of them plz?

  • @xobscenityx
    @xobscenityx 4 роки тому

    How are you doing this without a canvas? Isn't a canvas required? I tried you technique and the text is invisible, nothing shows.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      I'm using the Mesh based Text Mesh Pro component, not the UI one.

  • @Singy7
    @Singy7 3 роки тому

    I've been having real problems with the singleton GameAssets Class,
    Resources.Load... would always return null, no matter what I tried came up with this workaround
    get
    {
    var result = Resources.LoadAll("");
    if (_i == null){
    _i = new GameAssets();
    _i.pfDamagePopup = Instantiate(result[0].transform);
    }
    return _i;
    }
    any idea why I couldn't get the original "automatic" solution working?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 роки тому +1

      The field inside the Resources.Load(); parameter needs to match exactly the object name. And it needs to be inside a folder named exactly "Resources"

  • @themichaelscott
    @themichaelscott Рік тому

    Did anyone have a problem with this rendering on the Scene tab, but not on the Game/Simulator tab? I'm doing a 2D non-scroller for mobile. Canvas is 1920 x 1080 and my Main Camera is positioned at the bottom left-hand corner 0,0 as recommended by some other tutorials. Instead of emitting the damage from enemies, I have a button that I'd like have emit the text popups when clicked. The pop-ups show in the Scene tab, but not in the game tab. I had the prefab done in 20-30 mins and I've then spent 6+ hours trying to figure out what I've done wrong. Thoughts? Long time developer and android dev for a few years, but I'm new to Unity.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  Рік тому +1

      It shows up in Scene view but not game view? Perhaps it is spawning behind the camera? Check the Z position
      Or perhaps it's spawning on a certain Layer that is not being rendered by the main camera

    • @themichaelscott
      @themichaelscott Рік тому

      @@CodeMonkeyUnity Thanks for the reply! I found out that, as I was instantiating the prefab, I needed to assign it to a parent that was already on the canvas. Great video. You have me as a subscriber now.

  • @GeorgePerdikeas
    @GeorgePerdikeas Рік тому

    thanks a lot for the nice video but sometimes you move mouse way too fast, that makes me rewind and slow down the speed just to see what you are doing. A good example is when you create a new sorting layer , in 07:14 - 07:19

  • @doityourself7153
    @doityourself7153 Рік тому

    I can not find the video with the game assets c# script, could you link it?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  Рік тому

      The static reference? It's this one unitycodemonkey.com/video.php?v=7GcEW6uwO8E

  • @hegemon3
    @hegemon3 3 роки тому

    I can see TMPro in the Scene, but not in my Game view. I checked the layers, Z axis, position, viewed it in 3d to confirm it is in the front, not hidden behind any object. I don't use any other TMPro UI object, I don't have Canvas, so nothing should interfere here. Yet it does not show in the Game view. Any ideas?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 роки тому

      Did you check the Sorting Order and Sorting Layer? I'm assuming your scene is in 2D so those are the fields that matter, not the Z position.
      The background might have a higher Sorting Order and being rendered above the popup.
      Other than that, just make sure the Z is in front of the camera so its not being rendered behind it. Usually Z = 0

    • @hegemon3
      @hegemon3 3 роки тому

      @@CodeMonkeyUnity I figured it out finally. I was confused because none of the components had sorting layer, but default sorting layer was in fact being used by renderer. The text appeared once I changed sorting layer in my script. This should be in the inspector! Thank you

  • @DeathGOD7
    @DeathGOD7 5 років тому +1

    and how to use Code Monkey Utilities? just import and voila?
    can i make it permanent like using System;?? so i dont have to do for each project?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 років тому +1

      When you import them you get a new Folder in your Project Files.
      You can then use the full name like CodeMoney.Utils.FunctionTimer.Create();
      Or add using CodeMonkey.Utils; at the top then just FunctionTimer.Create();
      The utilities include all the source code so check that out.

  • @anthonypoff7815
    @anthonypoff7815 2 роки тому

    Welp, trying to figure out the whole resources thing ended up screwing my project's directory so that's great

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому

      How so? You just create a folder anywhere called Resources, that's all

  • @rethateadmiragacha4849
    @rethateadmiragacha4849 5 років тому

    After downloading project files + utilities, new project in 2018.3.11f1 version, packages imported, press Play, and I just see huge sprites, and basically nothing work as expected.
    Some errors are shown:
    The referenced script on this Behaviour (Game Object 'Btn') is missing!
    The referenced script on this Behaviour (Game Object 'Clickthrough') is missing!
    The same happens with other tutorials, am I missing any step? Thank you.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 років тому

      I just imported the package into a completely empty project and everything worked fine.
      There are some warnings since apparently I still had some UI objects from a previous tutorial but the scene still works.
      What exactly do you see? Do you get any errors in the console or just the warnings? Does anything move in the screen?

    • @rethateadmiragacha4849
      @rethateadmiragacha4849 5 років тому

      @@CodeMonkeyUnity ​ @Code Monkey Hi, check this video: ua-cam.com/video/gqQSh7bvk-0/v-deo.html Here you will see what I see when I create a new 2D project (release 2018.3.11f) and the package is imported, scene "Gamescene_Damagepopup" is loaded, and button 'Play' is pressed. Hope it helps. Sorry for the resolution. If you need further details, just let me know.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 років тому

      Hmmm what country are you from? I think I know what the issue might be.
      I've just updated the package on the website, please download it again and try it out.

    • @rethateadmiragacha4849
      @rethateadmiragacha4849 5 років тому

      @@CodeMonkeyUnity I'm from Spain (I'm a computer scientist by the way) and I hope this fact has nothing to do with these errors :-)
      Now it's working fine. Still a minor issue: in the 'Background' gameobject, Sprite -> Missing (sprite), so no background is displayed, only black solid color from main camera. Thank you for the corrections!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 років тому +1

      The background texture isn't included since I didn't make it, its a free texture from the Asset Store and I don't have a license to be able to distribute it.So the animations are working fine now? If so then the issue is related to how different countries use different symbols for floating points. Some countries use a Dot . and some use a Comma ,
      It's a simple fix and something that is fixed in my own games but for these packages I forgot to add the fix directly to the animation system.
      Thanks for letting me know!

  • @Mikelica69
    @Mikelica69 3 роки тому

    Thanks!!!

  • @zekiozdemir420
    @zekiozdemir420 3 роки тому

    thank you

  • @xeonviento9778
    @xeonviento9778 5 років тому +2

    Would love to see a tutorial on how to do some of the effects applied in JuiceFX programmatically in Unity.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 років тому +2

      Wasn't familiar with JuiceFX but upon seeing the videos it seems like a really cool program.
      Those types of animations are certainly great for adding juice to your game. I'll look into it, thanks!

  • @codegnatstudios
    @codegnatstudios 5 років тому

    Just a question: can you use GameObject instead of Transform? Thanks.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 років тому +1

      Sure, every Transform has a GameObject and every GameObject has a Transform.

  • @frontend_ko
    @frontend_ko 15 днів тому

    nice video

  • @lordtri507
    @lordtri507 2 роки тому

    doesn't work not matter what I tried... maybe I've done something wrong... keeps getting Error: The Object you want to instantiate is null

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому

      You are calling Instantiate(); and passing in null as a parameter. Check where you're getting that parameter from, use Debug.Log to find what is null ua-cam.com/video/5irv30-bTJw/v-deo.html

  • @halivudestevez2
    @halivudestevez2 2 роки тому

    so you can have a Text without canvas? am I right?

    • @halivudestevez2
      @halivudestevez2 2 роки тому

      You add it as a component to an empty ... ok, managed to figure it out.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +1

      Canvas is only needed for UI objects, if you use World Text, you don't need a canvas, if you want to use UI Text you do need a Canvas ua-cam.com/video/Zwgj3mwOVlg/v-deo.html

  • @marularch
    @marularch 5 років тому +1

    I was really excited to find your channel but this is really hard to follow. I first needed to find how to import the packages, then I needed to figure out finding the same scene you used and then when I finally wanted to see what you're doing you're lightning fast. I can't even see what you're doing with the Unity Interface, this needs to be watched at 0.5x speed.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 років тому

      Do you mean when setting up the text object? I sped it up because the specific settings of the text object aren't really relevant to creating the popups.
      Your game probably has a different style than what is shown in the video so the look of the popups will be dependent on what you're using it for.

  • @cmdrhawkangel4616
    @cmdrhawkangel4616 10 місяців тому

    Unfortunately this doesn't work if you are on a smaller scale game because you get grey boxes around all the characters :(

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  10 місяців тому

      What grey boxes? Sounds like either your font size is too big or you just have no font assigned so you're just seeing empty quads. This element, like any element, can be scaled up or down

  • @halivudestevez2
    @halivudestevez2 2 роки тому +1

    I cannot type that quickly....

  • @Forjugadname
    @Forjugadname 4 роки тому

    I presume this only works for 2D as I cant get it to work in 3D, the sorting order doesn't work at all to keep the text on top.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      For 3D you need to rotate it to face the camera, sortingOrder doesn't work in 3D, it's all based on Depth.

  • @y01cu_yt
    @y01cu_yt 2 роки тому

    If you couldn't spawn the text where you click and you're in 3D project, try changing it into 2D one.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +1

      If you're wondering about how to get the mouse position it's a different method in 2D and 3D unitycodemonkey.com/video.php?v=0jTPKz3ga4w

  • @ToxicNinja777
    @ToxicNinja777 4 роки тому

    What would the code be to be able to make the prefab spawn on top of my background?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 роки тому

      Sorting in a 2D game is based on the Sorting Layer and Sorting Order

  • @codingidiot6754
    @codingidiot6754 2 роки тому

    Not sure why but all my text just becomes invisible. It's there, but its invisible.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому

      Check the Sorting Layer, Sorting Order and Z position ua-cam.com/video/5_BwFB-1dAo/v-deo.html

  • @joshratcliff5383
    @joshratcliff5383 3 роки тому

    I followed until you actually implemented it on the aim handler script. I don't know how you created the GetPosition() function and passed it on .