r/Unity3D – Telegram
r/Unity3D
259 subscribers
12.6K photos
15.5K videos
14 files
47.8K links
News about the Unity engine and project showcases from Reddit. Made possible with @reddit2telegram (@r_channels).
Download Telegram
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
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
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
HingeJoint2D vs SpringJoint2D to emulate spine movement?

I am leaning towards SpringJoint, but would like to ask those who know better. For reference, Unity 6, topdown, trying to take full advantage of the physics engine.

https://redd.it/1hpuh9r
@r_Unity3D
Any good reading on project structure/organization/layout?

Specifically reading, I'm burned out on Youtube videos already. I'm not looking for the "what's the BEST way to do xyz", since I know it's all specific to the project. I guess instead I'm looking for opinionated stuff, or writeups to the effect of "this is a good way to create a 2D game/project", or just examples of widely accepted standards/conventions, but in regards project organization and structure not coding.


tbh anything you think useful that doesn't fit those parameters helps too ty

https://redd.it/1hpw099
@r_Unity3D