Пікірлер
@Stotle003
@Stotle003 2 күн бұрын
How do you make a moving ball in 2d make a noise when it colides with another object that is rigid. I cant find it, everyone does 3d
@Jubez81
@Jubez81 9 күн бұрын
Could not get this working hit up hedge no reply :( Stripped my game of it.
@SmallHedgeHQ
@SmallHedgeHQ 9 күн бұрын
Sucks to hear. If you have a specific question, I can help you out with it :)
@MrBOI-1
@MrBOI-1 9 күн бұрын
Hey, i am getting errors when i use (On Parameter), the error is : NullReferenceException: Object reference not set to an instance of an object. its saying at line 23 in OnParameter.cs. Thanks
@travis391
@travis391 13 күн бұрын
Does this support skinned meshes??
@SmallHedgeHQ
@SmallHedgeHQ 12 күн бұрын
Not at the moment, but there will be an update in 2-3 weeks including that feature.
@pablovillegas2898
@pablovillegas2898 14 күн бұрын
Nice video but i have a problem, How can I lower the volume of the walking sound independently?, my walking sound is very loud and I would like to decrease it without altering the others
@SmallHedgeHQ
@SmallHedgeHQ 12 күн бұрын
I actually found this exact issue! On the GitHub link, you can now change each sound volume in the Unity inspector, as well as its audio mixer. So the sound manager shown in the video is a little bit outdated.
@pablovillegas2898
@pablovillegas2898 11 күн бұрын
@@SmallHedgeHQ Oh, ok i'll try it
@justinrush7463
@justinrush7463 17 күн бұрын
Hello, I'm aiming to be a new user of this system, but I have one worry. See, when making the system on your own like in the last video, I can use inheritance to give every entity in my game access to their own brain, as I can just make a new class that contains functionally the same things but with the proper data for the entity it will be used with. How do you handle separate brains with this plugin version of it? Because if I'm reading this right, there's only one AnimatorValues script, and all implementation of this plugin will call back to that script, with no way to tell it what values it should be using.
@SmallHedgeHQ
@SmallHedgeHQ 12 күн бұрын
I suppose this is where there is a balance for convenience and optimisation. This method prioritised convenience (having one global AnimatorValues) and ease of use rather than each animator having their own set of values. A design decision that I thought was a good trade off.
@Tiff_Dragoon
@Tiff_Dragoon 23 күн бұрын
THANK YOU SO MUCH THIS IS TRULY AMAZING, Like back then I have to find freaking multiple animations online just for it to be slightly different, now this is so much better on so many levels!
@Equisdeification
@Equisdeification 24 күн бұрын
Nice video! A simple dictionary of <SoundType, AudioClip> that you create at runtime feels much easier to read. Also be careful with having all your sounds in a single script, specially on mobile, because if the game grows, this means having all the game audio loaded into memory from the start, even sounds that you don't even need in the current scene
@alekjatuszyk4976
@alekjatuszyk4976 Ай бұрын
i actually used a system similar to this in my AI framework asset, and it is waaaaay easier and nicer than the transitions (asset name: Alek AI Framwork). nice work!
@daxmiller2670
@daxmiller2670 Ай бұрын
does this method only works for 3d ?
@SmallHedgeHQ
@SmallHedgeHQ 29 күн бұрын
For 2d and 3d! I actually showcase how to use these techniques in 2d in the next video of the series 😁kzfaq.info/get/bejne/b9qmd9eElty9pYE.html
@OrbitZeroStudios
@OrbitZeroStudios Ай бұрын
So I tried this plugin, and it was a straightforward approach for my project but when dealing with multiple Animation layers, the reset almost always does not work. I found the issue, it was happening because there was only one currentCoroutine for various layers. To fix this issue: public abstract void DefaultAnimation(int layer); public Animator animator; private Animations[] currentAnimation; private bool[] layerLocked; private ParameterDisplay[] parameters; private Coroutine[] currentCoroutine = null; /// <summary> Sets up the Animator Brain </summary> public void Initialize() { AnimatorValues.Initialize(); Animator animator = GetComponent<Animator>(); layerLocked = new bool[animator.layerCount]; currentAnimation = new Animations[animator.layerCount]; currentCoroutine = new Coroutine[animator.layerCount]; <----------------------------------------- //rest of the initialize } Later In the play stop and start the coroutine according to the respective layer if (currentCoroutine != null) { StopCoroutine(currentCoroutine[layer]);} if (data.nextAnimation != null) { currentCoroutine[layer] = StartCoroutine(Wait()); IEnumerator Wait() { animator.Update(0); float delay = animator.GetNextAnimatorStateInfo(layer).length; if (data.crossfade == 0) delay = animator.GetCurrentAnimatorStateInfo(layer).length; yield return new WaitForSeconds(delay - data.nextAnimation.crossfade); SetLocked(false, layer); Play(data.nextAnimation, layer); } } Hope this helps
@SmallHedgeHQ
@SmallHedgeHQ Ай бұрын
Duude, you are a genius for finding that bug. I really couldn't have made this plugin without this community. Most of the ideas for this plugin came from you all. Really appreciate all the feedback and suggestions. I have committed a new version with these changes on the github page.
@OrbitZeroStudios
@OrbitZeroStudios Ай бұрын
@@SmallHedgeHQ[Edit] The above methods works fine there was a mistake in myside of the code that was causing it to through an error. Hello there this is very important, Please replace the array of the coroutines with a list, otherwise the plugin will give not work but remain stuck on the default animation. private List<Coroutine> currentCoroutine = new List<Coroutine>(); /// <summary> Sets up the Animator Brain </summary> public void Initialize() { AnimatorValues.Initialize(); //Animator animator = GetComponent<Animator>(); layerLocked = new bool[animator.layerCount]; currentAnimation = new Animations[animator.layerCount]; // Coroutine[] currentCoroutine = new Coroutine[animator.layerCount]; currentCoroutine = new List<Coroutine>(animator.layerCount); // this.animator = animator; for (int i = 0; i < animator.layerCount; ++i) { layerLocked[i] = false; currentCoroutine.Add(null); int hash = animator.GetCurrentAnimatorStateInfo(i).shortNameHash; for (int k = 0; k < AnimatorValues.Animations.Length; ++k) { if (hash == AnimatorValues.Animations[k]) { currentAnimation[i] = (Animations)Enum.GetValues(typeof(Animations)).GetValue(k); k = AnimatorValues.Animations.Length; } } } //rest of initialize} And later in the Play function if (layerLocked[layer] || currentAnimation[layer] == data.animation) return false; if (currentCoroutine[layer] != null) { StopCoroutine(currentCoroutine[layer]);} layerLocked[layer] = data.lockLayer; currentAnimation[layer] = data.animation; animator.CrossFade(AnimatorValues.GetHash(currentAnimation[layer]), data.crossfade, layer); if (data.nextAnimation != null) { currentCoroutine.Insert(layer, StartCoroutine(Wait())); IEnumerator Wait() { animator.Update(0); float delay = animator.GetNextAnimatorStateInfo(layer).length; if (data.crossfade == 0) delay = animator.GetCurrentAnimatorStateInfo(layer).length; yield return new WaitForSeconds(delay - data.nextAnimation.crossfade); SetLocked(false, layer); Play(data.nextAnimation, layer); } } I hope you will see this comment and change the Repository again. There is some problem with using an array. Using array only works when there is no next animation for some reason.
@SmallHedgeHQ
@SmallHedgeHQ Ай бұрын
@@OrbitZeroStudios hmm that is really bizarre. I’ll look into it tomorrow. Thanks for letting me know
@OrbitZeroStudios
@OrbitZeroStudios Ай бұрын
@@SmallHedgeHQ I am such an idiot. It was working fine I had a typo there in the initialize Please remember the following text: "Coroutine[]"was added by mistake currentCoroutine = new Coroutine[animator.layerCount];
@SmallHedgeHQ
@SmallHedgeHQ Ай бұрын
@@OrbitZeroStudios aha that would make sense!
@mohamedhamed3572
@mohamedhamed3572 Ай бұрын
Amazing!
@jamestanubrata6782
@jamestanubrata6782 Ай бұрын
Wow that is useful to make ps1 style game it's so awesome
@SmallHedgeHQ
@SmallHedgeHQ Ай бұрын
Appreciate it! It really helps streamline the process for those types of games.
@lekretka
@lekretka Ай бұрын
Good and simple tool. I even checked the code. Some advices: 1. AnimationData can be a struct, this will remove unnecessary pressure on GC. Sure you can cache class in static field, but simply making it struct would be preferable imo. There's no struct recursion, but I used Spine 2D plugin in one project, spine has SetAnimation and AddAnimation for queueing animations. And if AnimationData is a struct without recursion, then you can actually expose and configure it from the inspector which is nice too. 2. It's may not be that easy, but I would try generics and made something like AnimatorCoder<TAnimationId, TParameterId> and OnParameter<TParameterId>, so you could make your own ids and parameters, enums or structs, or even scriptableObjects, without actually modifying plugin code.
@jamestanubrata6782
@jamestanubrata6782 Ай бұрын
Wow thats so cool, do you have 3d tutorial for cinemachine
@SmallHedgeHQ
@SmallHedgeHQ Ай бұрын
Thanks! Cinemachine has a lot of features so that video would be huge xD
@jamestanubrata6782
@jamestanubrata6782 Ай бұрын
@@SmallHedgeHQ you should also try making how to switch between multiple cinemachine like if there is 4 or 5 of them
@jamestanubrata6782
@jamestanubrata6782 Ай бұрын
Do you have anything that creates fake shadows in realtime
@SmallHedgeHQ
@SmallHedgeHQ Ай бұрын
I’ll look into it! Fake shadows would be super useful.
@ocks_dev_vlogs
@ocks_dev_vlogs Ай бұрын
This honestly seems really useful
@oliviabigley3378
@oliviabigley3378 Ай бұрын
Gosh it's so exciting to see the game finished!
@mitchyoungs212
@mitchyoungs212 Ай бұрын
This is awesome
@-sistudio4347
@-sistudio4347 Ай бұрын
лучший, бро 💞💞💞💞💞💞
@Titanblade17
@Titanblade17 2 ай бұрын
I keep getting the error “Animator.GotoState: State could not be found UnityEngine.Animator:CrossFade (int,single,int)” And it sends me to line 138 of the AnimatorCoder script. animator.CrossFade(AnimatorValues.GetHash(currentAnimation[layer]), data.crossfade, layer); Any idea what’s happening? I’ve been searching for hours and can’t figure it out.
@SmallHedgeHQ
@SmallHedgeHQ Ай бұрын
The most likely explanation is the enum value passed in Play() does not exist as a state in the animator. For example, if your animations enum looks like Enum Animations { RUN, WALK, IDLE } Then there must be a state that is named RUN, IDLE, or WALK
@Titanblade17
@Titanblade17 Ай бұрын
@@SmallHedgeHQ Ok, I'll try looking at that again! Thanks!
@michieldeekens9218
@michieldeekens9218 2 ай бұрын
Hey man! I am using this instead of the animator now, and I am loving this! But I have a small question regarding blend-trees. If I want to use a Strafe left/right on top of walking/running, how can I achieve this using your code?
@SmallHedgeHQ
@SmallHedgeHQ Ай бұрын
Sorry for late reply! Took time off and slowly getting through comments. I got asked a lot about blend trees. Unfortunately this is set up to optimise single state transitions, not blending multiple animations together. Best bet is to add more crossfade (transition time) to have walk left, right, forward, back animations and transition between them.
@user-uf8sk6nf6z
@user-uf8sk6nf6z 2 ай бұрын
You are the best 😍😍😍😍 Thanks!!
@Jay-if9uf
@Jay-if9uf 2 ай бұрын
Bruh, I dont see anything moving.
@junyuhan-to6kw
@junyuhan-to6kw 2 ай бұрын
What if I want to randomly play multiple animations of each type with this plugin
@SmallHedgeHQ
@SmallHedgeHQ Ай бұрын
Each layer holds one singular current animation at a time and is tracked through an enum. So to pick a random animation, you could do Animations[Random.Range(0, Enum.GetNames(TypeOf(Animations)).length] to get a random animation. Or make a list of Enum values to randomly choose from. Each Enum value is given an integer, which allows you to look up them through an array.
@IRIS6706
@IRIS6706 2 ай бұрын
well...unity animator is terrible, but controlling all of your animations with code is even worse.
@billylin6089
@billylin6089 2 ай бұрын
This video has helped me so much on my game
@TheAtticus82
@TheAtticus82 2 ай бұрын
Great stuff, man! Just earned a new sub.
@khawlatouj8980
@khawlatouj8980 2 ай бұрын
great thank you <3
@alicia8382
@alicia8382 2 ай бұрын
this is such a good tutorial, seriously so helpful! love how you structure the video and actually show the features you're talking about at the START of the video. it helps so much to know if this tutorial is something i'm looking for. super easy to follow! thanks for sharing this for people like me to learn and follow along for free!!!
@SmallHedgeHQ
@SmallHedgeHQ 2 ай бұрын
Thank you so much!!
@angelgabrielcaviedesjoya9368
@angelgabrielcaviedesjoya9368 2 ай бұрын
Hey!, how can I implement this with photon pun, since it works precesely with the animator parameters
@rediculai2584
@rediculai2584 2 ай бұрын
i did this it seems alot cleaner but i have problem when i press left and right (a and d) for movement the animations bug out and it starts playing the running animation but with input.getaxisraw("horizontal") it should equate to 0? or when i fast tap a and d the player would walk but in the idle animation very weird
@darkman237
@darkman237 2 ай бұрын
Could you refactor this to use unity events?
@SmallHedgeHQ
@SmallHedgeHQ 2 ай бұрын
100%. The only prerequisite is the Play() method can not have more than 1 parameter. Could potentially create a scriptable object which holds Sounds enum and Volume, then pass in that.
@darkman237
@darkman237 2 ай бұрын
@@SmallHedgeHQ In order to keep the sound enum and volume would have to be set dirty between plays
@DenisFomin
@DenisFomin 3 ай бұрын
That's a great approach. I'll try to use it in my game, I'm tired of correcting dependencies in the standard animator. But for us lazy people, it would be easier if you also put the character control code in the kit, for example ))).
@Endless_Existence
@Endless_Existence 3 ай бұрын
Awsome ! But what about strafing ? Like what we use in 2D blend trees?
@madshorn5826
@madshorn5826 3 ай бұрын
For other n00bs: Make sure that you are using the correct Controller in the Animator. I just couldn't figure out why the state couldn't be found... 😅
@weckar
@weckar 3 ай бұрын
Wait. People do that? Make a sound source for every sound? What? You have got to be joking right?
@renarsgrams
@renarsgrams 3 ай бұрын
Yes, I do. 😄 That's what happens when you learn something new. It was a way I could think of to play five sounds at the same time for one object. But now I will try this way.
@HarrenTonderen
@HarrenTonderen 3 ай бұрын
Nice! Btw one thing i like to add with audio players is random pitch - usually storing it as Vector2 (so X/Y are min/max, 1f/1f as default) and change AudioSource's pitch with random range when play function is called. Small but fun thing, however unsure how it affects perfomance in any case..
@SmallHedgeHQ
@SmallHedgeHQ 3 ай бұрын
That is a great idea! It would definitely make the sounds feel more authentic.
@jaulloa21
@jaulloa21 3 ай бұрын
The light flicker asset is simply a spotlight that dims on and off. :} 😅
@SmallHedgeHQ
@SmallHedgeHQ 3 ай бұрын
xD. I should ask the developer to add more features! Its selling point is it’s completely customisable. You can flicker colour, flicker materials, add sound, and trigger events all in just one state. You can add an infinite amount of these states that do anything you want. I genuinely use this asset in most of my projects because of how versatile it is! Would recommend checking out the tutorial video on the Unity Asset Store to see all the features :)
@LotionSoronarr
@LotionSoronarr 3 ай бұрын
Why not use Scriptable Objects? Sounds lists in scriptable objects. Every characters gets it's own sound list.
@weckar
@weckar 3 ай бұрын
Depending on application. This is more generic, and requires fewer additional assets as overhead.
@HobokerDev
@HobokerDev 3 ай бұрын
Just use nested state machines like a normal person
@RoxGame
@RoxGame 3 ай бұрын
can this system play background music while playing another sound effects using one audio source !
@SmallHedgeHQ
@SmallHedgeHQ 3 ай бұрын
This SoundManager is optimised for event-based sound effects. Such as playing a sound when criteria are met. For background music, I have a couple of suggestions. 1. Create a separate audio source and set it to looping. When the music needs to be triggered, call AudioSource.Play() and AudioSource.Stop() when it needs to stop. 2. Change the play method to SoundManager.Play(Sounds sound, float volume, bool looping). Then if looping is true, create a Coroutine which calls SoundManager.Play() again after the duration of the audio clip. Of course with this way, you’ll need a way to stop the looping, so there’ll need to be a new Stop() method which interrupts the Coroutine. I would strongly recommend #1. Unless you are looking to use the SoundManager script to manage all the sound/music in your project. I think the best way is a hybrid approach.
@blindsidedgames
@blindsidedgames 3 ай бұрын
Man, I didn't know I could reference instanced non static methods that way. Works with variables too I like that. You taught me much today Senpai.
@SmallHedgeHQ
@SmallHedgeHQ 3 ай бұрын
Hello everyone, hope this workflow is working well for you 😁. Following your amazing feedback on the topic, I put together a plugin for the Unity animator was does all the tricky logic behind the scenes. It only takes 10 seconds of setup and works straight out of the box. Might help y'all out a bit kzfaq.info/get/bejne/b9qmd9eElty9pYE.html
@nizzq2
@nizzq2 3 ай бұрын
Hey, I encountered an error where the attack animation will stop playing after the first hit. I followed the tutorial shown in the video but it is not working. :(
@SmallHedgeHQ
@SmallHedgeHQ 3 ай бұрын
Sorry you're having problems! I might be able to help out with a bit more context. I'll also add we worked on making a dedicated plugin for Unity for animator coding following this video, where you hardly need to set anything up, might be worth checking out kzfaq.info/get/bejne/b9qmd9eElty9pYE.html
@nizzq2
@nizzq2 3 ай бұрын
@@SmallHedgeHQ Thank you for replying! The hierarchy for my player is "Player > Player Model", my player controller script is attached to the Player game object and the animator component is attached to the Player Model game object. As shown in the video, its "GetComponent" and since my animator component is attached in the child object I used "GetComponentInChildren"
@SmallHedgeHQ
@SmallHedgeHQ 3 ай бұрын
Hmm bizarre! I’ll try to troubleshoot everything that comes to mind. 1. When calling Animator.Play(“”), the string needs to be exactly the same as the Animator state name (not the animation clip name) 2. It needs to be on the right animation layer (default is 0) 3. The Animator itself has no transition lines 4. Ensure that GetComponentInChildren() is getting the right animator component (print animator.GetInstanceId() and go to the inspector and enter debug mode in the top right, make sure they match. Or just call animator.name) 5. After animator.Crossfade() (with crossfade = 0) print animator.Update() then animator.GetCurrentAnimatorStateInfo.IsName() then test if it is actually playing the animation 6. Check if the animator component has a valid animator controller Hope that helps! If not, flick through the code and we might be able to spot something.
@fred1541
@fred1541 3 ай бұрын
Yes, I always face animation hell, which looks like a spider web. Thanks
@diliupg
@diliupg 3 ай бұрын
Thank you very much for this excellent plugin! People like you are a rare breed. :)
@SmallHedgeHQ
@SmallHedgeHQ 3 ай бұрын
:) Just wanting to help out best I can
@federicodanzi1412
@federicodanzi1412 3 ай бұрын
It's actually pretty smart but also simple. I mean, even if you use the animator transitions and variables, you need to change them by script, so why not do all the rest too? You opened my eyes, thank you!
3 ай бұрын
it was good until the onparameter script, which is the same as the animator transitions just with less options... if you make it that we can add these data to the animationdata, then it will be much better solution
@SmallHedgeHQ
@SmallHedgeHQ 3 ай бұрын
The parameter check only needs to occur when you are in the specific animator state. This was eliminating the need to check parameters each frame when you don’t need to.
@MalbersAnimations
@MalbersAnimations 3 ай бұрын
Amazing! Take a sneak peak into the Playable API when you have the chance :D
@Endless_Existence
@Endless_Existence 3 ай бұрын
Love for animal Controller <3