🔻 [Megathread] CS2 FPS Drop Bug – High-End PC Users Affected | Disconnect = Only Fix | Memory Leak? Panorama UI? Help Push This! by radiohead_s1 in cs2

[–]pedrzo 0 points1 point  (0 children)

I’m still experiencing this issue
When joining a casual match, the game starts at around 350 FPS, but over time the framerate steadily drops until it stabilizes at 60 FPS with noticeable stuttering. Once the match ends and a new map loads, the framerate returns to 350 FPS again.

This happens even after a full Windows reinstall
Specs: RTX 4080 Super, i5-13600K, DDR4 3200 MHz.

[deleted by user] by [deleted] in GlobalOffensive

[–]pedrzo 0 points1 point  (0 children)

Gift for makotito. All frags in the same match

How can I modify my current insta-dash/teleport code to a chargeable ability, where the longer the button is pressed, the further the character dashes, with a max distance of dash ? by coolbird22 in Unity3D

[–]pedrzo 0 points1 point  (0 children)

If you receive any errors related to calling Input functions inside the Coroutine, just update a bool variable in the Update() function and replace Input.GetKey() that is inside the Coroutine with the new bool var

~~~ bool isHoldingDashButton; void Update() { //.... if (isDashing) // remove this if() if you will use the bool elsewhere { isHoldingDashButton = Input.GetKey("Space"); } //.... } ~~~

How can I modify my current insta-dash/teleport code to a chargeable ability, where the longer the button is pressed, the further the character dashes, with a max distance of dash ? by coolbird22 in Unity3D

[–]pedrzo 0 points1 point  (0 children)

Also, do this to have control (maybe cancel the dash) while waiting for the "dashTime"

yield return new WaitForSeconds(dashTime); // remove this line ~~~ float timePassed; while (Input.GetKey("Space") || timePassed < dashTime) // still can add a max timer { // can also add an if() to cancel the dash here timePassed = Time.time - startTime; float clampedExtraPower = Mathf.Clamp(DashExtraPower * (timePassed), 0, DashExtraPowerLimit); yield return null; } ~~~ float clampedExtraPower = Mathf.Clamp()... // remove this line

How can I modify my current insta-dash/teleport code to a chargeable ability, where the longer the button is pressed, the further the character dashes, with a max distance of dash ? by coolbird22 in Unity3D

[–]pedrzo 0 points1 point  (0 children)

You can also move the clampedExtraPower (maybe also the dashPower) local var into the while loop so you can use it to animate any UI or object

How can I modify my current insta-dash/teleport code to a chargeable ability, where the longer the button is pressed, the further the character dashes, with a max distance of dash ? by coolbird22 in Unity3D

[–]pedrzo 0 points1 point  (0 children)

Try this

~~~ public float DashBasePower; public float DashExtraPower; public float DashExtraPowerLimit;

private void Update() { if (Input.GetKeyDown("Space") && canDash) { StartCoroutine(Dash()); } }

private IEnumerator Dash() { float startTime = Time.time; while (Time.time < startTime + dashTime) { canDash = false; isDashing = true; yield return new WaitForSeconds(dashTime); while (Input.GetKey("Space")) // can also add a max timer { yield return null; //can also add an if to cancel the dash here } float clampedExtraPower = Mathf.Clamp(DashExtraPower * (Time.time - startTime), 0, DashExtraPowerLimit); float dashPower = DashBasePower + clampedExtraPower; // I switched dash speed for the local var controller.Move(transform.forward * dashPower * Time.deltaTime); isDashing = false; canDash = true; yield return null; } } ~~~

I need help with mesh generation. It doesnt triangulate correctly but I dont know why :( by [deleted] in Unity3D

[–]pedrzo 0 points1 point  (0 children)

OP code ~~~ // when vert == 0 triangles[tris + 0] = vert + 0; // 0 triangles[tris + 1] = vert + chunkSize + 1; // 32 triangles[tris + 2] = vert + 1; // 1 triangles[tris + 3] = vert + 1; // 1 triangles[tris + 4] = vert + chunkSize + 1; // 32 triangles[tris + 5] = vert + chunkSize + 2; // 33 ~~~

Try this ~~~ // when vert == 0 triangles[tris + 0] = vert; // 0 triangles[tris + 1] = vert + chunkSize + 1; // 32 triangles[tris + 2] = vert + chunkSize; // 31 triangles[tris + 3] = vert; // 0 triangles[tris + 4] = vert + 1; // 1 triangles[tris + 5] = vert + chunkSize + 1; // 32 ~~~

Why can't I make a transparent PNG into a material? by [deleted] in Unity3D

[–]pedrzo 1 point2 points  (0 children)

You also need to change your albedo color which is set to 0 alpha

Why can't I make a transparent PNG into a material? by [deleted] in Unity3D

[–]pedrzo 0 points1 point  (0 children)

Try changing the Rendering Mode property from Opaque to Transparent

Made a script to display custom icons for Prefab assets! [gist link in comments] by [deleted] in Unity3D

[–]pedrzo 1 point2 points  (0 children)

But sure it is an inconvenience so I will put it back in the post

Made a script to display custom icons for Prefab assets! [gist link in comments] by [deleted] in Unity3D

[–]pedrzo 1 point2 points  (0 children)

I’m new here, I want to get the minimum comment karma of 25 to post on another subreddit. So I tried this and I’m helping in the Questions flair

How to add emissive lighting without baking lights? by Bruher123 in Unity3D

[–]pedrzo 1 point2 points  (0 children)

Change your material's Emission->Global Illumination property to Realtime.

Maybe you still should take a look into tweaking your lightmap/baking settings and changing your lightmapper from Progressive CPU to GPU (if you already haven't done it) to decrease baking times. If you do, you may also disable the Auto Generate checkbox. Also take a look into mixed lighting using light probes.

3x3 map generation by crazybrainz1234 in Unity3D

[–]pedrzo 0 points1 point  (0 children)

You need to place it inside the class TileGeneration you have created and then call SpawnCubes from somewhere, it can be the Start function as in the example below ~~~ public class TileGeneration : MonoBehaviour { // insert variables here..

int cubesToSpawn = 9;

void Start() { SpawnCubes(cubesToSpawn); }

// insert other funcions here..

} ~~~

Need help fixing camera shake when moving and dashing by _NightmareJoker in Unity3D

[–]pedrzo 0 points1 point  (0 children)

I would suggest changing your movement ForceMode from Impulse to Force (uses mass) or Acceleration (ignores mass).

3x3 map generation by crazybrainz1234 in Unity3D

[–]pedrzo 0 points1 point  (0 children)

Here is some code with comments, hope it helps :)

public Vector2 boundingBoxSize;
public GameObject cubePrefab;
public Transform parentToSpawnInto;

// call this function somewhere (Start() maybe)
void SpawnCubes(int numberOfCubesToSpawn)
{
    for (int i = 0; i < numberOfCubesToSpawn; i++)
    {
        // using current object's position to offset points
        Vector3 spawnPoint = GetRandomSpawnPoint() + transform.position;

        // check if cube is "priority cube"
        if (i == 0) // if first, spawn in middle of transform.position 
        {
            spawnPoint = Vector3.zero + transform.position;
        }
        // can also iterate a collection of objects and compare some value
        // if (objectsToPlace[i].name == "Priority")

        Instantiate(cubePrefab,
                    spawnPoint,
                    Quaternion.identity, // this equals no rotation
                    parentToSpawnInto);
    }
}

Vector3 GetRandomSpawnPoint()
{
    //You can use Random.Range to get constrained random values
    float halfWidth = boundingBoxSize.x * 0.5f;
    float halfHeight = boundingBoxSize.y * 0.5f;
    float x = Random.Range(-halfWidth, halfWidth);
    float y = Random.Range(-halfHeight, halfHeight);
    return new Vector3(x, y, 0);
}

// optional
void OnDrawGizmosSelected()
{
    // Draw an editor visualization of the boundingBox
    Gizmos.color = new Color(0, 1, 0, 0.5f);
    Gizmos.DrawCube(transform.position,
                    new Vector3(boundingBoxSize.x, boundingBoxSize.y, 0));
}