156
News about the Unity engine and project showcases from Reddit. Made possible with @reddit2telegram (@r_channels).
Relax and shoot robots under night sky! in this 2D game for android!
https://play.google.com/store/apps/details?id=com.luka.survivorexe&hl=en
https://redd.it/1omfmw4
@r_Unity3D
Unity + Dolphinbar (wiimote) motion controls
Hi all, I am making a game with wiimote inputs using a dolphinbar to connect the controller to my computer. Using mode 3, I can use 'listen' in the inputs action editor to get all my inputs working. All aside from motion controls. I cant even tell if motion controls are part of mode 3. When playing games in dolphin emulator (using mode 4 - wiimote emulator mode), motion controls work fine but when trying to use it in unity, I cant find anyway to recieve any input from it. I am aware of all the libraries that exist but they are outdated to the version of unity that I am working in (6000.1.11f1) as well as I am a bit clueless on how to use any of them. Any help is appriciated.
https://redd.it/1omm8o0
@r_Unity3D
This went viral on YouTube... Thought you'd find it funny
https://www.youtube.com/shorts/-pnTwFm-EMw
https://redd.it/1omkdsv
@r_Unity3D
Surprised how easy this steering trick was to implement.
https://redd.it/1omgkcm
@r_Unity3D
How do i prevent double jumping
so my player keeps double jumping if i spam W
my code:
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.InputSystem;
public class newmovement : MonoBehaviour
{
[SerializeField\] private Animator walk_0;
public Rigidbody2D rb;
public Transform groundCheck;
public LayerMask groundLayer;
private PlayerRespawn playerRespawn;
private AudioSource audioSource;
public AudioClip jumpClip;
public AudioClip deathClip;
private float horizontal;
public float speed = 8f;
public float jumpingPower = 16f;
private bool isFacingRight = true;
[SerializeField\] float pitchVariance = 0.05f;
private float jumpBufferTime = 0.2f;
private float jumpBufferCounter;
private float coyoteTime = 0.2f;
private float coyoteTimeCounter;
void Start()
{
playerRespawn = GetComponent<PlayerRespawn>();
audioSource = GetComponent<AudioSource>();
}
// Update is called once per frame
private bool isGrounded()
{
return Physics2D.OverlapCircle(groundCheck.position, 0.2f, groundLayer);
}
private void Flip()
{
if (isFacingRight && horizontal < 0f || !isFacingRight && horizontal > 0f)
{
isFacingRight = !isFacingRight;
UnityEngine.Vector2 localScale = transform.localScale;
localScale.x *= -1f;
transform.localScale = localScale;
}
}
public void Move(InputAction.CallbackContext context)
{
horizontal = context.ReadValue<Vector2>().x;
}
void Update()
{
if (Mathf.Abs(rb.linearVelocity.x) > 0.05f)
{
walk_0.SetBool("walking", true);
}
else
{
walk_0.SetBool("walking", false);
}
Flip();
if (isGrounded())
{
coyoteTimeCounter = coyoteTime;
}
else
{
coyoteTimeCounter -= Time.deltaTime;
}
rb.linearVelocity = new Vector2(horizontal * speed, rb.linearVelocity.y);
if (!isFacingRight && horizontal > 0f)
{
Flip();
}
else if (!isFacingRight && horizontal < 0f)
{
Flip();
}
if (Input.GetButtonUp("Submit"))
{
playerRespawn.Respawn();
}
}
public void Jump(InputAction.CallbackContext context)
{
// Handle jump input buffering
if (context.performed)
{
jumpBufferCounter = jumpBufferTime; // Set the buffer when the jump button is pressed
}
else
{
jumpBufferCounter -= Time.deltaTime; // Decrease the buffer counter over time
}
// Only jump if coyote time is active and we have buffered the jump input
if (coyoteTimeCounter > 0f && jumpBufferCounter > 0f)
{
// Apply the jump velocity (only once)
rb.linearVelocity = new UnityEngine.Vector2(rb.linearVelocity.x, jumpingPower);
// Play jump sound effect
jumpBufferCounter = 0f; // Clear the buffer once the jump has been executed
PlaySFX(jumpClip);
}
// Early jump cut-off (when the jump button is released while rising)
if (context.canceled && rb.linearVelocity.y > 0f)
{
rb.linearVelocity = new Vector2(rb.linearVelocity.x, rb.linearVelocity.y * 0.5f); // Cut the jump short
}
}
private void OnCollisionEnter2D(Collision2D other)
{
if (other.gameObject.CompareTag("spike"))
{
PlaySFX(deathClip);
playerRespawn.Respawn();
}
}
private void PlaySFX(AudioClip audioClip)
{
float randomPitch = Random.Range(1f - pitchVariance, 1f + pitchVariance);
audioSource.pitch = randomPitch;
audioSource.clip = audioClip;
audioSource.Play();
}
public void Interact(InputAction.CallbackContext context)
{
// Handle jump input buffering
if (context.performed)
{
playerRespawn.Respawn();
}
}
}
https://redd.it/1omei5m
@r_Unity3D
Can't fit image to screen resolution
Hey guys, i want to learn unity to make 2D games but I'm getting absolutely furious over this....
So basically i want to create a scrolling background, i have a GameObject called Background which holds two images, a script moves both of those images in one direction and if an image scroll all the way across the screen it moves it to the right edge of the window, pretty simple...
The issue I'm having is i cannot make the image perfectly aligned with the size of my screen, I'm using a resolution of 360x640 and even when i set my grid snap to 0.0000000000001 i still cannot align the image.
I have no clue how I'm supposed to do this...
https://preview.redd.it/yi9jysat9itf1.png?width=310&format=png&auto=webp&s=6630d7946969a39bf7e713743de27c71027f09dc
https://preview.redd.it/55r779iz9itf1.png?width=1622&format=png&auto=webp&s=d38a444b2aff6296a16653fc208578cbc87e4360
This is extremely zoomed in, you can see the scale on the right side and it just doesn't make any sense to me at all. In godot i could easily make the image fit my screen.
Every answer i got from chatgpt was either some crazy long math equations done with code which doesn't even make sense, how could something so simple require code whatsoever.
Am i absolutely dumb or is unity just designed this weirdly ? Thanks for any help.
https://redd.it/1nzljb6
@r_Unity3D
One of the strangest mechanics you can use in my indie game is this one that makes any object turn into an NPC
https://redd.it/1nzo6oc
@r_Unity3D
Hollow Mine releases just in 3 days on Steam! Journey begins - October 9. Hit that wishlist button hard!
https://redd.it/1nzniil
@r_Unity3D
Animators are gone. Please help
I'm completely new to game development and unity.
I was working on UI's when this happened and I don't know what caused this.
And now all my animators are gone. I don't know if it's ok to save and reopen my project..
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.Graphs.AnimationStateMachine.Graph.GenerateConnectionKey (UnityEditor.Graphs.Node srcNode, UnityEditor.Graphs.Node dstNode) (at <1e33adae5e6d4bdea86244c86781fc9d>:0)
UnityEditor.Graphs.AnimationStateMachine.Graph.GetEdgeInfo (UnityEditor.Graphs.Edge edge) (at <1e33adae5e6d4bdea86244c86781fc9d>:0)
UnityEditor.Graphs.AnimationStateMachine.EdgeGUI.DoEdges () (at <1e33adae5e6d4bdea86244c86781fc9d>:0)
UnityEditor.Graphs.AnimationStateMachine.GraphGUI.OnGraphGUI () (at <1e33adae5e6d4bdea86244c86781fc9d>:0)
UnityEditor.Graphs.AnimatorControllerTool.StateMachineView (UnityEngine.Rect position, System.Single zoomLevel) (at <1e33adae5e6d4bdea86244c86781fc9d>:0)
UnityEditor.Graphs.AnimatorControllerTool.DoGraph (UnityEngine.Rect graphRect, System.Single zoomLevel) (at <1e33adae5e6d4bdea86244c86781fc9d>:0)
UnityEditor.Graphs.AnimatorControllerTool.<SetupGUI>b__141_12 () (at <1e33adae5e6d4bdea86244c86781fc9d>:0)
UnityEditor.Graphs.AnimatorControllerTool.ScopedOnGUI (System.Action onGUIHandler) (at <1e33adae5e6d4bdea86244c86781fc9d>:0)
UnityEditor.Graphs.AnimatorControllerTool.<SetupGUI>b__141_10 () (at <1e33adae5e6d4bdea86244c86781fc9d>:0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <d6f576415dfd4add8f23aa1d383d68cc>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <d6f576415dfd4add8f23aa1d383d68cc>:0)
UnityEngine.UIElements.IMGUIContainer.DoIMGUIRepaint () (at <d6f576415dfd4add8f23aa1d383d68cc>:0)
UnityEngine.UIElements.UIR.RenderChainCommand.ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams drawParams, System.Single pixelsPerPoint, System.Exception& immediateException) (at <d6f576415dfd4add8f23aa1d383d68cc>:0)
Rethrow as ImmediateModeException
UnityEngine.UIElements.UIR.RenderChain.Render () (at <d6f576415dfd4add8f23aa1d383d68cc>:0)
UnityEngine.UIElements.UIRRepaintUpdater.Render () (at <d6f576415dfd4add8f23aa1d383d68cc>:0)
UnityEngine.UIElements.BaseVisualElementPanel.Render () (at <d6f576415dfd4add8f23aa1d383d68cc>:0)
UnityEngine.UIElements.Panel.Render () (at <d6f576415dfd4add8f23aa1d383d68cc>:0)
UnityEditor.UIElements.EditorPanel.Render () (at <e019b6f8bc824de1922b414eb1b0dbe6>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <d6f576415dfd4add8f23aa1d383d68cc>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <d6f576415dfd4add8f23aa1d383d68cc>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <d6f576415dfd4add8f23aa1d383d68cc>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <d6f576415dfd4add8f23aa1d383d68cc>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <fd268454062e4931ba4011422e690489>:0)
https://preview.redd.it/131dtxrt6itf1.png?width=1919&format=png&auto=webp&s=fdafbe36e8ed5b7b749f4491b0236143f5c8c353
https://redd.it/1nzkxwl
@r_Unity3D
The giraffe animation is done with just a few VERY basic key-framed animations, blended with wobbly physics(tm), IK for the arms and my hi-tech neck tech.
https://redd.it/1nzhvqe
@r_Unity3D
[Project ELYRA] Full showcase
https://redd.it/1nzdl5x
@r_Unity3D
Jump ramps for tanks
https://redd.it/1nzcleu
@r_Unity3D
Mini Simple Characters | Skeleton | Free Demo
https://redd.it/1nz2fjq
@r_Unity3D
This is How I Fixed the Projectile Movement in My Indie FPS Game, According to Rocket Science. (Before and After)
https://redd.it/1nz0ptw
@r_Unity3D
Thrust Game Dev Video
https://youtube.com/watch?v=tobYkEEwRiA&si=id2sPg4f3NqtokgK
https://redd.it/1omm1n5
@r_Unity3D
How do you approach a melee combat system?
I'm stumped on how to implement a melee combat system. I'm trying to make it an advanced one, where users can edit their movesets.
It's not quite like a fighting game. If anything, it'd be somewhat similar to the Nioh 2 skill tree, but in 2D, of course.
How do you guys approach this? I tried the following but there are some things I can't quite get right.
* **Finite State Machines:** This gets pretty wonky. I tried two ways: A state for each attack, which is obviously really unsustainable in the long term if I want to have an advanced skill tree, and it just seemed silly adding a state for every single attack. And the other way is just 3 states of "Light", "Medium" and "Heavy" attacks. This seems to be the way to go *on paper* but I'm not sure how to actually handle this codewise? How do I attach animations to each state this way?
Can I use Scriptable Objects to store attack data? In that case, how do I handle the hitboxes? Are they in the code, or in the animation itself as key events? How do I even handle hitboxes if each attack is unique? Do I include start-up frames, active frames and recovery frames in the SO itself or is it a part of the animation events?
How do I do all of this with the *minimum* number of 'systems' possible so it's good design that's easy to expand upon? (This is more of an engineering question ig)
It's very complex for someone like me who's just trying to figure things out. I'm fine doing very simple things like regular attacks, a single keybound ability (ala Hollow Knight-type of combat) but once I want to add variety and customization it just gets REALLY complicated.
https://redd.it/1oml0fm
@r_Unity3D
relax and play this unique 2D shooter for android! where you shoot robots under night sky full of stars and meteors!
https://youtu.be/HjkRX6pJx84?si=uXL7s8SEeq1bRbW0
https://redd.it/1omfpk6
@r_Unity3D
Why are they not colliding?
https://redd.it/1omg0h9
@r_Unity3D
My first game project and user interface — do you like it?
https://redd.it/1omdrus
@r_Unity3D
Is there a way to blend terrain layers smoothly?
https://redd.it/1nzsbip
@r_Unity3D
I'm creating a world of a grim post-Soviet town intertwined with gothic mysticism, vampire secrets, and the story of a 19-year-old young person with a troubled fate. This is my first project and an attempt to explore the life choices of people.
https://redd.it/1nzrfw1
@r_Unity3D
Ratchet Racers demo
https://blessedman.itch.io/ratchet-racers-demo
https://redd.it/1nzpc5f
@r_Unity3D
Our cozy demo is now available!
https://redd.it/1nzkze8
@r_Unity3D
Boss head stretches when near player
https://redd.it/1nzieuf
@r_Unity3D
HELP, Resident evil 4 like inventory system
I am a bad programmer and need help with starting on how to make an inventory system like in resident evil (Like a sword which is 1 wide and 3 height, or a pickaxe which is 3 long in middle and on top is 3 wide)
i need a tutorial on how to make this kind of inventory system, already looked through youtube but there arent any good tutorials, and chatgpt doesnt understand this.
i need this in my game
https://redd.it/1nze71k
@r_Unity3D
Question about the Unity Graph Toolkit: Custom Data
https://redd.it/1nzarox
@r_Unity3D
Terrain-Mesh blending done the easy way (with decals)
https://redd.it/1nyzl2c
@r_Unity3D
Mad Max Polski Fiat
https://redd.it/1nyv3xl
@r_Unity3D
What do you guys think about the idea of becoming detectives with your friends and solving a murder mystery game ?
https://redd.it/1nz2ahx
@r_Unity3D