Get Started with Custom Unity Packages (Step by Step)

Ойындар

Learn how to package your custom code in a modular, version controlled way with Unity Custom Packages, that include Dependency management! Understand the difference between a basic unity packaged Asset and a Custom Unity Package. Today we're taking our Improved Timers code from the previous video and packaging it to share with the community!
FEATURED TOOL:
Smart Editor Tool: assetstore.unity.com/packages...
Jon Skeet on Stack Overflow:
stackoverflow.com/users/22656...
Want to support me? 😀
Buy me a coffee! ko-fi.com/adammyhre
🔔 Subscribe for more Unity Tutorials / @git-amend
Discord: / discord
#unity3d #gamedev #indiedev
▬ Contents of this video ▬▬▬▬▬▬▬▬▬▬
0:00 Two Types of Packages
3:10 Custom Unity Packages
7:20 Assembly Definitions
9:40 Manifest
14:46 Local Packages
Source code: github.com/adammyhre/Unity-Im...
More Useful Code:
github.com/adammyhre?tab=repo...
Unity Utility Library: github.com/adammyhre/Unity-Utils
Lock Inspector Hotkey: gist.github.com/adammyhre/475...
Assets Shown In This Video (Affiliate Links)
Procedural Progress Bar: assetstore.unity.com/packages...
Dungeon Mason Tiny Hero Duo: (FREE): assetstore.unity.com/packages...
Tiny Heroes: assetstore.unity.com/packages...
Tidal Flask Dungeon Pack: assetstore.unity.com/packages...
Hierarchy Icons: assetstore.unity.com/packages...
Better Transform: assetstore.unity.com/packages...
Better Mesh Filter: assetstore.unity.com/packages...
Kyeoms VFX: assetstore.unity.com/publishe...
Follow me!
linktr.ee/gitamend

Пікірлер: 98

  • @git-amend
    @git-amendАй бұрын

    Happy Sunday once again! I hope this video helps demystify making custom packages - please post any follow up questions you might have or comments you'd like to share! And of course, please make use of the Improved Timers package in your own projects if you want! 👍

  • @zORg_alex

    @zORg_alex

    Ай бұрын

    I use my custom packages in private git repos for licensed assets that are cumbersome to import and cannot be shared in public repo. So anybody cloning that repo will see that it has private dependency and the name of that asset.

  • @damonfedorick

    @damonfedorick

    Ай бұрын

    i use git desktop, seems to do the job and all in a UI system.

  • @dustintaub
    @dustintaubАй бұрын

    This has become the best Unity learning channel on KZread. There are dozens of tutorials on the basics but this is the only channel with actionable, advanced topics every week. Keep it up!!

  • @git-amend

    @git-amend

    Ай бұрын

    Thanks for the kind words! Lots more to come!

  • @zyxpip8363
    @zyxpip8363Ай бұрын

    The "Quick Recap" part near the end of the video is definitely a great addition to the video format It's quick & subtle, but totally needed

  • @git-amend

    @git-amend

    Ай бұрын

    Yeah, I'm glad I included that. Will probably continue that in the future!

  • @Fitz0fury
    @Fitz0furyАй бұрын

    This is 100% getting used today. A lot of my game is sitting in about 5 different projects I have been merging. This is gold for me.

  • @git-amend

    @git-amend

    Ай бұрын

    Awesome, let me know how it works out for you.

  • @Patricebrouh
    @PatricebrouhАй бұрын

    We are Lucky to have you

  • @git-amend

    @git-amend

    Ай бұрын

    Thank you

  • @GameDragon2k
    @GameDragon2kАй бұрын

    The biggest take away I got from this, is that Rider has an interface for editing markdown files, and I've been using Notepad all this time. Holy shit.

  • @git-amend

    @git-amend

    Ай бұрын

    Haha! Nice isn’t it! I actually discovered that by accident myself a while ago.

  • @stephanedurette5785
    @stephanedurette578528 күн бұрын

    you have the highest quality unity tutorials I've seen on KZread for a long time. Thanks a bunch!

  • @git-amend

    @git-amend

    28 күн бұрын

    Wow, thanks! Glad you think so! You're welcome.

  • @user-rm2pj9jf8s
    @user-rm2pj9jf8sАй бұрын

    It was the easiest to understand than any of the Unity 'modular' lectures I learned. Now I can make my codes into Assets!

  • @git-amend

    @git-amend

    Ай бұрын

    Great! Glad to hear that!

  • @user-rm2pj9jf8s

    @user-rm2pj9jf8s

    Ай бұрын

    @@git-amend I've learned so much from the community you've created, the lectures you've created. You're a giant who shows me the horizon of that far sea through your shoulders. Thank you always.

  • @MarushiaDark316
    @MarushiaDark316Ай бұрын

    "We're gonna rewrite history with a git-amend." I see what you did there. :U

  • @git-amend

    @git-amend

    Ай бұрын

    Hahah.. wasn't intentional, I swear!

  • @radiantgames55
    @radiantgames5512 күн бұрын

    This is hands down the best channel if you wanna learn advanced unity stuff!

  • @git-amend

    @git-amend

    12 күн бұрын

    Thank you!

  • @SanderDecleer
    @SanderDecleerАй бұрын

    Awesome video on a great topic. The only thing I would add is that you can start creating your package in a 'Packages' folder, adjacent to the 'Assets' folder. This way you can check how the package works without moving it to another project while still keeping it inside of your project during development.

  • @git-amend

    @git-amend

    Ай бұрын

    Great tip! Thanks for sharing that!

  • @user-tf1gz7mm1n
    @user-tf1gz7mm1nАй бұрын

    Thank you for these videos!! They've been so helpful and motivating. Every time you surprise me with a topic, I wanted to learn more about. Again, great video! Keep it up

  • @git-amend

    @git-amend

    Ай бұрын

    You are so welcome!

  • @fleity
    @fleityАй бұрын

    Very nice video, great overview. There is one thing I missed in the video. Embedded packages. Usually packages are saved in the library package cache folder but they can be moved to project/packages which gives you write access to them (instead of being read only in the cache folder). Of course updates can overwrite your changes so be careful. But that can be hugely useful if you want to modify stuff AND you can actively develop on that package while having unity treat it as a package in the context of the project.

  • @git-amend

    @git-amend

    Ай бұрын

    Thanks for the comment. We might cover a few more things that are beyond introduction level in a future video, that's a good thing to point out. Cheers!

  • @TChrisBaker
    @TChrisBakerАй бұрын

    I always wondered how to do this and I got it working right away. Thank you !

  • @git-amend

    @git-amend

    Ай бұрын

    Nice, that's what I like to hear!

  • @RafaelAzriaiev-kv9qm
    @RafaelAzriaiev-kv9qmАй бұрын

    Great was looking forward for your video, great topic

  • @git-amend

    @git-amend

    Ай бұрын

    Awesome, hope it helps you out!

  • @005Racot500
    @005Racot500Ай бұрын

    Thanks for the video. Would be nice to listen about dependencies from another package in git or local, how to resolve circular dependency of packages, and a few words about UPM. Also if you use local packages in a team remotely, you required to has them in same path or shared drive.

  • @git-amend

    @git-amend

    Ай бұрын

    All great topics - perhaps in a future video.

  • @techdave99
    @techdave99Ай бұрын

    Thanks for the video. It helped understand packages a little better.

  • @git-amend

    @git-amend

    Ай бұрын

    Glad it was helpful!

  • @rohanvishayal8724
    @rohanvishayal8724Ай бұрын

    Great Video! Thank you for sharing. Lots to learn :)

  • @git-amend

    @git-amend

    Ай бұрын

    Glad you enjoyed it!

  • @NathanSL11
    @NathanSL11Ай бұрын

    Great video as always! Another big gotcha with the UPM is that it cannot currently resolve git dependencies in the package.json only the project manifest. Hopefully they add that feature someday.

  • @git-amend

    @git-amend

    Ай бұрын

    Thanks. Yes, I hope so too - that would be fantastic.

  • @Johan-rm6ec
    @Johan-rm6ecАй бұрын

    Dude you rock keep them vids coming!!!!

  • @git-amend

    @git-amend

    Ай бұрын

    Thanks!

  • @connorjagielski6760
    @connorjagielski6760Ай бұрын

    I always thought this was some sort of black magic that only asset store devs knew. Thanks for sharing!

  • @git-amend

    @git-amend

    Ай бұрын

    You're welcome. Publishing on the Store is actually easier than most people think, maybe we'll cover that in a future video.

  • @mracipayam
    @mracipayam29 күн бұрын

    Thanks for helpful video

  • @git-amend

    @git-amend

    29 күн бұрын

    Most welcome

  • @kpm25
    @kpm25Ай бұрын

    Thanks once again Adam! The least I can do is leave a comment:)

  • @git-amend

    @git-amend

    Ай бұрын

    You rock!

  • @marc8150
    @marc8150Ай бұрын

    Hey Adam, great video and especially useful for my current project :D. I'm curious about your experience as a developer and with Unity in general. Also I've been working through your videos whenever I find one useful for my own projects and as a Junior some videos literally took me days to fully understand and iterate on, how long does it actually take you to produce a video and how do you design the code? Because that in general is something we as viewer don't get to see and I always wonder how much time it must've took you to come with the solution we get to see. Maybe that would even be a good video idea. One dedicated solely on how to build and design unity systems (which would probably become a series of videos because of the complexity^^)

  • @git-amend

    @git-amend

    Ай бұрын

    That's a very interesting question! To be honest, it depends on the topic. If it's a topic I'm very familiar with, the amount of research will be low and I'll dogfood a prototype in an hour. I try to start early in the week, so I can iterate on the video idea a few times in the evenings if I have to. The actual recording of a video is the longest part, because recording, audio and video editing are areas I can stand to improve upon - so that takes roughly 8-12 hours on Saturday with breaks here and there. Luckily the subject of the video - code or otherwise - will already be prepared before that, plus I seem to enjoy creating the videos as much as I like programming, so time flies. I agree that systems design and thinking are skills that could be taught here, and we'll get to that too!

  • @marc8150

    @marc8150

    Ай бұрын

    @@git-amend Awesome, sounds good! Thanks for the detailed answer and I think system design will be the perfect addition to your design pattern videos. If those videos regarding system design will be just as good as your design pattern videos I honestly think you're literally the ultimate resource for advanced Unity developers

  • @aaatthh
    @aaatthhАй бұрын

    Thanks for amazing videos, they are priceless, I watch them multiple times so I can fully inject them into my workflow, I really enjoy them, and they make learning these topics enjoyable. By the way I have a question: How would you do an audio system/manager? Which pattern would you use? Thank you

  • @git-amend

    @git-amend

    Ай бұрын

    Thank you! The topic of audio management has come up several times. There will be a video about that soon!

  • @ragerungames
    @ragerungamesАй бұрын

    great. i see that you have custom script templates where you selected monobehavior scripts, pretty cool

  • @git-amend

    @git-amend

    Ай бұрын

    I think that is actually just the default in Unity 6 now... I'll have to double check that.

  • @ragerungames

    @ragerungames

    Ай бұрын

    @@git-amend oh if unity 6 then pretty cool and time saviour.. previously it was just available on rider

  • @damonfedorick
    @damonfedorickАй бұрын

    Nice.

  • @damonfedorick

    @damonfedorick

    Ай бұрын

    i ended up figuring this all out myself a few months ago, knowing how to package your assets is a good way to keep your stuff super organized as well sharing anything with your team or friends becomes a lot easier.

  • @git-amend

    @git-amend

    Ай бұрын

    @@damonfedorick Yes, agreed. Thanks for the comment!

  • @techdave99
    @techdave99Ай бұрын

    Watch the ending of the video for a pro tip! Worth watching the whole video. (Don't forget to share the video!)

  • @git-amend

    @git-amend

    Ай бұрын

    Glad you caught that one!

  • @DisturbedOne69
    @DisturbedOne69Ай бұрын

    Is it possible to add the package dependecies to the exported in a usual way package? I'm wondering because my package on the asset store has a dependency on some of the Unity's packages and I am currently just telling to user "Hey, this is not installed and the package relies on it". Just adding a package.json to the root folder didn't seem to do the trick.

  • @git-amend

    @git-amend

    Ай бұрын

    Unfortunately it's not possible to add dependencies to usual way packages or Assets sold on the store. This was a topic a while ago on the Unity forums, but all that came out of that was a suggestion to submit it as an idea for future improvements. I know what you mean though, it's not very user friendly. forum.unity.com/threads/adding-a-dependency-to-an-asset-store-product-in-a-projects-manifest-json.1108304/

  • @DisturbedOne69

    @DisturbedOne69

    Ай бұрын

    @@git-amend It actually is possible. Idk how I've missed this, but using the "Asset Store Publishing Tools", you can optionally include the project manifest and add UPM packages in the uploader window. It's exactly what I wanted, but it wouldn't work for the asset store packages though. Then you can just export the package on your PC without uploading it into the publisher portal, but there is some overhead because you need a publisher profile.

  • @git-amend

    @git-amend

    Ай бұрын

    @@DisturbedOne69 Well that's very interesting, I had no idea. I'll have to look into that. I don't remember ever seeing anything from the Asset Store that included a manifest.

  • @TheKr0ckeR
    @TheKr0ckeRАй бұрын

    Just in time! Thanks a lot! I want to create an extension method library which is using DoTween, Since dotween is a third party asset, what kind of approach should i follow if my package is has dependencies with 3rd assets. As far as i know, we cant create custom packages with 3rd party assets

  • @git-amend

    @git-amend

    Ай бұрын

    Sadly, this is still an outstanding issue that Unity has said they are working on, as well as making independent git repositories dependencies. What most people do is explicitly tell users that they have to install XYZ before installing your custom package.

  • @TheSuzakton
    @TheSuzaktonАй бұрын

    Really nice video and easy to understand. On an other note does your Improved timers still work as expected in a production build after making them a package ? I have a problem with the [InitializeOnLoadMethod] in different assemblies. My method seems to not be called as i launch my game. If you faced this problem and have a solution i would really need some insight :)

  • @git-amend

    @git-amend

    Ай бұрын

    Don't forget that [InitializeOnLoadMeth­od] is Editor only. [RuntimeInitializeOnLoadMethod] is for play mode and builds. The ImprovedTimers package does work in a build by the way, just as expected.

  • @TheSuzakton

    @TheSuzakton

    Ай бұрын

    ​@@git-amend Oh yeah it was [RuntimeInitilizeOnLoadMethod] it was just a typo on my question. Well i try to find why it's not runing on my code. Thanks and keep doing awesome videos :)

  • @BOBROFFNIK.shorts
    @BOBROFFNIK.shortsАй бұрын

    Thanks about mentionin war crimes 🙏

  • @git-amend

    @git-amend

    Ай бұрын

    Yes! We can't have that!

  • @sima19995
    @sima19995Ай бұрын

    Great video! The only setback with packages I've experienced is that if you need to modify any of your own imported packages on the fly you'd have to open the original Unity project to do so. This often leads me copy pasting the files instead. Is there any workaround that you know of?

  • @git-amend

    @git-amend

    Ай бұрын

    This is a common issue, especially when working in teams where each team is developing different parts but they are dependencies. One thing you can do as a small developer is try the git subtree command. This lets you have multiple repositories in the same project.

  • @sima19995

    @sima19995

    Ай бұрын

    @@git-amend Thanks for the info! I'm not an expert at git, after a bit of digging around I don't quite understand how this would work. Would this mean that there is a dummy wrapper parent repo and the sub repo with the actual code would be editable in all projects?

  • @git-amend

    @git-amend

    Ай бұрын

    Using git subtree, you can integrate an external package repository into your main project repository, allowing you to treat the package as part of your project’s codebase. By using commands like git subtree add to include the package and git subtree push to update the package’s upstream repository, you can make and manage changes to the package from within any project that includes it. This approach ensures that updates to the package can be synchronized across multiple projects. Maybe I can try to show this in a video soon since several ppl have asked.

  • @OskGame
    @OskGameАй бұрын

    So every time I edit, I will edit in another project and push it. Is there a way to edit in an existing project and push it to git?

  • @git-amend

    @git-amend

    Ай бұрын

    There is, but it requires a good understanding of git. There is a command that is distributed with many versions of git called git subtree. This lets you have multiple repositories in one project.

  • @tahaaltndag3554
    @tahaaltndag3554Ай бұрын

    Can we add other custom packages as dependencies in package.json? Let's say that my custom package codes are dependent on UniTask how can i overcome this dependency problem?

  • @git-amend

    @git-amend

    Ай бұрын

    Unfortunately not at this time. Unity allows you to add Git packages as dependencies in the Project level Manifest file, but not in the package.json file of an embedded package. I believe this is something they are working on, but don't hold your breath. The general workaround is to install the dependencies first, then the package that relies on them next.

  • @lizkimber
    @lizkimberАй бұрын

    Have you found a way to install from "My assets" eg store bought assets, into projects via code, without importing them as files from the unity cache?

  • @git-amend

    @git-amend

    Ай бұрын

    I have yes, use it all the time. There is some sample code that you can check out here, but maybe we'll cover it more in depth in a future video as well. We covered this briefly in the 3D platformer series, as it evolved over several videos. Take a look here: github.com/adammyhre/3D-Platformer/tree/master/Assets/MyTools

  • @lizkimber

    @lizkimber

    Ай бұрын

    @@git-amend thanks, ive seen so many different things about installing asset store packages, and so far all have failed to work correctly, as yours finds the cache and loads from it - specifically one of the non criteria was not to load from the cache. eg i want it to be the latest version, so to download it if necessary.

  • @TheKr0ckeR
    @TheKr0ckeR11 күн бұрын

    Thank you again, I am back here after some time. My package includes some editor scripting with UI Toolkit. Do you think its available to create a custom package depending on UI Toolkit and unity editor scripts?

  • @git-amend

    @git-amend

    11 күн бұрын

    Yes, with some restrictions. There is pretty good documentation on the Unity site on this page, and it's sub pages. docs.unity3d.com/Manual/upm-manifestPrj.html

  • @TheKr0ckeR

    @TheKr0ckeR

    7 күн бұрын

    @@git-amend Thanks for your time & answer.

  • @nullx2368
    @nullx2368Ай бұрын

    Wait, is there a way to put it on git to have multiple people using it on a private repo?

  • @git-amend

    @git-amend

    Ай бұрын

    Sure, you can invite anyone to collaborate on a private repo on GitHub - this will ensure they have access. In the specific repository, go into Settings > Collaborators.

  • @amitmoryosef2223
    @amitmoryosef2223Ай бұрын

  • @git-amend

    @git-amend

    Ай бұрын

    Thanks for the bump!

  • @atqamz
    @atqamzАй бұрын

    the discord server invitation link is invalid :(

  • @git-amend

    @git-amend

    Ай бұрын

    It is working, please try it again in a bit. Check that you haven't joined the max number of allowed Discords!

  • @adventuretuna
    @adventuretunaАй бұрын

    Be careful putting a Resources folder inside your packages. When someone imports your package, all the files inside the Resources folder in your package will also be part of the project's build regardless if it is being used or not. Spent hours figuring this out trying to hit a 150MB build size limit.

  • @git-amend

    @git-amend

    Ай бұрын

    Wow, I’ve never seen that! Great tip!

  • @Eitrum
    @EitrumАй бұрын

    While custom packages look like a good feature, it's truly a pain to work with in larger projects if you need to change or update the packages to implement a new feature in your game project. It takes a lot of back and forth, swapping out from registry to embedded packages so you can try the features out, then backport it to the package, revert all changes locally, and lastly update the package. Truly awful workflow for the actual game developer that need to build or update the packages to work with their game. And if you think it will be perfect package on first try without having to change or update it, you are indeed wrong most of the time.

  • @sima19995

    @sima19995

    Ай бұрын

    I made a comment of my own regarding this issue before realizing someone else already wrote one. This is the only reason I tend to avoid using packages.

Келесі