Member variables and their prefix
Let me start by saying that I’m aware that a great deal of this is subjective, based on specific needs and/or is personal preference.
Having said that, can someone please ELI5 local/member variables and the use of, for example,
I read on the unity forum that using them “.. solves all potential problems with ambiguity with member variables or local variables.”
This is how i interpret the prefix: say you have a
Please share your opinions, as thoroughly as you’d like. Use analogies though my brain works better that way 🙂
https://redd.it/1hp2trn
@r_Unity3D
Let me start by saying that I’m aware that a great deal of this is subjective, based on specific needs and/or is personal preference.
Having said that, can someone please ELI5 local/member variables and the use of, for example,
m_. Or any other pattern for that matter, like appending an “a” prefix or a singular underscore, etc. I read on the unity forum that using them “.. solves all potential problems with ambiguity with member variables or local variables.”
This is how i interpret the prefix: say you have a
Player noscript. In it, you call a method from your Inventory noscript and pass in a variable defined outside of both Player and Inventory. Should that variable have a prefix of some sort? i.e instead of int number it should be int _number?Please share your opinions, as thoroughly as you’d like. Use analogies though my brain works better that way 🙂
https://redd.it/1hp2trn
@r_Unity3D
Thinking of Starting a YouTube Channel for the "99% Club" of Indie Games
Hey fellow devs,
So, I had this brilliant idea at 2 a.m. (you know, when the best ideas come to life): What if I started a YouTube channel dedicated to showcasing solo and small indie games? Not the ones already hogging the limelight on Steam's front page, but the real underdogs. The demos, prototypes, and games that might only have a couple of downloads but still represent hundreds of hours of blood, sweat, and questionable life choices.
I mean, let’s face it—we’ve all daydreamed about someone playing our game on YouTube, leaving wholesome (or hilarious) feedback, right? I want to be that person for you. The indie dev’s indie dev. The champion of games that are “a bit rough” but brimming with passion.
Now, full disclosure:
I haven’t actually started the channel yet.
I have no editing skills (lol).
I’m a socially awkward gremlin (hi).
I also don’t know if this kind of self-promoting-post-but-not-really is allowed here, so mods, pls don’t smite me.
But I made a placeholder YouTube channel because I’m serious-ish about this: https://www.youtube.com/@TheHoardWorkshop. There’s nothing there yet except dreams and a doodle of a guy I might turn into a PNGtuber/animation style mascot. Think “Jaiden Animations but worse,” because simplifying is hard, okay?
So here’s the deal:
What do you think of this idea? Am I setting myself up for heartbreak and 3 views per video, or could this actually be useful for the dev community?
Tell me about your games! I don’t care if it’s a demo, prototype, or some weird experiment that’s been quietly chilling on Steam for years—if it hasn’t hit the big time, I wanna see it.
Also, if someone’s already doing this better, drop their link in the comments. I’ll happily support them instead (and maybe save myself from a slow spiral into video editing madness).
Thanks for reading my ramble! I’d love to hear your thoughts—and your games! :D
https://redd.it/1hp5gn2
@r_Unity3D
Hey fellow devs,
So, I had this brilliant idea at 2 a.m. (you know, when the best ideas come to life): What if I started a YouTube channel dedicated to showcasing solo and small indie games? Not the ones already hogging the limelight on Steam's front page, but the real underdogs. The demos, prototypes, and games that might only have a couple of downloads but still represent hundreds of hours of blood, sweat, and questionable life choices.
I mean, let’s face it—we’ve all daydreamed about someone playing our game on YouTube, leaving wholesome (or hilarious) feedback, right? I want to be that person for you. The indie dev’s indie dev. The champion of games that are “a bit rough” but brimming with passion.
Now, full disclosure:
I haven’t actually started the channel yet.
I have no editing skills (lol).
I’m a socially awkward gremlin (hi).
I also don’t know if this kind of self-promoting-post-but-not-really is allowed here, so mods, pls don’t smite me.
But I made a placeholder YouTube channel because I’m serious-ish about this: https://www.youtube.com/@TheHoardWorkshop. There’s nothing there yet except dreams and a doodle of a guy I might turn into a PNGtuber/animation style mascot. Think “Jaiden Animations but worse,” because simplifying is hard, okay?
So here’s the deal:
What do you think of this idea? Am I setting myself up for heartbreak and 3 views per video, or could this actually be useful for the dev community?
Tell me about your games! I don’t care if it’s a demo, prototype, or some weird experiment that’s been quietly chilling on Steam for years—if it hasn’t hit the big time, I wanna see it.
Also, if someone’s already doing this better, drop their link in the comments. I’ll happily support them instead (and maybe save myself from a slow spiral into video editing madness).
Thanks for reading my ramble! I’d love to hear your thoughts—and your games! :D
https://redd.it/1hp5gn2
@r_Unity3D
YouTube
TheHoardWorkshop
Welcome to The Hoard Workshop! 🛠️✨
This is the treasure trove where the underdogs of indie games get their moment to shine! We’re talking about the prototypes, demos, and passion projects that haven’t hit the hot pages—but totally deserve some love.
I’m…
This is the treasure trove where the underdogs of indie games get their moment to shine! We’re talking about the prototypes, demos, and passion projects that haven’t hit the hot pages—but totally deserve some love.
I’m…
Thinking of Starting a YouTube Channel for the "99% Club" of Indie Games
Hey fellow devs,
So, I had this brilliant idea at 2 a.m. (you know, when the best ideas come to life): What if I started a YouTube channel dedicated to showcasing solo and small indie games? Not the ones already hogging the limelight on Steam's front page, but the real underdogs. The demos, prototypes, and games that might only have a couple of downloads but still represent hundreds of hours of blood, sweat, and questionable life choices.
I mean, let’s face it—we’ve all daydreamed about someone playing our game on YouTube, leaving wholesome (or hilarious) feedback, right? I want to be that person for you. The indie dev’s indie dev. The champion of games that are “a bit rough” but brimming with passion.
Now, full disclosure:
I haven’t actually started the channel yet.
I have no editing skills (lol).
I’m a socially awkward gremlin (hi).
I also don’t know if this kind of self-promoting-post-but-not-really is allowed here, so mods, pls don’t smite me.
But I made a placeholder YouTube channel because I’m serious-ish about this: https://www.youtube.com/@TheHoardWorkshop. There’s nothing there yet except dreams and a doodle of a guy I might turn into a PNGtuber/animation style mascot. Think “Jaiden Animations but worse,” because simplifying is hard, okay?
So here’s the deal:
What do you think of this idea? Am I setting myself up for heartbreak and 3 views per video, or could this actually be useful for the dev community?
Tell me about your games! I don’t care if it’s a demo, prototype, or some weird experiment that’s been quietly chilling on Steam for years—if it hasn’t hit the big time, I wanna see it.
Also, if someone’s already doing this better, drop their link in the comments. I’ll happily support them instead (and maybe save myself from a slow spiral into video editing madness).
Thanks for reading my ramble! I’d love to hear your thoughts—and your games! :D
https://redd.it/1hp5hbo
@r_Unity3D
Hey fellow devs,
So, I had this brilliant idea at 2 a.m. (you know, when the best ideas come to life): What if I started a YouTube channel dedicated to showcasing solo and small indie games? Not the ones already hogging the limelight on Steam's front page, but the real underdogs. The demos, prototypes, and games that might only have a couple of downloads but still represent hundreds of hours of blood, sweat, and questionable life choices.
I mean, let’s face it—we’ve all daydreamed about someone playing our game on YouTube, leaving wholesome (or hilarious) feedback, right? I want to be that person for you. The indie dev’s indie dev. The champion of games that are “a bit rough” but brimming with passion.
Now, full disclosure:
I haven’t actually started the channel yet.
I have no editing skills (lol).
I’m a socially awkward gremlin (hi).
I also don’t know if this kind of self-promoting-post-but-not-really is allowed here, so mods, pls don’t smite me.
But I made a placeholder YouTube channel because I’m serious-ish about this: https://www.youtube.com/@TheHoardWorkshop. There’s nothing there yet except dreams and a doodle of a guy I might turn into a PNGtuber/animation style mascot. Think “Jaiden Animations but worse,” because simplifying is hard, okay?
So here’s the deal:
What do you think of this idea? Am I setting myself up for heartbreak and 3 views per video, or could this actually be useful for the dev community?
Tell me about your games! I don’t care if it’s a demo, prototype, or some weird experiment that’s been quietly chilling on Steam for years—if it hasn’t hit the big time, I wanna see it.
Also, if someone’s already doing this better, drop their link in the comments. I’ll happily support them instead (and maybe save myself from a slow spiral into video editing madness).
Thanks for reading my ramble! I’d love to hear your thoughts—and your games! :D
https://redd.it/1hp5hbo
@r_Unity3D
YouTube
TheHoardWorkshop
Welcome to The Hoard Workshop! 🛠️✨
This is the treasure trove where the underdogs of indie games get their moment to shine! We’re talking about the prototypes, demos, and passion projects that haven’t hit the hot pages—but totally deserve some love.
I’m…
This is the treasure trove where the underdogs of indie games get their moment to shine! We’re talking about the prototypes, demos, and passion projects that haven’t hit the hot pages—but totally deserve some love.
I’m…
Media is too big
VIEW IN TELEGRAM
After a year of development and polishing, My memory-game roguelike now has a release trailer! Let me know what you think & does it explain the game well?
https://redd.it/1hp8ceh
@r_Unity3D
https://redd.it/1hp8ceh
@r_Unity3D
What is considered best practice as far as propelling an object forward?
Thinking of ditching setting up velocity alltogether, and just adding force instead. Any potential pitfalls that I might be missing? This is for Top down perspective.
https://redd.it/1hpboit
@r_Unity3D
Thinking of ditching setting up velocity alltogether, and just adding force instead. Any potential pitfalls that I might be missing? This is for Top down perspective.
https://redd.it/1hpboit
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
I want my game to look more like the second picture. Any suggestions?
https://redd.it/1hpbeg4
@r_Unity3D
https://redd.it/1hpbeg4
@r_Unity3D
Reddit
From the Unity2D community on Reddit: I want my game to look more like the second picture. Any suggestions?
Explore this post and more from the Unity2D community
Can someone help mmake this shotgun work
On the shot gun object i have 5 emptys that the bullets spawn at. some are angled so the shot gun has a spread but that's not working. I think it is because even though their spawning angled, the velocity is still the vector2 from the mouse and player. I've been trying everything I can think of for about 30 minutes. A lot of this code is Chat gpt and I understand most of it but I'm still not skilled to enough to fix this problem. Thank you for anyhelp
https://redd.it/1hpfaqj
@r_Unity3D
On the shot gun object i have 5 emptys that the bullets spawn at. some are angled so the shot gun has a spread but that's not working. I think it is because even though their spawning angled, the velocity is still the vector2 from the mouse and player. I've been trying everything I can think of for about 30 minutes. A lot of this code is Chat gpt and I understand most of it but I'm still not skilled to enough to fix this problem. Thank you for anyhelp
{public Transform player;public Rigidbody2D PlayerRb;public float orbitRadius = .2f;public GameObject bulletPrefab;public Transform firePoint1;public Transform firePoint2;public Transform firePoint3;public Transform firePoint4;public Transform firePoint5;public float bulletSpeed = 10f; private Vector3 mousePosition;void Update(){if (player == null){Debug.LogWarning("Player reference is missing.");return;}mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);mousePosition.z = 0; // Mkae sure z is 0 for 2D spaceVector2 directionToMouse = (mousePosition - player.position).normalized;Vector2 orbitPosition = (Vector2)player.position + directionToMouse * orbitRadius;transform.position = orbitPosition;// Rotate the gun to face the mousefloat rotationAngle = Mathf.Atan2(directionToMouse.y, directionToMouse.x) * Mathf.Rad2Deg;transform.rotation = Quaternion.Euler(0, 0, rotationAngle);// Flip the gun if it's on the left side of the playerif (directionToMouse.x < 0){transform.localScale = new Vector3(1, -1, 1); // Flip vertically}else{transform.localScale = new Vector3(1, 1, 1); // Normal orientation}if (Input.GetMouseButtonDown(0)) // Left mouse button{Shoot(directionToMouse);}}void Shoot(Vector2 direction){Debug.Log(direction);if (bulletPrefab == null || firePoint1 == null){Debug.LogWarning("Bullet prefab or fire point is missing.");return;}// Store the fire points in an arrayTransform[] firePoints = { firePoint1, firePoint2, firePoint3, firePoint4, firePoint5 };// Loop through each fire pointforeach (Transform firePoint in firePoints){// Instantiate the bullet at the fire pointGameObject bullet = Instantiate(bulletPrefab, firePoint.position, firePoint.rotation);// Apply velocity to the bulletRigidbody2D rb = bullet.GetComponent<Rigidbody2D>();if (rb != null){rb.velocity = direction * bulletSpeed + PlayerRb.velocity;}}}}https://redd.it/1hpfaqj
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
Educational Books for Unity 2D?
What are some books or e-books I should pickup to learn how to build games in 2D with Unity?
https://redd.it/1hpgbzn
@r_Unity3D
What are some books or e-books I should pickup to learn how to build games in 2D with Unity?
https://redd.it/1hpgbzn
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
can someone tell me what this EditorLoop is and what causes it so that it makes my game drop so many frames??
https://redd.it/1hpbky3
@r_Unity3D
https://redd.it/1hpbky3
@r_Unity3D
Where do i start?
For context. i want to learn game dev or coding for the frist time. i am pretty confused where to start.
so could someone give good advive or a good tutorial?
Thanks!
https://redd.it/1hp5bpz
@r_Unity3D
For context. i want to learn game dev or coding for the frist time. i am pretty confused where to start.
so could someone give good advive or a good tutorial?
Thanks!
https://redd.it/1hp5bpz
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
How to optimize the generation of a lot of GameObjects at once
I have a mining game where each square is a gameobject, and I need to instantiate 4,800 of them (3 sets of 1,600) when the game starts. (The world is procedurally generated, and when the player mines an entire set, another set of 1,600 is generated, while the topmost set is deleted.)
I've already optimized performance with the shadow that appears (the black part in the image). Essentially, as long as a block isn't discovered, it doesn't perform any functions, and its rigidbody and colliders are disabled, but i still have to instantiate them all.
The issue is that the game lags when the player clicks to start the game and when a new set is generated, even though the lag is smaller in the latter case.
How can I optimize this further? I thought about adding a loading screen before the game starts, but what about when the game is already running?
About the code, it generate the blocks in a matrix of strings first, and them loops through every cell of the matrix instantiating the respective block one by one.
I appreciate any tips or suggestions!
https://preview.redd.it/63agn5y6rz9e1.png?width=1296&format=png&auto=webp&s=33b0f285bcc438c581cab4d70bd3f9bcd0ca8dfe
https://preview.redd.it/bip9os0arz9e1.png?width=1296&format=png&auto=webp&s=b6ad791c55b4c1ad7442f12b688d2ec526a4bc64
https://preview.redd.it/g89bzgvjrz9e1.png?width=636&format=png&auto=webp&s=9655ede983c98e85159cb98dc6d50199db76c4bd
https://redd.it/1hpnnpu
@r_Unity3D
I have a mining game where each square is a gameobject, and I need to instantiate 4,800 of them (3 sets of 1,600) when the game starts. (The world is procedurally generated, and when the player mines an entire set, another set of 1,600 is generated, while the topmost set is deleted.)
I've already optimized performance with the shadow that appears (the black part in the image). Essentially, as long as a block isn't discovered, it doesn't perform any functions, and its rigidbody and colliders are disabled, but i still have to instantiate them all.
The issue is that the game lags when the player clicks to start the game and when a new set is generated, even though the lag is smaller in the latter case.
How can I optimize this further? I thought about adding a loading screen before the game starts, but what about when the game is already running?
About the code, it generate the blocks in a matrix of strings first, and them loops through every cell of the matrix instantiating the respective block one by one.
I appreciate any tips or suggestions!
https://preview.redd.it/63agn5y6rz9e1.png?width=1296&format=png&auto=webp&s=33b0f285bcc438c581cab4d70bd3f9bcd0ca8dfe
https://preview.redd.it/bip9os0arz9e1.png?width=1296&format=png&auto=webp&s=b6ad791c55b4c1ad7442f12b688d2ec526a4bc64
https://preview.redd.it/g89bzgvjrz9e1.png?width=636&format=png&auto=webp&s=9655ede983c98e85159cb98dc6d50199db76c4bd
https://redd.it/1hpnnpu
@r_Unity3D
Shader graph doesn't update properly
I'm trying to fake 2d shadow by using Shader Graph. A child object of the player will get sprite from parent every frame and then turn it in to shadow with shader. Problem is it doesn't render every few frame, and it is slower than the texture updating. If I don't use the shader then the child object update fine, showing same texture as the player. (I plan to optimize the shader after fixing this so it looks awful right now haha...)
https://drive.google.com/file/d/1jcRiL0ZxGkqT4dD5yM2WBTLe001\_wUkf/view?usp=drive\_link
https://redd.it/1hpq3b3
@r_Unity3D
I'm trying to fake 2d shadow by using Shader Graph. A child object of the player will get sprite from parent every frame and then turn it in to shadow with shader. Problem is it doesn't render every few frame, and it is slower than the texture updating. If I don't use the shader then the child object update fine, showing same texture as the player. (I plan to optimize the shader after fixing this so it looks awful right now haha...)
https://drive.google.com/file/d/1jcRiL0ZxGkqT4dD5yM2WBTLe001\_wUkf/view?usp=drive\_link
https://redd.it/1hpq3b3
@r_Unity3D
Webgl ads / gartic phone game
We havent been abls to find a a way to put ads in webgl games , anyone knows what gartic phone uses for full page ads? Or any webgl ad networks?
https://redd.it/1hpqv1k
@r_Unity3D
We havent been abls to find a a way to put ads in webgl games , anyone knows what gartic phone uses for full page ads? Or any webgl ad networks?
https://redd.it/1hpqv1k
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
Unity ready ISS, Endeavour Shuttle, NASA Crawler & Rigged Astronaut
https://redd.it/1hpp488
@r_Unity3D
https://redd.it/1hpp488
@r_Unity3D
Reddit
From the Unity3D community on Reddit: Unity ready ISS, Endeavour Shuttle, NASA Crawler & Rigged Astronaut
Explore this post and more from the Unity3D community