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