- 21
- 61 704
Small Hedge Games
New Zealand
เข้าร่วมเมื่อ 29 ม.ค. 2022
Top notch content about Game Dev. Better than a chicken wing.
Create FAKE SHADOWS using JUST MESHES (BIG Unity Tool Update)
Mesh Wrapper is a Unity Tool that now allows you to create Fake Shadows at Runtime!
Take a Squiz!
buymeacoffee.com/SmallHedgeHQ/e/266922
Support me :) - buymeacoffee.com/smallhedgehq
Website - www.smallhedge.com/
My games - small-hedge.itch.io
Twitter - SmallHedgeHQ
Facebook - SmallHedgeHQ
TH-cam avatar created by OliGalArt, go check her out! ko-fi.com/oligalart/commissions
Take a Squiz!
buymeacoffee.com/SmallHedgeHQ/e/266922
Support me :) - buymeacoffee.com/smallhedgehq
Website - www.smallhedge.com/
My games - small-hedge.itch.io
Twitter - SmallHedgeHQ
Facebook - SmallHedgeHQ
TH-cam avatar created by OliGalArt, go check her out! ko-fi.com/oligalart/commissions
มุมมอง: 271
วีดีโอ
18 BRAND NEW Post Processing Combinations in Unity!
มุมมอง 1.1K3 หลายเดือนก่อน
Use bloom, lens distortion, colour grading, and chromatic aberation to make creative effects for your projects! These tools are designed for the built-in render pipeline but can also be altered to work with the universal render pipeline (URP) and high definition render pipeline (HDRP). Github link to the tools used in the video! github.com/SmallHedge/PostProcessingTools Support me :) - buymeaco...
Create Rooms Faster than PROBUILDER - NEW Unity Tool (2024)
มุมมอง 8314 หลายเดือนก่อน
Room Builder is a Unity tool which allows you to create rooms in you Unity scene! Take a squiz! buymeacoffee.com/SmallHedgeHQ/e/268119 Support me :) - buymeacoffee.com/smallhedgehq Website - www.smallhedge.com/ My games - small-hedge.itch.io Twitter - SmallHedgeHQ Facebook - SmallHedgeHQ TH-cam avatar created by OliGalArt, go check her out! ko-fi.com/oligalart/commissions
The ULTIMATE Guide to 2D CAMERAS (Updated 2024)
มุมมอง 2754 หลายเดือนก่อน
Camera shake, dead zones, and camera boundaries can all be done through the Unity inspector through cinemachine! Not sure why we haven't all converted sooner! Code Used: github.com/SmallHedge/CinemachineCameraShake Get Light Flicker Ultimate: assetstore.unity.com/packages/tools/particles-effects/light-flicker-ultimate-268609 You might like: Unity Sound Manager - th-cam.com/video/g5WT91Sn3hg/w-d...
Wrap Meshes around OTHER Meshes! NEW Unity Tool (2024)
มุมมอง 2475 หลายเดือนก่อน
Mesh Wrapper is a Unity Tool which allows you to create decals! Take a Squiz! buymeacoffee.com/SmallHedgeHQ/e/266922 Support me :) - buymeacoffee.com/smallhedgehq Website - www.smallhedge.com/ My games - small-hedge.itch.io Twitter - SmallHedgeHQ Facebook - SmallHedgeHQ TH-cam avatar created by OliGalArt, go check her out! ko-fi.com/oligalart/commissions
Create MAP BOUNDARIES in 2 seconds with this NEW Unity Tool (2024)
มุมมอง 8185 หลายเดือนก่อน
Easy Boundary is a Unity tool which allows you to create perimeters in you Unity scene! Take a squiz! buymeacoffee.com/SmallHedgeHQ/e/265667 Support me :) - buymeacoffee.com/smallhedgehq Website - www.smallhedge.com/ My games - small-hedge.itch.io Twitter - SmallHedgeHQ Facebook - SmallHedgeHQ TH-cam avatar created by OliGalArt, go check her out! ko-fi.com/oligalart/com...
UNITY DEVELOPER takes on their OWN GAME!
มุมมอง 1695 หลายเดือนก่อน
Uproot is a rougelike 2d platformer where you must collect coins around the map while avoiding enemies and hazards! Purchase upgrades to level up your character to beat the harder waves! PLAY UPROOT: small-hedge.itch.io/uproot th-cam.com/video/wQiAOPZJcSc/w-d-xo.html th-cam.com/video/yRKjNPNeQX0/w-d-xo.html HUGE SHOUTOUTS! Programming: Small Hedge (www.youtube.com/@SmallHedgeHQ) Game Art: Oliga...
Create 2D PARALLAX with ONE CLICK - Free Unity Plugin Showcase
มุมมอง 4646 หลายเดือนก่อน
Having to code new 2D Parallax effect scripts can be a hassle. So here is a Unity plugin which creates 2D parallax instantly by adding this one script! Hope this helps! Github Code: github.com/SmallHedge/2dParallax LIGHT FLICKER ULTIMATE assetstore.unity.com/packages/tools/particles-effects/light-flicker-ultimate-268609 Assets Showcased: LIGHT FLICKER: assetstore.unity.com/packages/tools/partic...
PLEASE use a Unity SOUND MANAGER! - Full Tutorial
มุมมอง 11K7 หลายเดือนก่อน
Sound Managers are crucial when using audio sources in Unity. It really helps to organise your sound events in a structured way! Github Code: github.com/SmallHedge/SoundManager LIGHT FLICKER ULTIMATE assetstore.unity.com/packages/tools/particles-effects/light-flicker-ultimate-268609 Assets Showcased: LIGHT FLICKER: assetstore.unity.com/packages/tools/particles-effects/light-flicker-ultimate-268...
Say Goodbye to the Animator! NEW Unity Plugin Showcase
มุมมอง 13K7 หลายเดือนก่อน
AnimatorCoder is a new Unity plugin which allows you to play animations entirely from script. It also includes animation parameters and animation chaining. Thanks everyone for your amazing input into this project! Download the plugin! github.com/SmallHedge/AnimatorCoder Assets Showcased: BACKGROUND: assetstore.unity.com/packages/2d/textures-materials/nature/free-pixel-art-hill-133118 WIZARD: as...
Never use the Unity Animator EVER AGAIN - Full Guide
มุมมอง 9K7 หลายเดือนก่อน
Tutorial of how to manage animations entirely through script in the Unity game engine! Tired of struggling with the Unity Animator? In this tutorial, I'll show you how to create smooth and efficient animations entirely through scripting, eliminating the need for the Unity Animator once and for all! Say goodbye to clunky animations and hello to smooth, customizable movements in your Unity projec...
Creating 2D Worlds with PROCEDURAL GENERATION - Devlog
มุมมอง 2548 หลายเดือนก่อน
Procedural Generation is a popular choice for indie games such as rougelikes, open-world, and sandbox games. Now it's time to add it to 2d platforming, where the entire world is procedurally generated... Support me :) - buymeacoffee.com/smallhedgehq Website - www.smallhedge.com/ My games - small-hedge.itch.io Twitter - SmallHedgeHQ Facebook - SmallHedgeHQ TH-cam avatar ...
Light Flicker Ultimate - Now Available on Unity Asset Store
มุมมอง 1868 หลายเดือนก่อน
Get on the Asset Store! 50% OFF assetstore.unity.com/packages/tools/particles-effects/light-flicker-ultimate-268609 Tutorial Video: th-cam.com/video/6WmJpudXUa0/w-d-xo.html Have complete customisation of your light flickers! This asset includes the standard features of light flickering such as light intensity, light colour, material switching, and sound. Why stop there? Light Flicker Ultimate a...
Don't use the Unity Animator, Use Code Instead! - Tutorial
มุมมอง 21K8 หลายเดือนก่อน
Unity developers often create messy animator tabs. Animating like a programmer allows you to clean it up, and have more control of your animations. This is how to set up your animations in any project. Assets Showcased: ENVIRONMENT: assetstore.unity.com/packages/3d/environments/platformer-game-show-pack-195080 POST PROCESSING: assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/...
What Developers DONT TELL YOU about 2d Platformers
มุมมอง 4828 หลายเดือนก่อน
Wonder how games like Hollow Knight, Ori, and Celeste have such good character controllers? Here are 9 tips to help you out in your game development journey! Assets Showcased: FULLSCREEN: assetstore.unity.com/packages/tools/utilities/fullscreen-editor-69534 2D: assetstore.unity.com/packages/2d/characters/sunny-land-forest-108124 Support me :) - buymeacoffee.com/smallhedgehq Website - www.smallh...
This is the EASIEST Way to Create FLAPPY BIRD
มุมมอง 8009 หลายเดือนก่อน
This is the EASIEST Way to Create FLAPPY BIRD
Adding ENEMIES to my INDIE Game - Devlog
มุมมอง 21110 หลายเดือนก่อน
Adding ENEMIES to my INDIE Game - Devlog
Making a Particle System in C++ from Scratch!
มุมมอง 2942 ปีที่แล้ว
Making a Particle System in C from Scratch!
Ok but what about movement in the diagonal directions? Like do you need 4 more animations for that or is there a way to blend the 4 you already have?
Would it be possible to provide your player script in the Git repo please?
whats the success thing how do i hace to make it work?
how can i change the time where my sounds start , for example if i want to Play a sound but starting at 2 seconds in the sound not from the start .
[SOLVED] When I add the "AnimatorCoder" instead of the MonoBehaviour, I have "error CS0118: 'AnimatorCoder' is a namespace but is used like a type" [SOLUTION] After on the video
Nice vid, good tut. Thanks for your work!
any way to support height adjustments within a room without leaving gaps between wall/floor/ceiling?
What if i don't want to choose a random sound and just want to have multiple i can choose from?
You can simply create different methods for the manager that will look for different sounds in different ways. Example: playRoundRobin() playIndex() playName() playClip() Etc. The implementation is quite simple. Round robin needs only to have the index increment and then modulo the list size. Index needs an index integer (might wanna modulo the list size just in case) Name would want to find the clip name within the array (slow but you can make it so that it keeps it in inventory until told to get a different one, to make it O(1) on subsequent calls Clip would just make it so it doesn't read the sound manager's list at all and just plays what you give it, OR you could have it check if the clip is contained within the manager and play it if it is.
this is genius! thanks for the video
but I can't code...
Instead of having a string to hash array for your animations you can directly use the enum with .ToString() Great vid !
this video is badass. good work. good system
This has some drawbacks though. Consider large game with large codebase with lot of legacy code, or case when you even don't have access to some code. Then you are porting some features and in that case using animator is really convenient. Otherwise your visuals are tightly bound to code, which is not good. Or you can't give some tasks to tech / ui artists who are not that familiar with code.
How do you get it?
buymeacoffee.com/smallhedgehq/e/268119 The link’s in the video description which shows all the details of it! It’s compatible with Unity 2022 upwards and works with all render pipelines. Works straight out of the box once installed in your project.
From where did you get " GetComponent"
GetComponent is a function tied to the GameObject class! It allows you to get any component exisiting in the inspector.
Thanks a lot buddy
Learned a couple of neat tricks here. Thanks for the helpful video!
Unity blend trees....💀
Not tried it yet but wondering if using Cysharp's Unitask could be a way to reduce garbage?
The difference does seem pretty minimal but might work slightly faster if you have a mega animation chain :D. Otherwise not sure how much difference it would make.
Does this work with bone animations? (2D Skinning)
Yes should work, if your animation is an animation state in the animator window
My favorite part about this video is when he says "that's literally all we need" and then proceeds to type more code
looks cool. definitely be using it
Hi, I'm running into a problem where when I Jump i go through the FALLING Parameter into my IN_AIR Animation and then with the GROUNDED Parameter into the JUMP_LAND Animation. When I'm in Idle Animation (I've got 5 idle Animations that i loop through) and press JumpButton, the JUMP_START Animation plays but I think it's affected by the Idle Animation before. I would guess it's because of Crossfade. But then again, when I'm in WALKING or RUNNING Animation this Error doesn't occur even though I have crossfade on these as well. Also the JUMP_LAND Animation does often not play when I'm not moving and it goes straight back to IDLE. If anyone seem to recognize this or may know where I made a mistake, please answer. Help is greatly appreceated! 3D Game I used another Script for my Character Controller My Code: using System.Collections; using UnityEngine; using SHG.AnimatorCoder; public class NewAnimationSystem : AnimatorCoder { public static NewAnimationSystem instance; private BasicPlayerMovement basicPlayerMovement; private Vector2 movement; private bool playIdle; private bool isCautious; [Tooltip("The time between Idle Animation switch when standing")] public float switchIdleTime = 7f; private int randomIdleAnimation = 0; private int randomCautiousIdleAnimation = 0; Animator anim; void Awake(){ instance = this; } void Start() { Initialize(); basicPlayerMovement = GetComponent<BasicPlayerMovement>(); anim = GetComponent<Animator>(); StartCoroutine(ChangeIdle()); IEnumerator ChangeIdle(){ while (true){ yield return new WaitForSeconds(switchIdleTime); randomIdleAnimation = Random.Range(0, 6); randomCautiousIdleAnimation = Random.Range(0, 2); } } } void Update() { movement.x = Input.GetAxisRaw("Horizontal"); movement.y = Input.GetAxisRaw("Vertical"); DefaultAnimation(0); StandMoveAnim(); CrouchAnim(); JumpAnim(); if(playIdle) LoopThroughIdleAnimations(); } void FixedUpdate(){ SetBool(Parameters.GROUNDED, basicPlayerMovement.grounded); SetBool(Parameters.FALLING, !GetBool(Parameters.GROUNDED) && basicPlayerMovement.rb.velocity.y < 0); SetBool(Parameters.MOVING, movement != Vector2.zero); SetBool(Parameters.WALKING, basicPlayerMovement.currentMoveSpeed <= basicPlayerMovement.sprintSpeed -1.5f && basicPlayerMovement.currentMoveSpeed >= basicPlayerMovement.crouchSpeed + 0.1f); SetBool(Parameters.SPRINTING, basicPlayerMovement.currentMoveSpeed > basicPlayerMovement.sprintSpeed - 1.5f); } void StandMoveAnim(){ if(Input.GetKey(KeyCode.LeftControl)) return; if(GetBool(Parameters.GROUNDED) && GetBool(Parameters.SPRINTING)){ PlayNormalAnimationWithCrossfade(Animations.RUNNING); } else if(GetBool(Parameters.GROUNDED) && GetBool(Parameters.WALKING)){ PlayNormalAnimationWithCrossfade(Animations.WALKING); } else if (GetBool(Parameters.FALLING)){ PlayNormalAnimationWithCrossfade(Animations.IN_AIR); } } void CrouchAnim(){ if(!GetBool(Parameters.MOVING) && Input.GetKeyDown(KeyCode.LeftControl)){ SetLocked(false, 0); Play(new(Animations.STAND_TO_CROUCH, true, null, 0.1f)); } if(Input.GetKey(KeyCode.LeftControl)){ playIdle = false; if(GetBool(Parameters.MOVING)){ PlayNormalAnimationWithCrossfade(Animations.CROUCH_WALK, 0.15f); } else{ PlayNormalAnimationWithCrossfade(Animations.CROUCH_IDLE_01, 0.135f); } } if(!GetBool(Parameters.MOVING) && Input.GetKeyUp(KeyCode.LeftControl)){ SetLocked(false, 0); Play(new(Animations.CROUCH_TO_STAND, true, new(), 0.1f)); } } void JumpAnim(){ if(GetBool(Parameters.GROUNDED) && Input.GetKeyDown(KeyCode.Space) && !basicPlayerMovement.readyToJump){ Debug.Log("Current Transition: " + anim.GetAnimatorTransitionInfo(0)); SetLocked(false, 0); Play(new(Animations.JUMP_START, true, null, 0.1f)); } } void LoopThroughIdleAnimations(){ if(!isCautious){ switch (randomIdleAnimation){ case 0: PlayNormalAnimationWithCrossfade(Animations.STANDING_IDLE_01); break; case 1: PlayNormalAnimationWithCrossfade(Animations.STANDING_IDLE_02); break; case 2: PlayNormalAnimationWithCrossfade(Animations.STANDING_IDLE_03); break; case 3: PlayNormalAnimationWithCrossfade(Animations.STANDING_IDLE_04); break; case 4: PlayNormalAnimationWithCrossfade(Animations.STANDING_IDLE_05); break; } } else{ switch (randomCautiousIdleAnimation){ case 0: PlayNormalAnimationWithCrossfade(Animations.STANDING_CAUTIOUS_IDLE_01); break; case 1: PlayNormalAnimationWithCrossfade(Animations.STANDING_CAUTIOUS_IDLE_02); break; } } } //Just to make it shorter private void PlayNormalAnimationWithCrossfade(Animations _animation, float _crossfade = 0.2f){ Play(new(_animation, false, null, _crossfade)); } public override void DefaultAnimation(int layer) { if(Input.GetKey(KeyCode.LeftControl)) return; if(!GetBool(Parameters.MOVING) && GetBool(Parameters.GROUNDED) && !GetBool(Parameters.FALLING)) playIdle = true; else playIdle = false; } } My Parameters in the Animator Editor are: On JUMP_START: Falling Parameter -> Play IN_AIR Animation On IN_AIR: Grounded Parameter -> Play JUMP_LAND Animation -> Next Play RESET On JUMP_LAND: Walking Parameter -> WALKING Animation ; Running Parameter -> RUNNING Animation ;
man I cant Thank you enough😭😭
I think this is great! But I take some minor architectural issues with how some of this logic was explained. Animation should be a layer on top of your game to give context as to what is happening, NOT something that manages direct control over how your game plays. More specifically that reload bit at the start, because what you said implies (A) reloading has a zero waiting period or hangover time where you aren't reloading anymore but animation lasts longer, and (B) possibly is purely aesthetic which serves no purpose than an extra button press that interrupts a game's core combat mechanic. In the first case, that means you have an issue where the animations are feeding players with misinformation on the state of what is happening in your game. In the second case, its self explanatory that its poor game design to have such a purely aesthetic feature be in the way of players utilizing your core mechanics without it being one itself. Reload times are supposed to be uninterruptible from shooting again by its game design to support more tension / periods of vulnerability, and should already be in your non-animation game logic meaning your animation shouldn't ever be in that position in the first place. Bah, I am just nitpicking your examples though. The video was great nonetheless, and tackles issues Unity's animator gets in the way of. Good work!
omg I always hated to animated in the animator now I can do it through code TYSM!
amazing! ✨
That's so cool
tbh just used first part of video🤣
I liked the background SFX you used.
Hello there, I wanted to organize my Animations with state machines. Now the Animation won't switch anymore. I think it's because it's not in the "area" anymore. Does anyone know if it's possible to switch between state machines and how? Thank you for any answers! Edit: I'm able to access the AnimatorController and through that the Base Layer as an AnimatorStateMachine. How could I switch the StateMachine...?
Brother, I cannot believe the amount of work you just provided us. THANK YOU.
Liked and subscribed, is there anything you need?
Amazing video! Much appreciated works great.💯
These are so bad; post processing isn't as simple as "throwing some filters" onto things. Cheap lazy devs do this all the time and it makes me pull my hair out every time I see an overblown bloom and unnecessary chromatic aberration that destroys the entire clarity. Thankfully people who do these are incompetent, so they aren't making games worthy of playing.
I understand where you’re coming from. It can be frustrating when it seems most devs use a generalised/one size fits all approach to graphics. But that is not what I’m here to do. I strive to spark inspiration and deliver niche concepts surrounding the game dev tutorial scene. These ideas should be treated as a starting point, rather than a complete solution. For example, I pulled Chromatic Dizziness from SOMA as an inspiration and in the video I show how to approach making this similar effect in your own projects. All I’m here to do is spark inspiration, I love seeing what my viewers can create with these concepts.
This video is great. Guy who commented this needs a Xanax. Thanks for the great vid
Pretty cool and handy tool Professor SHG. Ever considered working on distance based scene /room/Area/Zone Loading . I've tried making this system multiple times but it either crashes or assets don't properly load in and out.
Ho ho thank you! So it sounds like the tool you’re going for is some type of distance-based occlusion culler. I did make something similar when I made the Mutantity demo. For it I made a mountain range and caves for the player to explore. But I did cheat a little bit with loading objects in (shh don’t tell anyone 🤫). I made colliders around the map so when the player walks on them, it would disable all game objects the isn’t tied to the particular section of the map. Such as I had Outside, Cave 1, Cave 2, Water Cave, and Mines. The children of those gameobjects were the meshes related to those sections, and only one was active at a time (unless it was transitioning between sections). Not sure if that helps, I just went for the easy, cheeky approach.
@@SmallHedgeHQ oh , that does sound like it could work thanks ill try that approach. keep up the good work professor your content is a blessing
I'm probably gonna sound like a jerk here but I'd want to know this if I was the content creator so... I saw your thumbnail in my feed and was about to click on it and watch it, until I saw it was for Unity. After they pulled the whole *'you retroactively owe us tons of money because we can'* stunt no one is using Unity anymore. You should try switching to Godot. It supports C# too. Open source and free is the way of the future 👍
While godot has gotten much popular it is still far inferior to unity in both functionality and popularity
Thanks!, New Zealand??
Oh yeah😁
Thanks dude you saved me from hell!
Awesome tut!
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
Could not get this working hit up hedge no reply :( Stripped my game of it.
Sucks to hear. If you have a specific question, I can help you out with it :)
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
Does this support skinned meshes??
Not at the moment, but there will be an update in 2-3 weeks including that feature.
The latest update of Mesh Wrapper now supports skinned meshes. th-cam.com/video/DSptzgj8uu0/w-d-xo.html
@@SmallHedgeHQ Awesome! Thanks for the update. :)
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
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.
@@SmallHedgeHQ Oh, ok i'll try it
Although I see that the fix was implemented on the code, I do think, as an audio producer first and foremost, that it's best to properly batch normalize the audio on audacity before trying to implement it (maybe even slightly mastering it as well). It's generally better practice to have every sound file be uniformly functional from the get go than tweaking each individual sound.
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.
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.
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!
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
Is there no way to replace the audio clips with pointers to them until a given condition is hit?
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!
does this method only works for 3d ?
For 2d and 3d! I actually showcase how to use these techniques in 2d in the next video of the series 😁th-cam.com/video/9tvDtS1vYuM/w-d-xo.html
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
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.
@@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.
@@OrbitZeroStudios hmm that is really bizarre. I’ll look into it tomorrow. Thanks for letting me know
@@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];
@@OrbitZeroStudios aha that would make sense!