Пікірлер
@risingforce9648
@risingforce9648 Ай бұрын
I got another question.. when to use "BindInaccesible(object instance)" or void Bind<T>(T value); (which is the " container.Bind(gameplayUiInstaller);" ?? becuase in the example you supress container.Bind(enemy) ... replaced by container.BindInaccesible(enemy) ?? thanks.
@alchemybow
@alchemybow Ай бұрын
Hey there! In short, here's what they do: `Bind` makes the provided instance a client and a service simultaneously, while `BindInaccessible` only makes it a client. Clients can use the [InjectionTarget] and [Inject] attributes to request dependencies, and services essentially are these dependencies. So, you can use the 'inaccessible' variant to avoid making your modules overly accessible; it also comes in handy, along with dynamic collections and factories, if you need to bind multiple objects of the same type. However, I'm not sure about your example (`container.Bind(gameplayUiInstaller);`). You should only use installers to bind your modules, but never bind themselves, maybe you can provide more context? P.S. The `Bind` method has two overloads: Bind(Type, Object) and Bind<T>(T), both allowing you to specify which type implemented by your instance should be used as a key (the final class, any parent class or implemented interface can be used). You can use it multiple times to associate your object with more than one key. If it's used like this `Bind(yourObject)`, then it's a short form of `Bind<YourObjectType>(yourObject)`. Here’s a link to docs kempnymaciej.github.io/alchemy-core/api/AlchemyBow.Core.IoC.IBindOnlyContainer.html I hope this will help. If you have further questions, let me know.
@risingforce9648
@risingforce9648 Ай бұрын
I got like to know how exactly do " void ICoreLoadingCallbacksHandler.OnCoreLoadingFinished() { enabled = true; } void ICoreLoadingCallbacksHandler.OnCoreSceneChangeStarted() { enabled = false; }" it is "explicit" interface to handle before Updates() monobehaviours? when the class that need to implement this IcoreLoadCallabackHandler is a monobehaiour that becomes the service-client? thanks @@alchemybow
@alchemybow
@alchemybow Ай бұрын
@@risingforce9648 Let's consider a scenario where you have a class that derives from `MonoBehaviour`. For the sake of example, let's name it `Player`. It's attached to some game object and disabled by default. Additionally, it implements `ICoreLoadingCallbacksHandler` and changes its `enabled` property in the respective loading callbacks. With this setup, nothing will happen initially, but now: * If you apply `container.AddToDynamicListBinding<ICoreLoadingCallbacksHandler>(player);` to your player instance, the `CoreController` will invoke the callbacks at the appropriate moments. * Then, if you also use `container.BindInaccessible(player);` the player instance will become a client - the [InjectionTarget] and [Inject] attributes will start functioning for it. * Alternatively, if you use `container.Bind(player);`, the player instance will not only become a client, but also a service - associated with a key of type 'Player' - allowing other bound clients to request it using the injection attributes. Note 1: Items added to dynamic collections are not automatically bound. If you need them to be clients or services, you must bind them explicitly. Note 2: Whether you decide to use implicit or explicit interface implementation, it will function as expected. Personally, I often prefer the explicit variant when I don't see any reason to use the interface members from the implementor's public interface.
@risingforce9648
@risingforce9648 Ай бұрын
Ok sounds good i am taking notes....thanks!
@lizkimber
@lizkimber 4 ай бұрын
"In a previous video" .. not overly helpful when this is the first video in a series about injection..
@alchemybow
@alchemybow 4 ай бұрын
Thank you for your comment, and I appreciate your engagement. It seems there might be a slight misunderstanding. This video is actually the third part of a series on AlchemyBow.Core, a dependency injection framework for Unity. You can find the correct playlist here -> kzbin.info/aero/PLOjKvxKYw5Eys7UqMl1q-Ihz0GEnO9pJF By the way, you can share with me the link to the playlist you found. I'll check it, and maybe I can fix the order. In the meantime, if you have any questions, feel free to ask.
@chromezephyr8959
@chromezephyr8959 5 ай бұрын
Thanks so much. I'm sick of singletons.
@alchemybow
@alchemybow 5 ай бұрын
Hi there! I'm super happy to hear that you find the video useful! Singletons can be a quite headache. If you haven't checked them out yet, you might be interested in my other videos. They not only dive deeper into the topic but also bring improved quality Happy coding!
@risingforce9648
@risingforce9648 10 ай бұрын
I would like to know if the Enalble and Ondisable method from MOnobehaviour are replaced by the methods you must implemetn by IscoreLoadingCallbackHandler()? I use "actions" events or sometimes Delegates and events and I am so worry if I need to make the suscripton there?... and also what happen if a Monobehaviour class must have a "rigidbody 2D " and "Animator" ? How can I deal with that refernce component? is ths possible or bad idea ? using AlchemyBow.Core.IoC; using AlchemyBow.Core; using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerInstaller : MonoInstaller { public override void InstallBindings(IBindOnlyContainer container) { var player = GetComponent<PlayerMovement>(); container.AddToDynamicListBinding<ICoreLoadingCallbacksHandler>(player); player.GetComponent<Rigidbody2D>(); container.AddToDynamicListBinding(player); player.GetComponent<Animator>(); container.AddToDynamicListBinding(player); } } RIgidbody and ANimator are components...but at the end of the days they are also dependencies..
@alchemybow
@alchemybow 10 ай бұрын
Hey @risingforce9648 I'm glad to see you're diving into the technical details. The methods offered by ICoreLoadingCallbacksHandler don't replace OnEnable/OnDisable (you can continue using them). It's a distinct mechanism that provides a convenient way to receive loading-related callbacks. If you work with events, these methods may serve as great points for subscribing and unsubscribing to them. OnCoreLoadingFinished() - is invoked once within the lifecycle of a scene (CoreController) after all dependencies have been resolved and all loadables are fully loaded. In simpler terms, it triggers when everything is set and ready. OnCoreSceneChangeStarted() - is invoked once within the lifecycle of a scene (CoreController) at the beginning of the scene unloading(change) process. It provides a reliable opportunity to unsubscribe from events without concerns about whether the event providers have already been destroyed. Regarding the components in the game object scope, AlchemyBow.Core is primarily designed to manage project and scene scope dependencies. If the components require higher-level dependencies or are higher-level dependencies themselves, you can use BindInaccessible(...) or Bind(...) respectively. Otherwise, it should be more convenient to stick to conventional methods like GetComponent<>() or [SerializeField]. In the case of Animator and Rigidbody, something to consider would be to use the callbacks to enable/disable them or the object to which they are attached. I hope this helps! If you haven't seen them yet, the next videos in this series or the documentation might be great sources of information. If you have any more questions, don't hesitate to ask. Happy coding!
@risingforce9648
@risingforce9648 10 ай бұрын
@@alchemybow in case my chracter only depends on components , such as Healthcontroller, InputManager, other classes I straight foward with the framework? but for component such as rigidbody, animator, sprterenrender ? is not necessary??
@alchemybow
@alchemybow 10 ай бұрын
​@@risingforce9648 Yes, it's not necessary. I believe the views in the demo project could serve as a good example of that. Feel free to take a look: github.com/kempnymaciej/alchemy-core-snake-demo/blob/master/ABCoreDemo/Assets/_Scripts/Views/GameResultView/GameResultView.cs
@ThunderaRafa433
@ThunderaRafa433 11 ай бұрын
Hey there have you got a tutorial how to create a easy implemetation of your DI video? Idk, maybe a simple game mechanics. thanks. cause your video is good but is so fast. thanks!.
@alchemybow
@alchemybow 11 ай бұрын
Hey there! Thanks for watching! I think I have a great recommendation for you. Here github.com/kempnymaciej/alchemy-core-snake-demo, you can find a heavily commented demo project. It's a classic snake game that showcases various game mechanics and also demonstrates the practical implementation of AlchemyBow.Core. Also, in the description of this video, you'll find a link to the documentation page with additional resources. I hope you find it useful! If you have any other questions, feel free to let me know. Happy coding!
@lizkimber
@lizkimber 4 ай бұрын
@@alchemybowyou say that, but this is the first video on the unity asset store.. Some people want a video not written text (especially us dyslexics). Many people also dont want a pile of code when looking at a new thing they want to see/hear how and why
@alchemybow
@alchemybow 4 ай бұрын
@@lizkimber I understand your preference for video content, and I appreciate the feedback. For those looking for a quick overview and a jumpstart, I recommend checking out this KZbin series. The first video guides you throw setting up the framework, while the following ones dive deeper into the flag features with visual walkthroughs. You can use the documentation page as a central hub for your first learning steps. The steps are as follows: 1. The KZbin series - apart from what I've already mentioned, you will find a simple implementation example here. 2. Manual - for similar content in a written format with some extra details. (Analyzing new concepts from multiple perspectives can improve understanding.) 3. Demo - for real-life examples of the features in the complete scenarios. 4. Code documentation and source code - for curious individuals who prefer to dive into the technical aspects. P.S. This video (the second part of the series) serves as the primary video on the asset store, as it introduces a universally intriguing concept and brings a background for the framework. While the actual first video functions more as an interactive manual, which is lacking the same attention-grabbing quality. I hope you understand. Feel free to reach out if you have any additional questions!
@alchemybow
@alchemybow 4 ай бұрын
* I've also improved the cards to make the videos easier to navigate.
@carlogiovanni
@carlogiovanni 11 ай бұрын
is AlchemyCore compatible with Unity 2022.2.1f1?
@alchemybow
@alchemybow 11 ай бұрын
Hey there! Appreciate your interest! AlchemyBow.Core works smoothly with Unity 2022.2.1f1. If you have any other questions or need assistance, don't hesitate to reach out. Happy game developing!
@carlogiovanni
@carlogiovanni 11 ай бұрын
@@alchemybow Thank you so much! I can't wait to try it out. Have a great day
@risingforce9648
@risingforce9648 Жыл бұрын
how can install it? it is better than zenject? I am trying to learn more about this.
@alchemybow
@alchemybow Жыл бұрын
Hey there, thank you for watching and leaving a comment! If you're interested in learning how to install and use the framework, you can find a link to the documentation page in the video description. Additionally, if you're new to the series, I recommend checking out the first part as it provides a good introduction and covers the installation process in more detail. When it comes to choosing between Zenject and AlchemyBow.Core, there isn't a definitive answer that applies to everyone. The choice ultimately depends on your specific needs and preferences. However, AlchemyBow.Core offers several notable benefits, including its simplicity and solid solutions for common development problems like loading and state management. I encourage you to give it a try and see if it meets your requirements.
@risingforce9648
@risingforce9648 Жыл бұрын
@@alchemybow Ok I will try, I need to try it.
@alchemybow
@alchemybow Жыл бұрын
@@risingforce9648 I hope you'll like it! Also, if you have any further questions, please feel free to ask. I'll do my best to help.
@risingforce9648
@risingforce9648 Жыл бұрын
@@alchemybow I never see any other video usint the framework... I am trying to gather some videos before install it or tutorial how to use the framework...in my games , proably use some foo class to test it...
@alchemybow
@alchemybow Жыл бұрын
@@risingforce9648 I highly recommend checking out the documentation page. There, you'll find additional tutorials and a demo project that can be really helpful, especially if you plan to experiment. Exploring these resources, along with this series, will give you a solid understanding of the framework and its features. I hope you find them valuable!
@ElGuapoSalsero
@ElGuapoSalsero Жыл бұрын
Hi. What do you think long time development and support for Alchemybow will be? I started looking at DI in Unity about 2 years ago and the only options were Zenject and a forked framework, but I think both were abandoned, so that discouraged me from using them. I’m starting to look into alchemybow and trying to understand it, but I worry if it should be used for projects with a long lifecycle in mind.
@alchemybow
@alchemybow Жыл бұрын
Hi there! Thank you for your interest in AlchemyBow.Core and leaving a comment! Regarding your question, I am committed to maintaining and improving the framework for as long as it is useful to the community. While I cannot make any guarantees about the duration of the support, I am actively using AlchemyBow.Core in my personal projects and plan to continue to support it. AlchemyBow.Core is built using stable and non-changing APIs, which means that it is less likely to break or require significant changes due to updates in Unity. Additionally, the framework is simple and open-source, what can help ensure that it remains up-to-date and relevant to the community's needs. If you have any further questions or concerns, please feel free to ask. I'll do my best to help.
@ElGuapoSalsero
@ElGuapoSalsero Жыл бұрын
@@alchemybow Thank you for responding! I just finished refactoring a prototype scene I have for a project, and your framework is so practical and simple to use! It just works! I am not super proficient in C#, but your documentation, instructional videos, and your sample project have helped me a lot. Great demo project by the way. Thank you for providing your framework! I read again my initial comment and I realized it might have come off as entitled and possibly rude which I did not intend. Apologies for that. I will continue reading the rest of your documentation. Thanks gain!
@alchemybow
@alchemybow Жыл бұрын
@@ElGuapoSalsero It's a pleasure to hear that you find the resources helpful and that the framework is benefiting your project! Additionally, please don't worry about your initial comment. I want to assure you that the questions you asked were valid and reasonable, and if you have any other, please feel free to reach out. Once again, thank you for your feedback!
@ElGuapoSalsero
@ElGuapoSalsero Жыл бұрын
⁠@@alchemybow I just came across a hurdle. I have a C# object of type Tilemap in my Player script that I serialize to reference a gameobject that has a Tilemap component attached and this way I’m able to use all Tilemaps public methods and properties. I’m trying to figure out if I can inject that somehow and be able to use all public methods of the Tilemaps class, but I can’t inherit from Tilemaps because it’s a sealed class so I get a whole bunch of errors. I’m not sure if I’m looking at this wrong
@alchemybow
@alchemybow Жыл бұрын
@@ElGuapoSalsero Hi there! If I understand correctly (please correct me if I'm wrong), you have a player script that contains a serialized field of type GameObject. You use this field to access the Tilemap component by using the GetComponent<T>() method. To access the instance and its public members with injection, you can apply the same pattern to bind the Tilemap in the associated MonoInstaller. However, to make it more elegant, instead of using GameObject and GetComponent<T>(), you can directly reference the Tilemap component. You cannot inherit from a sealed class. If you still need a custom type based on it, you can consider using composition. This means creating a new class that contains an instance of the original class as a member variable, and depending on your needs/preferences, you can make it publicly available or create a completely new interface for it.
@frost-0
@frost-0 Жыл бұрын
Man. This is exactly what I was looking for :)
@alchemybow
@alchemybow Жыл бұрын
Great to hear that! I'm glad the content was helpful to you. If you have any questions or suggestions for future videos, please let me know.
@frost-0
@frost-0 Жыл бұрын
@@alchemybow Actually I have a question about alchemy bow. I started playing around with it and the first goal is to get rid of singletons in my small project (keep in mind I'm beginner game dev) as it's a terrible pattern which encourages people to write spaghetti code with lots of impure functions. With DI you have to always keep in mind that you can't have cyclic dependencies. For example if you have GameManager and LevelManager singletons, GameManager can communicate with LevelManager and the other way around. With DI you're injecting LevelService into GameService and you communicate through functions but only GameService has a reference to LevelService so LevelService can't call any action on GameService. I'm wondering how you deal with that in real life scenarios. Do you have any project that can be made public to have a look at it ? Second question is about testing. How do you inject mocks into classes ? Does alchemy bow support constructor injection as opposed to field injection ?
@alchemybow
@alchemybow Жыл бұрын
@frost I hope you like it so far! If you just want to test the framework in your project, you can continue to use circular dependencies, as AlchemyBow.Core is capable of handling them without issue. However, you are 100% right, having circular dependencies is generally considered to be bad practice. To avoid them, there are two methods that I recommend. The first method involves using events. This means that class A directly calls methods on class B and subscribes to its events for callbacks. The second method involves creating mediator objects to further decouple the classes. There's a concise example of how to do this on the framework's documentation page under "Manual/Scene Changes". You can find the link in the description of this video. There are more manuals, code documentation, and the demonstration project, so I hope it's helpful. To inject mocks, you can use the Container class. First, create an instance of it, bind your mocks to specific keys, bind the class you want to test, and then call ".ResolveAllBindings()." AlchemyBow.Core only supports field injection because it makes it super easy to understand what's being injected into the class, and then you can use constructors for other purposes. Thanks for commenting and let me know if you have any other questions 😊
@frost-0
@frost-0 Жыл бұрын
@@alchemybow I'd like to avoid circular dependencies. Theoretically it should work but I just don't want to have to think which one will be initialized first. My mind is a little bit blown after two month with Unity because all the things I've been avoiding for last 10 years seem to be common practises here xD Events were actually my first idea. I mean ending up with injectable dependencies + events. Just had to confirm with someone who spent more time with Unity than me :) Although I'm super used to constructor injection I can live with fields. Constructor injection basically makes unit testing easier because you simply pass mocks into constructor without any tool that injects them for you. Thanks for the answer. I may have more questions after I refactor the code. Do you prefer any other form of communication rather than YT comments ?
@alchemybow
@alchemybow Жыл бұрын
@@frost-0 No problem, we can continue to use the comments for general questions so that others can benefit from our conversation. However, feel free to contact me via email.
@gapczan1717
@gapczan1717 Жыл бұрын
Nice
@alchemybow
@alchemybow Жыл бұрын
I'm glad you enjoyed the video. Thanks for your support 😊
@Micz84
@Micz84 Жыл бұрын
Invest in pop filter or postprocess the audio in software like audacity because it is painfull to listen with all those whisseling sounds.
@alchemybow
@alchemybow Жыл бұрын
Hi, I'm working on it and hope you'll see the progress in my future videos ;)
@alchemybow
@alchemybow Жыл бұрын
Hi again! I took your advice, and I'm happy to let you know that my latest videos have much-improved audio quality. I appreciate your feedback, and I hope you'll enjoy my new content😊