#archived-code-advanced

1 messages ยท Page 132 of 1

tacit harbor
#

But why 55% what influences this

#

Ok I will try

untold moth
tacit harbor
#

2.5 untracked memory 2gb tracked, but maximum is 5.66

untold moth
#

For example, switching between 2 scenes async and/or with additive loading would keep the old scene in memory while the new scene loads as well. Later when the old scene is unloaded, it's memory is released as well, becoming untracked/reserved.

tacit harbor
#

Ok ๐Ÿ‘, async is a good point hmm, about unitask what you think, all code is unitask async

untold moth
#

You should really use the dedicated tools to investigate it.

#

Memory profiler is great, but it doesn't show the timeline of the app. In this regard, looking at the regular profiler memory module is better.

tacit harbor
#

Ok ๐Ÿ‘ that theme is important in general, I think

untold moth
#

Even better using the platform native tools

tacit harbor
#

Ok dlich thx ๐Ÿ™ for helping

echo coral
#

Adding on to this, with that many tris you probably have considerable overdraw too. Make sure your trees have lods or imposters for super far away and cull foliage after a reasonable distance.

echo coral
mighty shore
#

the game is aimed at simulating a huge world, like cities skylines 2

#

many things

#

and the world is basically Minecraft but juiced with more render distance

#

the game is actually alright ish when just rendering terrain

exotic trout
#

Speaking of Minecraft, might be researching how Distant Horizons does it's stuff? Might pick up some general ideas that may help

mighty shore
#

I believe they render terrains only for far distances?

#

terrains with LOD

#

basically billboards

#

or simplified big shapes

exotic trout
#

I mean given the type of artstyle your currently going for and potentially how many chunks would be fairly static a lot of the time in a game like rimworld that doesn't seem like too much of dissimilar usage. Could be wrong though, just a suggestion

mighty shore
#

without entities the fps is pretty good actually

#

With entities I get about 300 -> 100
its rendering entitites that's eatting up the processing power

#

I ran Profiler, there is oddly lots of blue section(scripts) than green (rendering)

#

I think I figured out the issue

untold moth
mighty shore
#

Each EntityRenderer game object has EntityRenderer component script

void Update(){
        if(isMoving){
            // Lerp for smooth movement
            transform.localPosition = Vector3.Lerp(transform.localPosition, targetPosition, Time.deltaTime * 5);
            if(Vector3.SqrMagnitude(transform.localPosition-targetPosition) < 0.01f){
                isMoving = false;
            }
        }
    }

And I had this code to simulate the movement of entities

#

nothing moves, but just checking (isMoving) caused the significant FPS drop

#

Let me make sure this is the case

#

testing again

untold moth
#

isMoving is likely true

mighty shore
#

that could be the case as well

#

let me make sure by printing something

untold moth
#

At least it's true more then you expect it to be. That lerping is not correct

#

So they would get stuck in a moving state for many frames even when there's very little distance left.

exotic trout
#

Asking more than answering, at scale something like this is better suited for a little burst/jobs thing right?

untold moth
#

Definitely

exotic trout
#

Been looking into jobs for the first time and something like this seems actually not to bad for dipping your toes into?

untold moth
#

Or some kind of system spreading the ticks over several frames

untold moth
mighty shore
#

Well..

    void Update(){
        if(isMoving){
            Debug.Log($"Moving entity {EntityID} to {targetPosition}");
            // Lerp for smooth movement
            transform.localPosition = Vector3.Lerp(transform.localPosition, targetPosition, Time.deltaTime * 5);
            if(Vector3.SqrMagnitude(transform.localPosition-targetPosition) < 0.01f){
                isMoving = false;
            }
        }
    }```
Nothing is being printed, def it is false
#

its does reach the targetposition, it's just not accurate but I wrote it as just a smooth animation look

#

increased Script time usuage as well

#

FPS drop repeating...

#

it's low even when not profiling

untold moth
#

Then use profiler properly and investigate

mighty shore
#

I am using it properly

untold moth
#

You're not. Or not sharing the info with us.

mighty shore
#

well this looks like just bunch of scripts checking bool

untold moth
#

Look at the hierarchy mode and sort by cpu time

#

But anyways, I think it's too early to worry about performance issues. If you have a real scenario where frame time goes above 16.6 ms, then investiagate.

mighty shore
#

I am pretty sure this is the case, I believe you can replicate this issue as well, just make 10,000 game objects and run it with script checking if bool, print something

#

then compare it with a scene with same 10,000 game obejcts without Update function script attached to it

#

I have super strong PC, so I normally find it a red flag if my pc can only pump out 100~ FPS

untold moth
mighty shore
#

well... it takes like 3 mins to replicate this scenario

untold moth
#

It takes even less for you to profile properly and take a screenshot.

#

I don't understand what you're trying to prove. Is there any need for me to reproduce it?

mighty shore
#

okay besides my profiling issue can you explain why a scene with 10,000 game objects with just checking bool takes so long than the one without it? I expected this to be not an obstacle at all

#

I feel like I have to be more careful with scripts now

untold moth
mighty shore
#

Besides it's relateness to my project I am asking out of curiosity to understand works of Unity

#

so that I can code better and understand Unity better

untold moth
untold moth
mighty shore
#

This really is the case

untold moth
#

I don't have any interest in testing that๐Ÿ˜…
If you want to prove something, show the profiler data.

scenic forge
#

It could be calling the script update that's the slow part, not the bool checking.

mighty shore
#

yeah

scenic forge
#

You can try simply commenting out the check but leaving the update method intact and compare.

scenic forge
#

10k comparisons is peanuts for modern computers, I would assume the update call is what's taking up most of the time.

mighty shore
#

even with an empty

    {
        /*
        if (isActive)
        {
            Debug.Log("GameObject is active and running.");
        }
        */
        
    }```
#

the FPS is dropping a lot

#

That's so interesting

untold moth
#

Or you have something else that is causing the issue

#

I really don't understand that stubbornness about not profiling correctly

scenic forge
# mighty shore the FPS is dropping a lot

If your IDE is properly configured, you should even get a diagnostic about empty Unity messages, although I'm not sure if an empty method with comments will trigger that diagnostic or not. But this is basically why the diagnostic exists, calling messages is expensive.

sly grove
mighty shore
#

oh the bool is always false so I am not printing anything ever

#

nothing is ever printed

scenic forge
#

I jumped into the conversation half way so I don't have the full context, but if the conversation is about performance then I 100% agree with @untold moth that you should be profiling rather than guessing at what's slow.

sly grove
#

Yes it's a bad idea to have Update on 10,000 objects

#

You should also profile yes but this is pretty clearcut

#

If you need that many objects in your game you may want to look into ECS

mighty shore
#

yeah I expected my game scene to not spend much time on Scripts at all, but it was spending such a significant time during profile

#

it turns out, having an empty Update on 10,000 objects, as Paraster said, is as bad idea even if they don't do anything

#

public class Test_GameObejct : MonoBehaviour
{
    public bool isActive = false;
    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        /*
        if (isActive)
        {
            Debug.Log("GameObject is active and running.");
        }
        */

    }
    /*
    */
}
#

even this nothing script object causes the FPS drop when 10,000 objects have it

#

so I solved my issue, the FPS drop was because all of my game entities have this "empty script Update function call" and there are like 30,000 of them

#

and my game runs A LOT smoother

#

my question was "why is this case?" I honetly didn't forsee this to be the case at all. Really surprised

exotic trout
#

is 30k update calls really enough to kill 200fps?

echo coral
#

It does cost going from native to managed code

sly grove
#

Doing nothing is a lot faster than doing 30,000 things. Calling functions has overhead, doubly so if it's using the messaging system

untold moth
exotic trout
#

ideally tho @mighty shore look into Jobs maybe

echo coral
#

ECS would be best to move a large amount of objects quickly or jobs

mighty shore
sly grove
#

You can also just consider doing all this work in a loop in a central manager object rather than individually on each object

mighty shore
#

yeah I am thinking job will be something I need as well ๐Ÿ˜ฆ I really don't want to though

#

oh well

exotic trout
mighty shore
echo coral
# sly grove Update uses the message system

I don't think it's the same, the engine most likely has a pre fetched reference to these managed functions to call them all

The message system needs to find the function by name each time

fallow echo
sly grove
exotic trout
#

At least in my experience jobs stuff sounded abit intimidating because burst, jobs, dots and ecs we're all lumped into this whole kinda scary pit when thats very much not the case

fallow echo
#

But hey, I'll be curious to see the results if BlueBug tries it (I'd definitely try it in their position)

mighty shore
#

shivers in fear of ECS

echo coral
mighty shore
#

btw talking about ECS and Job why is "Dots" a thread not a channel

echo coral
#

Perhaps to keep individual topics together I dunno

exotic trout
#

the first thread in there is the main channel

#

dots is still wip and i think the unity devs peep the individual threads incase its got actual issues

mighty shore
#

previously I had a few questions regarding workings of ECS and but felt uncomfortable by the sturucture of the threads, I wish the admin of the channel considers making a spearate chat channel for Dots

exotic trout
mighty shore
exotic trout
#

right ๐Ÿ˜„ if your gonna move it all centrally maybe give that a go while your at it

mighty shore
exotic trout
#

i mean its the same general idea

mighty shore
#

yup

echo coral
#

ECS entities will yield the best results as they are structs in large chunks

#

But doing your own with a monobehaviour will help too

alpine rock
#

From where can I find socket.io package for unity ?

exotic trout
#

i know you have to dispose the nativearray but your making the exact same vector3s every time in update so was curious

echo coral
#

You mean keep the native array and reuse?

exotic trout
#

either directly or indirectly yeah, or at the very very least referencing the vector3 once rather than creating per

echo coral
#

If you know the max size it would help a little.
It's a native array so you can't "re use" objects in it without keeping that whole array

#

The benefit would just be avoiding the dealloc + realloc each time

#

(Though unity could have reserved memory specially for native collections which may result in no benefit)

exotic trout
#

Could be interpreting that wrong but would that be done by making and disposing the nativearray when object active changes or array length changes rather than every frame?

echo coral
#

You could or you can just use the same array or a native list so you keep the same one and use what you need

#

You would ideally avoid downsizing as that's probably wasteful in this situation

exotic trout
#

heard ty chef

echo coral
#

Its better vs managed collections ofc as we don't have GC to worry about or object relocation

stuck plinth
#

not that unity's GC is fancy enough to do object relocation ๐Ÿฅฒ

narrow bloom
#

Hi everyone,
Anyone knows why Graphics.DrawTexture doesn't work in URP standalone build with Unity 6 but works perfectly in editor?

RenderTexture.active = bulletHoleMask;
GL.PushMatrix();
GL.LoadPixelMatrix(0, bulletHoleMask.width, 0, bulletHoleMask.height);
Graphics.DrawTexture(dst, alphaTex);
GL.PopMatrix();

RenderTexture.active = null;

I've been stuck on this for hours, I've tried everything, If anyone knows a solution, I can even pay them to help me!

exotic trout
#

I donโ€™t recall what it is but make sure you use the correct function too, urp and hdrp have specific ones

narrow bloom
#

Mmmh, I'm trying to find what I can use instead of Graphics.DrawTexture

humble leaf
mighty shore
#

people do not want to go to small threads

#

talking about ECS I had a question

#

I want to make simulation game with lots of entitites and each entity can have different components
So I can have "sentient wall" or a town that of "talking fruits"

#

"Brian will discuss some of the interesting design decisions he made during the development of both Caves of Qud and his latest game, Sproggiwood."


Brian Bucklew is the co-founder of Freehold Games; co-creator of Caves of Qud and Sproggiwood.
http://freeholdgames.com/


IRDC US 2015 took place in Atlanta, Georgia on the 3...

โ–ถ Play video
#

I wanted to ask opinions on form of Entity data structure

#

but that "discussion section" of dots was discouraging and the frequency of message was just too dreadfully slow

#

Anyway I like Brian Bucklew's approach to ECS this makes sense

#

but this ^ since that is a class-based I expect this to be not multi-thread friendly

#

but I want to have multi-thread based approach, so instead of that ^
I was thinking maybe I can do something like

struct GameObject{
    int id;
    int component_reference_to_position;
    int component_reference_to_health;
    int component_reference_to_moving_system;
    int component_reference_to_body_system;
}```
but this will bloat out the data/memory because even a simple wall with not much component will require all referencess to all components
#

I do not want to use DOTs/rely on Unity to update the game logic, I want to separate game logic and use Unity soley for rendering purpose. So I wanted to ask about ECS driven approach to my gamelogic without making me insane

scenic forge
#

Classes are all heap objects, so they will also be much slower because of CPU cache misses.

mighty shore
#

indeed, even more risk

scenic forge
#

Not sure what you mean by risk, but cache miss just results in slower performance, won't impact correctness.

mighty shore
#

the goal of my game is to simulate 50,000 or at least, 5,000 moving citizens in dwarf fortress fashion

#

so I stress test in the middle of dev multiple times that this approach will work later

#

right now I wrote all citizens as
struct Citizen{
id, stuff needed for citizen}
and simulate them using threads (multi-cores) and it works fantastically for many citizens

#

but I want to move onto ECS driven approach because I want a complex entities like in game Caves of Qud

#

"sentient wall" or "sentient food" basically everything being an entity and player being able to add components to it.
If I want to do that, I can't have just one "Citizen" struct as you can imagine

odd turret
#

a bit old bit still very much relevant
https://unity.com/blog/engine-platform/10000-update-calls

Unity

void Update() {
transform.Translate(0, 0, Time.deltaTime);
}For an experienced developer this code is a bit odd.

It's not clear how exactly this method is called.
It's not clear in what order these methods are called if you have several objects in a scene.
This code style doesn't work with intellisense.

mighty shore
# echo coral But doing your own with a monobehaviour will help too

@echo coral @exotic trout I'm genuinely considering using dot ecs system.

but if I do so, I want to use it to update the game data of entities.

Is it possible to assign different set of tools for each different core in ecs dot?

right now I have multiple pathfinders for each core. and each core can calculate pathing without memory issues.

if I can know which core is updating chunk of entities in ecs system I can grant access to the pathfinder (for example if the core number was 2 then give pathfinder2) can I do this?

echo coral
#

Otherwise systems run on the main thread

mighty shore
#

I just need to know which core it is that is updating the chunk of entities... but I don't think as you said, there is a way for me to know which core is doing the job

mighty shore
echo coral
#

How can it mutate during processing?

#

I presume this is why you would have multiple instances

mighty shore
#

yes each pathfinder basically has its own set of copy of pathing related infos, so no overlapping

#

originally I treated each core as " update worker " and let them go through chunks of entities to update

#

I want to do this with Unitys ECS DOT

echo coral
#

If you did path finding then needed to update its state to reflect the new change then that makes sense, otherwise there isnt a point in duplicating it

#

by core do you mean thread?

mighty shore
# echo coral by core do you mean thread?

the world data is shared as its just readonly but the recording the pathing result is separately handled per pathfinder (cuz they need to construct path all simultaneously) I hope that makes sense...

I used to do it per core but if I use unity ECS DOT, there is no guarantee that a thread is continuously handled by specific core right?

#

so I think I need to do this per thread as u said

echo coral
#

yea unity has worker threads it uses to execute jobs so its out of your control

#

Ideally your "path result data" would not need to mutate the source data so you dont need duplicate data

#

can be done in scope

mighty shore
#

I can imagine that

the part I am struggling is

#

when a work is resolving task, should it request to get an available PathFinder from list of pool of available PathFinder?

#

then return it as free once the task is completed so that other worker can grap it again i guess?

echo coral
#

If it cannot safely be shared accross threads then yea

mighty shore
# echo coral If it cannot safely be shared accross threads then yea

I cannot get rid of this creeping feeling... that ECS DOT is just an elaborated compression algorithm due to computational limitations.
And of course we programmers work with systems to actualize our fantasies into a code, for an example I use chunk system for terrains in my game. But I really feel like dropping the clean and nice class drive game logic approach for these struct driven appraoch is just too much of a massive turn around, sacrificing too much of human-logics for the sake of machine logics

echo coral
#

it exists to solve the issues that managed code and unity gameobjects have at a large scale

#

ECS is a well proven design system and is fast for a good reason, it caters to cpu design better.
If you want things to be fast you have to put "machine logic" first

ebon abyss
#

Supposedly it's also quite a good pattern for making management / strategy style games

mighty shore
#

the expected benefit of being able to simulate massive number of units really make it a fitting approaching for management style game yes

mighty shore
echo coral
#

id suggest reading up on ECS in general and why its faster. Unity explain it too in their entities docs

#

Eventually you need to learn about these things to create well optimised code.
c# maybe not soo much but in cpp/rust/c/zig it helps

mighty shore
#

isnt it mainly memory cache issues

ebon abyss
#

Yes, ECS is designed to be cache friendly

mighty shore
#

its impressive how archetype wraps all entities with the same components into a chunk of entities and workers update and so on

#

I tried to imagine doing that myself. I would need to use byte buffers for all data type, literally manage things almost from scratch, crazy nightmare

echo coral
#

well in c/cpp you can just malloc a region and use it as you wish

mighty shore
#

ah.. c... shivers in fear of raw c

echo coral
#

doesnt really work well in c# without unsafe and marshalling

#

so you are forced to structs

mighty shore
#

Unity will not suddenly drop support for Dot right?

ebon abyss
mighty shore
#

I might be worrying about too far into future but I feel like DOT is not really shining rn and I am worried it might be dropped off suddenly

#

that happened with Unity Machine learning thinging

ebon abyss
#

A lot of newer features are being built on top of DOTS

#

The goal with 7 is to be able to use ECS and GameObjects more comfortably within the same project

mighty shore
#

that sounds nice

#

ngl right now its a bit funky to say the least

echo coral
#

I hope that comes eventually, clean interop with main features usable on both is whats needed

mighty shore
#

yup

echo coral
#

though id take new .net over ecs

mighty shore
#

must choose one lol

ebon abyss
#

I desperately need a functioning terrain system rip

#

But they dropped that

echo coral
#

is it bad?

mighty shore
#

RIP dropped terrain system

ebon abyss
#

Yeah it's pretty far from production-ready and too many closed source parts mean we can't fully optimize it.

#

Lack of texture streaming puts a hard limit on how big your game can get

echo coral
#

I know they added the neighbour terrain stuff but shame they cant load cleanly.
Id love to see more chunk based loading features that could integrate with terrain stuff

ebon abyss
#

Yeah, streaming is awkward with GameObjects and can be pretty slow

#

That's another thing DOTS solves, subscenes are supposedly setup for streaming.

#

But since terrain is so large, you really just want a single, massive virtual texture as a heightmap (and splatmaps) and stream different mips based on proximity.

manic basin
#

hey guys iโ€™m making a game with procedural dungeon generation, any ideas how i can make occlusion culling work with PCG?

ebon abyss
manic basin
# ebon abyss The one in GPU resident drawer just works

r u sure it works with PCG maps? because i tried baking (using the default occlusion culling) in each of my dungeon prefabs and it only sort of worked, im not rendering the stuff iโ€™m not looking at but, for example, iโ€™m still rendering the stuff thatโ€™s behind a wall

ebon abyss
#

No baking, it just works

manic basin
#

right iโ€™ll look into it thanks

mint zodiac
ebon abyss
#

Highly recommend

mint zodiac
#

i cant seem to find it anywhere

mint zodiac
ebon abyss
mighty shore
#

How can I raise events to communicate between systems in Dot?
How can I communicate between entities in Dot?

mighty shore
compact ingot
mighty shore
frozen imp
#

@mighty shore Don't spam this channel and use appropriate ones matching your question.

mighty shore
frozen imp
thorn flintBOT
#

dynoSuccess bluebug has been warned.

mighty shore
#

do you think that was really necessary?

#

I think this is an excessive moderation on your part not fair at all to throw a warning. If this is the case then you should throw a warning to everyone thats asking shader related to questions here and so on. @raven knot

frozen imp
#

@mighty shore Whatever you typing better be an actual channel related question and not continuation of the spam...

#

!mute 205953349093163008 3d ignoring warnings, spam.

thorn flintBOT
#

dynoSuccess bluebug was muted.

timber flame
#

There is a parent class with Show() and Hide() methods, and child classes that inherit them. These methods are assigned to UI buttons via the Unity Inspector.

Each child panel has its own prefab (as variants). The issue is:

When Show()/Hide() are assigned to OnClick in the parent prefab, the references break in child prefabs.

Despite having the same methods, Unity treats them as different script types, causing the assignments to disappear.

How can this be fixed without manually reassigning methods for every child prefab?

frozen imp
timber flame
#

I know I can implement a separate component and assign them to all children, so it would be OK because all of them have the same component with Show/Hide method but when using inheritance, the refs are missing

frozen imp
#

I feel you are not relaying some information and maybe creating a new object and expecting it to have references.
Instantiated prefab variants with inherited classes do not lose references.

humble loom
#

any procedural mesh experts in here?

#

got a weird thing going on with procedurally generating jigsaw pieces. basically generated a perimeter from a set of edges, use ear clipping algorithm to triangulate the top, duplicate it for the bottom, and stitch then together for the side edges, this is what the wireframe looks like tho

#

so the ear clipping gets most of it from the first vertex, but when it gets blocked by the blank there's a jump in height which makes me think like the normals flip or something

sly grove
humble loom
sly grove
#

If you're exceeding 65535 it's an issue with hitting the limit of the default 16 bit index buffer.

humble loom
#

yeah i doubt that's it cause i've seen that and it was like an incomplete mesh usually

sly grove
#

Usually it manifests as triangles being incorrect and connected to the wrong vertices, because you basically get an overflow in the vertex index.

sly grove
# humble loom

then I think you just have an issue with your code assigning the wrong vertices for the triangles

humble loom
#

bot using ComputeSmoothNormals(my method) and just regular RecalculateNormals hav ethe same issue. i'm wondering if it's like, maybe the corner verts are screwed up or something is weird about maybe i have too many verts along the perimeter for ear clipping

#

real quick just for S+G's gonna try sampling my bezier edges at way lower resolution

austere jewel
# humble loom

To me it just looks like you're sharing vertices between the top and side faces, and the normal calculation is poorly smoothed

#

The top face should be separated and its normals should point up

humble loom
#

why should it be separated

austere jewel
#

Because sharing the normals between the top and the side will produce the results you're seeing

#

The top face should render as if it's flat, not render as if it's being influenced by the direction the edge is oriented

humble loom
#

so i did have it working. but the issue was trying to create a selection outline type shader didnt' work because since the verts aren't welded, when i scale the vertex position in the direction of the normal is just explodes that mesh face outwards

#

so i don't know how to reconcile that

austere jewel
#

perhaps bake a shared smoothed normal into vertex color and scale by that

humble loom
#

i see what you're saying. so just calculate the normals regularly but the smooth normals get packed into the vertex color, read that buuut

#

won't it still have the same issue of not being welded to the rest of the mesh

austere jewel
#

Why would that matter if they're being pushed in the same direction?

humble loom
#

unless i have a third submesh that's all welded verts and i just apply the shader to that

#

because a puzzle piece has two faces and an edge

#

not to mention every single quad along the edges was detached as well

austere jewel
#

Vertices that occupy the same position should get the same normal baked into a channel (like vertex color, uvs, whatever), and you push them in that direction when you create the outline

#

so they won't separate, because they started in the same position and move in the same direction

#

The actual normals are pointing in different directions because that's what lighting requires, and that doesn't influence the extrusion at all

#

The vertices of the side, top, and bottom can be welded separately (separated only when there's a need for different lighting conditions around a sharp bend)

humble loom
#

so what then would be the issue with simply just making sure all the identical verts have the same normal in general? i guess at the 90 degree angle they would reflect weird

night zinc
#

Hey people,
I've got an MacOS + Unity related emergency that I hope someone here could help me with,
We are making an IMU motion capture system for non-normative bodies,
Part of the solution is a 'Viewer' application written in Unity,
I get very inconclusive reports and no real logs from mac users about huge problems with the builds that get pumped out of github CI

The whole project is open source and not very big https://github.com/xioTechnologies/IMU-Mocap

If someone on a mac was willing to run it in the context of the editor and maybe compare it to the behaviour of the builds
and then maybe do a debug build? I would be really appreciative

I suspect 30 seconds in a debugger will be worth more than 8 weeks of emails

We are doing artist handover on Thursday, so now my regret in not just buying a mac is real

GitHub

Contribute to xioTechnologies/IMU-Mocap development by creating an account on GitHub.

echo coral
# night zinc Hey people, I've got an MacOS + Unity related emergency that I hope someone her...

Asking random people to run your project is not a viable long term solution.
Unity cloud diagnostics or firebase crashlytics or bugsnag or sentry (can be self hosted!) are what you need to use to collect errors and crashes from users.
https://unity.com/products/cloud-diagnostics
https://firebase.google.com/codelabs/understand-unity-games-crashes-using-advanced-crashlytics#0
https://docs.sentry.io/platforms/unity/

#

Collecting errors and crashes lets you know what is actually going wrong so you can fix it.
If you add one of these, its a good idea to improve and add your own errors + exceptions to make errors more descriptive

#

I get this wont cover all problems like faulty functionality but its something that hopefully gets you some way there

night zinc
#

I hear you,
and this is not a long term solution for us, this is also source of great personal embarrassment for me

logs have been truncated and strange, im not even sure if its an artefact of CI / signing etc, i feel like need someone familiar with the platform to just look

but im at a pinch point, even if i set thouse things up i still need someone to run it

echo coral
#

Perhaps if you can get one of these in (unity one is probably simplest to start) and then have someone try a new build it should then share more data. Otherwise you may want to add something to make log file sharing easier?

night zinc
#

thank you for your suggestions, altough your solutions may bare fruit in time, it is time i do not have in this instance

the log files i have recived, have been strange and truncated e.g.

Mono path[0] = '/Applications/IMU Mocap Viewer.app/Contents/Resources/Data/Managed'
Mono config path = '/Applications/IMU Mocap Viewer.app/Contents/MonoBleedingEdge/etc'
Obtained 30 stack frames.
Obtained 36 stack frames.

no crash log or much of anything, and the rythum of communication with the reportee has made investigation imposible

the product is not lauched yet, there are not real users to gather data from

echo coral
#

native crashes may not be able to write to the unity logs so these other tools are needed as they have crash handlers to collect this data and sent it to the respective platform online

night zinc
#

or like, running it in a debugger?

echo coral
#

a native crash may be caught if you do not attach for managed code

night zinc
#

i cannot imagine what could casue an exotic crash, its the most vanilla project really

#

i just feel like its the code siging and no matter how much i smash my head into more logging and noise, it will be some config in CI

echo coral
#

Sometimes things just go wrong in the engine or plugins, again not having tools to collect this data has left you in the dark soo far

#

Btw are these "huge problems" exceptions or actual game crashes?

night zinc
#

my understanding the the application hangs, as in the process wont end

echo coral
#

Hmm sounds like a deadlock or infinite loop ๐Ÿค”

night zinc
#

i should have just bought a mac when it came up

sly aurora
#

how's the performance of the new ai navigation?
let's say multiple enemies are following a player, is there a limit on how many enemies are too many for such setup??

night zinc
echo coral
# night zinc thanks for thinking about it, but I get the impression you don't actually have ...

I personally don't but if a freeze only happens on a mac then you have something that is able to loop forever or freeze forever only on this platform (either by platform specific code or a library that acts differently on this platform).
Anyway have a search and see if you can find it. If you did have a mac you could use a dev build with managed debugging and pause when it did freeze to hopefully find the cause.

night zinc
#

yes, debugging it would likely solve it

untold moth
acoustic veldt
#

What's a good course to learn C# events?

compact ingot
sly grove
#

Possibly your code is framerate dependent

#

It's very possible to make it framerate dependent on accident in a few ways

#

Perhaps share your code?

sly grove
sly grove
#

That doesn't necessarily mean it's not framerate dependent

#

not sure why you won't share your code

#

doubt it's that long.

#

For example if you are multiplying the force vector by Time.deltaTime, it would become framerate dependent

#

But you can use a paste site

#

!code

thorn flintBOT
sly grove
#

There's not much I can do without seeing the code

#

The whole script would be ideal

#

I disagree

#

By changing the engine version the game may be running at a faster or slower framerate

#

for example, the new version may run faster

#

How do you know

exotic trout
#

Praetor can only guess if there isnโ€™t the full context of the problem available

sly grove
#

I can only work with the information I am given

exotic trout
#

nah

#

thats just not a thing that happened

#

the release notes are public if you wanna check

coral citrus
#

has anyone experienced an issue with RenderMeshIndirect not pulling anything for additional light values when DrawMeshInstancedIndirect works fine?

long ivy
#

the tiny snippets you posted aren't much to go on, but if they're accurate then you're using the wrong force mode and should probably be using impulse

exotic trout
#

unity didn't change force mode

#

this might be it?

fossil lava
#

Hi, in Unity Version Control merge, is there a way to check how a conflict was resolved, whether local changes or incoming changes were used?

untold moth
spark condor
#

Hello ! I actually need the best approach for what I have to do : basically I am creating plane polygonal meshes (which are dynamic) and I need to make repeating lines horizontally on it. The complexity about it is how to handle it with UVs interpolation and when we have curves.

Basically here is what I want : (first picture)
Black lines are the triangles and red are the markings I want to make in shader

But in reality it would look like this currently : (second picture) I just did it fastly it's probably not what it looks like in real but you get the idea.

Should I just create the repeating lines by creating quad for each or I can make it with shader and those 2 quads ?

hybrid tundra
#

@untold moth do you know what can be wrong with this shader graph?

#

on NDA platforms

hybrid tundra
#

so for NDA platform its not transparent

#

which is understandable, since alpha is setted to 1

#

but then how can it work on other platforms?

untold moth
#

Work in what ways?

hybrid tundra
#

because for other platforms, its transparent

#

there's only an image on the edges of the screen

#

but its empty in the center

#

I mean transparent, not empty

untold moth
#

Since it's a full screen shader, it's likely a post processing effect. It's likely taking the intermediate render target and blends between the original color and something else.

hybrid tundra
#

thats okay, but then which part may fail on NDA platforms?

#

I have zero idea how to test it out, because its even hard to make a sample project containing this shader graph

untold moth
#

Unity frame debugger might also reveal some info.

hybrid tundra
#

if I would do a throughout researches for things like this, I would run out of time

untold moth
#

Hahah. Yeah, because that's the perfect solution.

hybrid tundra
#

I have only 2 and a half week left

#

yeah, its perfect, when there's more time than 2 and half week until submission ๐Ÿ™‚

untold moth
#

You only need a few hours to learn how to use them.

hybrid tundra
#

yeah, I'm pretty good at reading docs

#

I usually don't understand them well

untold moth
#

And once you know how to use one, you can basically apply this knowledge to other platforms too

#

Well, unity doesn't provide much in terms of debugging graphics issues.

#

So you don't really have a choice.

hybrid tundra
#

I have actually

#

I would start making that transparency thing differently

#

to have a real alpha value

#

because I'm pretty sure that will be the issue

#

it constantly gets feeded with 1

#

so its a wonder how its fully transparent for other platforms

untold moth
#

You don't want it to be actually transparent.

hybrid tundra
#

well, I have zero knowledge about shaders

#

and I won't have time to learn all from them

echo coral
#

Yea try the frame debugger to check what its doing, if its not sampling from the frame buffer it should be transparent.

untold moth
#

You were saying that for a month now. Then wasted a lot of time trying random solutions.

hybrid tundra
untold moth
#

It would've went a lot smoother if you spent some time to actually learn and use the correct tools.

untold moth
hybrid tundra
#

I'm usually panicking about everything

#

I can't just calm down

untold moth
#

Well, that I can't help with. This is not a psychological support forum.

#

But I can suggest you the proper way to solve such issues.

#

And it would benefit you in the long run too.

torn rose
#

I get your point, but if he's working on a title in production and management is piling up tasks, sometimes you need to cut corners

stuck plinth
#

from what you've told us there's not much we can really do because the root problem every time is a failure of project management where you've been given a deadline and none of the resources you need to do the work

untold moth
#

I mean, if he can just scrap this solution entirely and go with one that does work, then sure, why not. But it doesn't sound like it.

#

The deadline was pretty far away though. I think it's more of a case of improper time management.

torn rose
#

I haven't followed, but I think you're typically of sound judgement so I'll take your word for granted

untold moth
#

Two weeks is still a lot of time.

#

So there's still time to both learn and troubleshoot

hybrid tundra
#

not just this one

#

and I don't know how much time will those require

untold moth
#

Or learn to segment the time you have been given yourself.

hybrid tundra
untold moth
torn rose
untold moth
#

Like, "given that I have not worked with memory optimization and memory leaks and the complexity of the issue, it would take at least 3 weeks" or something like that.

hybrid tundra
untold moth
#

And if you don't make it in time you communicate. Make it clear why you need more time, report the progress. If your higher ups are half decent, they will understand.

hybrid tundra
#

so in this way its not easy

untold moth
#

This is part of gamedev. There's a lot of stuff, and it's very common to get tasks on something you've never touched before. Need to adapt and learn all the time.

torn rose
#

If it can serve as a point of data, and maybe a potential relief, I have gotten every single deadline wrong working with casual/midcore publishers over the course of many many years

#

I think they try to plan with what they know, but at the end of the day they're at the mercy of people executing it

hybrid tundra
#

so, if I compare the Frame Debugger stuff for the shader on both platforms where its working and where its not, then will I get some info about what to fix?

exotic trout
#

less about what to fix directly and more about whats different

#

then figuring out why and/or if that difference should exist

hybrid tundra
#

for that specific shader

echo coral
#

Using the frame debugger on a dev build can help greatly. E.g. recent example where I was helping someone and we discover a render feature blit shader acts differently in a build vs editor:
#archived-shaders message

#

We know its the blit shader as it fails to combine the result with the main render buffer content

hybrid tundra
#

but I also post it in here as well

#

left is editor NDA platform, right is build NDA platform

#

all difference I can see is that the left is Tex2DArray, the right is Tex2D

dusty wigeon
#

Also, if you want to diagnosticate the issue, you might want to remove as much as you can from the shader till they both behave the same.

untold moth
# hybrid tundra

The only thing I can guess from this is that on the target platform the base color(frost something ) texture uses a compression method or format that does not allow alpha channel.

echo coral
#

Going by the first screenshot, DXT5 does support alpha but the second does not if we believe the BGR mentioned
so is most likely the wrong tex format for the target platform

hybrid tundra
#

oh, the B10G11R11

#

well, based on chatgpt, its supported on target platform. But in the target platform documentations, I couldn't find the supported texture formats anywhere

untold moth
#

The BGR is unrelated. It's the render target format.

hybrid tundra
#

because the tex2D and tex2Darray difference

#

in rendertarget

untold moth
#

No. This is likely unrelated.

#

Check the texture format/compression settings for the target platform.

untold moth
#

For the base color texture used in the post processing effect.

hybrid tundra
#

but the _maintex is empty

#

not browsed

#

so you mean the _basemap?

untold moth
#

Yes

hybrid tundra
untold moth
#

Main Tex seems to be assigned at runtime. Ignore it for now.

hybrid tundra
#

RGBA compressed DXT5|BC3 sRGB

untold moth
#

Is that the settings for the target platform?

hybrid tundra
untold moth
#

Hmm... Bc3 should support alpha.
Then I have no clue at this point. You'll need to use the dedicated debugging tools.

hybrid tundra
untold moth
hybrid tundra
#

and just as usual

#

I don't understand anything about it

#

it seems it would need a "live debug server connection"

#

for shader testing

#

I don't even know what is that...

#

the issue is that even if I would manage it to print something about shaders, I would not understand it, since I have zero knowledge about shaders...

untold moth
untold moth
#

Most are somewhat similar to frame debugger, just providing more useful info.

hybrid tundra
#

I hope it won't hurt NDA if I make a screenshot only from the data it prints

#

@untold moth

#

that grey color is the one which is behind the frost texture

#

instead of being transparent

#

its the data of the frost texture

#

but I've found also the shadergraph details as well

#

in here

#

should I show that too?

untold moth
# hybrid tundra <@209684227720085505>

You mean black?
I assume you found the correct draw call. You should look at it's pipeline state. Specifically, at the SRVs bound to the pixel shader. Your frost texture should be one of them. Select it and click in the middle to see what values it has where it's supposed to be transparent.

#

Also, try selecting a black pixel on the render target and checking it's history(to make sure the issue originates in this draw call)

hybrid tundra
#

nope, grey

#

as you can see, on the right side, its also states "background: grey"

#

and I can also see grey

#

its under the black area

#

in the image I shared

hybrid tundra
untold moth
untold moth
hybrid tundra
#

but when I click on that, nothing happens

untold moth
#

You need to click in the texture to see the pixel data.

hybrid tundra
#

the black area

#

but the pixel history - debug pixel doesn't show anything

#

like if I would have not clicked on there

untold moth
#

Are you running the analysis/replay mode?

hybrid tundra
#

its API Object 6761

untold moth
#

Hmm... Usually you'd make a GPU capture, stop your app and launch analysis or replay mode from the debugger.

hybrid tundra
#

isn't it sure that maybe I should have selected the shadergraph in this tool?

#

and not the actual texture?

#

shadergraph has much more details

untold moth
hybrid tundra
#

37 of them

#

when I search for "frost"

#

and one of them is the WinterFrost (which is the texture name)

#

the other one is the Shader Graphs/Frost

#

which is the shader graph using the texture

untold moth
#

That would be your shader, yes. You can move to debugging it later after you confirm that it is actually the cause of the issue.

#

For that you need to look at the draw call, the state of the render target before it and the resources used in the draw call(like your frost texture).

hybrid tundra
#

what "draw call"... in Unity editor, I can see the draw calls in Frame Debugger

#

but not in here

#

or I just don't understand this tool at all

#

I can't do much in here as I can see

#

I can only select the resource

#

and check its details

#

I can't even find other buttons

untold moth
hybrid tundra
#

on windows the whole thing works perfectly fine

untold moth
#

I mean, there's not much of a secret here. Pretty sure everything I've said is in public access.

untold moth
hybrid tundra
#

ahh ok

untold moth
#

Also, it would be easier to explain to you without worrying about NDA.

exotic trout
#

(not that it matters but im pretty sure the max ram you mentioned a few days ago confirmed it too lol)

hybrid tundra
#

in windows build or in windows unity editor?

hybrid tundra
#

but until then it would be great to figure this out

untold moth
#

I mean, just for demonstration purposes, the editor might work too.

#

Why do you need a special permission though? Shouldn't you be able to just build it normally?

hybrid tundra
#

first time I made build for NDA platform it took like 2 and a half hours

#

or something

#

and until then I can't use the editor to maybe get info or solve the issue

untold moth
#

The first time you build is definitely taking some time.
But you should have done it way before.
This is the basics of debugging platform specific issues - always have a windows build ready to run that you can compare against.

hybrid tundra
untold moth
#

Basics of troubleshooting multiplatform issues.

#

Anyways, you can try with the editor.

hybrid tundra
untold moth
hybrid tundra
#

ok I was an idiot

#

there's a different shader running in the center of screen

#

when this post process is active

#

and that different shader can also cause the issue

#

that also uses RGBA compressed DXT5|BC3 sRGB

untold moth
#

You should be able to see what draw call exactly caused the issue by looking at the render target at each draw call

hybrid tundra
#

honestly

#

it will be better checking this other shader

#

because it has code

#

maybe the NDA platform is just not in the active list in there

#

I will try to just entirely disable the center shader

untold moth
#

I feel like you should look at the draw calls properly and see where the black screen actually originates.

hybrid tundra
untold moth
hybrid tundra
untold moth
#

You should only do that when you have a high degree of certainty of the cause.

hybrid tundra
#

you don't consider my low knowledge of shaders

#

I would also prefer opening a book about shaders

untold moth
#

Then learn.
It's still gonna be faster.

hybrid tundra
#

and learning it from A to Z

#

but I guess when I finish the book, then the deadline would already be over

untold moth
#

There's no such book. Besides, it could be a non shader issue at all.

hybrid tundra
#

ok, if you tell me how to use that app, then I will check it

untold moth
#

It could be a render target issue or something.

hybrid tundra
#

because I don't understand it

#

at all

untold moth
hybrid tundra
#

for NDA platform

#

because its incremental build

hybrid tundra
#

okay, disabling shader didn't work, so the issue will still be with the Frost (the one I already shown)

echo coral
hybrid tundra
#

what should I check?

#

@untold moth

untold moth
#

I don't remember the exact name, but the second tab(something with pipeline states)

hybrid tundra
#

can't see nothing like that

#

no pipeline states, no draw call list, nothing

untold moth
#

You need to take a GPU capture. The UI looks different. Did they change it in the latest version?๐Ÿค”

hybrid tundra
#

oh wait

untold moth
#

"take capture"

hybrid tundra
#

I clicked on the take capture

#

it was not trivial at all

hybrid tundra
untold moth
# hybrid tundra

The events list would contain various GPU commands. I assume your draw call is somewhere in the hdrp render camera

untold moth
hybrid tundra
untold moth
# hybrid tundra

That's the one. Or at least the marker. Clear the filter and you should see the draw call under it.

untold moth
# hybrid tundra

Expand it more and select the draw call. Then take a screenshot of the tab below(pipeline)

hybrid tundra
#

is it in the left or the right side?

#

"select the draw call" select what?

untold moth
untold moth
hybrid tundra
hybrid tundra
#

@untold moth any idea?

untold moth
#

As well as rtv 0

#

The former is the screen color before this draw call. The latter is after.

hybrid tundra
untold moth
# hybrid tundra

You seem to have too much stuff open. The texture preview is not visible.

untold moth
hybrid tundra
echo coral
#

At this point go read how to use PIX so you can find what you need...

hybrid tundra
echo coral
#

This should be the time to learn. You are using this tool to investigate exactly what is going wrong when this post processing effect shader is drawn.
The prior suggestions about alpha channel/texture format may be correct but hopefully this will let you discover the issue.
https://devblogs.microsoft.com/pix/gpu-captures/

hybrid tundra
echo coral
#

I dont think its silly to expect some knowledge of an area to debug it correctly

#

Otherwise you dont know what to look at or how to even identify the root cause

hybrid tundra
sage radish
# hybrid tundra I wonder how would that fit into a 2.5 week long timeline...

I think we all understand your sentiment. Sometimes you have a problem that just needs to be fixed and you don't have the luxury of time to properly understand it and learn from it. But you'll find that it will be hard to get help with those sorts of issues here.

Most of us volunteer our time answering questions here because we like helping people learn new things. It's not as fun if we're just fixing your problem for you and you gain no understanding of how it worked.

#

For that, it would be more appropriate to use private, paid support.

hybrid tundra
#

I just literally have no other way to solve this

#

worst case I just disable this completely for submission

#

but I still have a bit of time to try to solve this somehow

dusty wigeon
dusty wigeon
#

Also, note that fullscreen sometimes utilize opaque texture/screen grap and that can be an issue on some platform (if the appropriate settings are not used).

sage radish
hybrid tundra
#

so it was pretty unuseful

dusty wigeon
#

It could also be a limitation of Fullscreen Shader/Platform or even a bug. The effect can be replace with a more manual pass.

hybrid tundra
#

I explained transparency perfectly works for PC build, so I guess it should also work on NDA platform

#

maybe not coming from the shader itself, I have no idea

dusty wigeon
hybrid tundra
dusty wigeon
#

And as I said, there is at least one other way to have "transparency" in a full screen shader and it is by using a screen grab.

#

Which would not be strange for a frost shader given that we might want to add distortion.

dusty wigeon
#

Now try:

sage radish
dusty wigeon
#

And try the following after

sage radish
#

The fact that the screen texture is a 2D array is curious. That is the case for VR games. I don't think it's generally done for non-VR games, but it might be done for a customized render pipeline.

dusty wigeon
#

Also, the Texture2D seem to be completly useless because you always use the first element. You culd simplify it.

dusty wigeon
#

It could be simplify.

hybrid tundra
dusty wigeon
#

If it crashes in editor, dont lose time in a build.

hybrid tundra
#

can a shader crash the editor?

#

wow

dusty wigeon
#

But if there is something unexpected happening, you do not want to lose time.

#

And you want to compare both behaviour

#

Also this part could be an issue if the ScreenSize is not the same in your build and in edior.

sage radish
hybrid tundra
# dusty wigeon Now try:

accidentally made a build with this (couldn't cancel that anymore), but the result is the same. I can see a light brown background

#

so its not transparent yet

dusty wigeon
untold moth
hybrid tundra
hybrid tundra
hybrid tundra
dusty wigeon
#

Or the opposite

hybrid tundra
#

at the border of the screen

#

(in editor at least, didn't try it on build)

dusty wigeon
#

So, if you try in the build and you see a full black screen, you are unto something

#

It would mean that the possible issue come from:

hybrid tundra
#

in build I can still see the frost image around the borders of the screen, and light brown color everywhere else

#

some gameplay related UI texts and stuff can appear above the light brown

#

but gameplay overall is hidden behind the color

dusty wigeon
#

I do not really understand, if you do not sample the frost texture you should not see the frost texture.

#

Anyway, the next step would be to see what is _MainTex and where it is coming from.

hybrid tundra
dusty wigeon
hybrid tundra
dusty wigeon
#

Such as To set a source material for the Blit() command to use in shader graph:

Double-click a Fullscreen shader graph to open it in Shader Graph.
Create a MainTex node:
In the Blackboard, select the Add (+) button.
Select Texture2DArray.
Select the Texture2D Array node you just created to open its properties in the Graph Inspector.
In the Name property, enter _MainTex.
In Node Settings, enable the Exposed toggle so Blit()can bind the texture.
Drag the MainTex node into your shader graph.
Press the Spacebar to open the Create Node window
In the Create Node window, search for the Texture 2D Array node and select it to create it in your scene.
Connect the MainTex node to the Texture Array port of the Sample Texture 2D Array node.
Connect the RBGA output port of the Sample Texture 2D Array to the Base Color block in the Fragment context.
Blit() automatically binds the source texture inside the _MainTex property.

hybrid tundra
#

is it what you've meant, right?

dusty wigeon
#

And lets see.

untold moth
#

Weird that they let the user manage that and don't convert the nodes to the correct shader code under the hood

dusty wigeon
#

๐Ÿคทโ€โ™‚๏ธ

untold moth
#

Though, I guess then they'd also need to provide some assertions platformwise

hybrid tundra
#

In the project there's a similar shader btw, for a different effect

#

I was thinking of replacing this one to that one

#

and check if it would work

#

because for that its working on NDA

#

that looks basically the same, just the texture is different

#

(not frost is on the edges of the screen, only blood)

dusty wigeon
#

Copy it and change the texture than

#

It probably does not use a Blit

hybrid tundra
#

well, that's a shader, not a shader graph generated stuff

#

I didn't check how that works, but that works for NDA

marble otter
#

Hi guys, someone knows about Vivox service?

#

I have this method to get History:


public async Task GetChannelHistoryAsync(ChatType chatType, string chatId = null)
{
    var chatName = chatType.ToString();
    if (!string.IsNullOrWhiteSpace(chatId))
        chatName = $"{chatName}_{chatId}";

    Logger.Log(LogCategory.Chat, $"Fetching chat history for channel: {chatName}");

    var history = await VivoxService.Instance.GetChannelTextMessageHistoryAsync(chatName);

    Logger.Log(LogCategory.Chat, $"Received {history.Count()} messages from channel history: {chatName}");

    foreach (var message in history)
    {
        Logger.Log(LogCategory.Chat, $"Processing message from channel history: {message.MessageText}");
        OnChannelMessageReceived(message);
    }
}

But the received messages is always 0.

#

The strange thing is that sending messages is working and calling the "OnChannelMessageReceived" of whoever is watching, but that message doesn't seem to stay in the history.

hybrid tundra
untold moth
hybrid tundra
untold moth
#

Not the best example, but here's some info you can see during analysis

hybrid tundra
#

I will check that after this stuff I try out now

hybrid tundra
#

I also have no idea why the unity editor can start the game only once, and then when I stop playing, it starts to reimport VFXGRAPH and lot of other stuff, and then camera doesn't render anymore. Lot of shaders start to show errors, etc., Like undeclared identifier at kernel, etc..

#

so I need to restart unity editor all the time I want to press play...

hybrid tundra
#

okay, I could fake it with other shader

#

but I still need to figure out how to create those other prefabs only on NDA platform

#

because its not just instantiate

hybrid tundra
#

for this?

untold moth
odd lodge
#

I've got an infinite scroll rect that I use for a top bar of tabs in my menu. I coded it to have 3 identical versions of the tabs in a row, and then snap back to the center when you scroll too far left or right, giving the illusion that it's infinite in both directions

#

it works great, the problem is that if you drag and hold while it snaps, it stops dragging

#

something about changing the position of the scroll bar while dragging tells it to stop executing the drag functionality

livid kraken
#

Can someone tell me if there is something wrong with my test or burst just is not doing much for this method. The test code looks like this [Test, Performance] public void RectIntersect() { Rect rect = new Rect(100, 100, 200, 200); Rect rect1 = new Rect(100, 100, 200, 200); Vector2 v1 = new Vector2(150, 150); Vector2 v2 = new Vector2(250, 250); var nonBurst = new SampleGroup("NonBurst Intersect", SampleUnit.Microsecond); var burst = new SampleGroup("Burst Intersect", SampleUnit.Microsecond); Measure.Method(() => { rect.Intersects(v1, v2); }) .WarmupCount(1) .MeasurementCount(100) .IterationsPerMeasurement(50) .SampleGroup(nonBurst) .Run(); Measure.Method(() => { rect1.IntersectsBursted(v1, v2); }) .WarmupCount(1) .MeasurementCount(100) .IterationsPerMeasurement(50) .SampleGroup(burst) .Run(); } Yet the test result seem off to me. Profiling the non bursted method on device suggests it's performance is close to the result of the first two samples.

untold moth
#

It's not unity api, is it?

livid kraken
#

It's not, I inherited the original from the code base and simply made it burst compatible.

untold moth
#

Ah, in this case I think it make sense that there wouldn't be a difference. Burst only provides improvement in certain scenarios, where the simd instructions can be used.

livid kraken
#

I'm aware of that and there is a couple of places in the method that would benefit from simd. Profiling on device shows that this method is the slowest part when it's being called taking about 69%(hehe) of the time, it's part of a larger line of sight calculation. What I'm seeing every time it's being called is close to the result of the first two measurements. My only idea right now is the because it is being called multiple times in a row the tiered jit compilation kicks in and optimises it to burst levels, however the game is being build with il2cpp and maybe we get a crappier version of it in the build ? IDK i'm fairly stunned here.

fallow echo
livid kraken
#

Well depending on the unit count it can be called around 2000 times. The ms timing is not relevant since Iโ€™m doing deep profiling.

fallow echo
#

Well you did say it's 69% so... ๐Ÿ˜„ if that's also in deep profiling it's also not representative

livid kraken
#

The time percentage is the only relevant thing you can look at while deep profiling

fallow echo
#

It's math based on the ms, which is off because deep profiling, isn't it? ๐Ÿค”

livid kraken
#

deep profiling just inflates the ms, but afik it's inflates all numbers relatively the same.

fallow echo
#

I don't think so. It's based on how many things it needed to measure in a certain subtree (non distinct). If bajilions - then way off, if 10 - slightly off.

#

I'd suggest you do an in-place (like, in the place they're actually used) measure of both options, if you haven't. Without deep profiling. And see how they compare. ๐Ÿคทโ€โ™‚๏ธ I don't quite know what one can expect getting from bursting this though, haven't played too much with burst.
Depending on how you're doing these calls, you may be able to jobify and parallelize?

livid kraken
#

Since this is part of a rather huge and convoluted code base jobifying it would be too time consuming

hybrid tundra
#

when I try to make analysis from that, I get this

untold moth
# hybrid tundra

Ah. I guess you might need to enable it in the windows settings.

hybrid tundra
#

ok I could activate that, and now NVIDIA complains for similar reasons

untold moth
#

The Nvidia one is probably fine.

hybrid tundra
#

are these huge problems?

#

ok I could switch the Base (locked) to unlocked

untold moth
#

Never send the power state one.
The missing pdbs are normal. You'll need to figure out how to make unity output shader symbols if you want to debug the actual shaders.

hybrid tundra
untold moth
# hybrid tundra do you have any idea how to do that?

According to chat gpt, you'd need to add debug defines in the shaders you need debug symbols for, however I'm not sure how accurate it is. At least for the built-in shaders it didn't work for me. Also, if it's a shader graph, there's a different way iirc.

hybrid tundra
#

if its the only way (to modify common.hlsl) that will take like 2 hours to compile

#

I afraid

untold moth
#

Well, you don't really need it right now.

#

You only need that if you want to debug the shader code.

hybrid tundra
untold moth
#

Which you might need to do. But first figure out where the issue originates.

hybrid tundra
untold moth
#

I showed yesterday. Look at the render target and the input texture. Look at the previous draw calls. You should be able to see at what point the issue is happening.

hybrid tundra
#

or maybe they were draw calls, but my experience is so low in Pix I can't even understand if that is a draw call or not

untold moth
hybrid tundra
#

I had no idea they are the same

#

I respect that everything for you is trivial, but not for anybody else

untold moth
#

I mean it should be somewhat obvious if you just look around a bit at the interface, the screenshot I provided and maybe research a bit.

#

Just a reminder that this is the advanced coding channel, so you're expected to be able to do a little research/quick google. And if you still have trouble explain what exactly is unclear and ask for clarification.

#

It's a "draw call" because it calls a "draw" like a draw instanced and such.

hybrid tundra
untold moth
hybrid tundra
#

but not in the windows version

untold moth
#

Even if you right click in the texture?

hybrid tundra
#

this is all I can see on windows pix

untold moth
untold moth
# hybrid tundra

You need to select the draw call... Remove the filter in the events.

But you can already see the pipeline state that I mentioned in the previous message in the bottom left.

hybrid tundra
#

DrawInstanced is the draw call?

untold moth
hybrid tundra
#

(not trivial again)

#

ok

#

what should I check now?

untold moth
#

We covered that like 3 times already...

#

Should be trivial by now

hybrid tundra
#

well, once it was called Draw

#

now its called DrawInstanced

#

I didn't know any word starting with Draw will be draw call

#

but ok

#

let's progress from here

hybrid tundra
#

ok

#

my bad

untold moth
# hybrid tundra let's progress from here

Look at the pipeline tab on the bottom left(said that 3 times already as well). There's info about the vertex and pixel shader and the resources that are bound to them(like textures) as well as a render target.

#

I hope I don't need to decipher that VS standard for vertex shader(or stage) PS for pixel and RT for render target..?

#

SRV is a shader resource view(basically any read only resource, like a buffer or texture).

#

The 2 of the textures in your shader graph should be in the SRVs

hybrid tundra
#

RT is straightforward that its something render related (but for me, RT stays rendertexture, not rendertarget)

untold moth
#

And the output of the shader is the render target.

hybrid tundra
#

PS was not straightforward that it means pixel, because no idea from where S comes from

untold moth
#

Render texture is sort of a render target as well.

untold moth
#

Anyways. By looking at these things you can confirm if your issue arises in this draw call or not.

#

As well as what kind of data is in the render target where the issue occurs.

hybrid tundra
#

I also try to solve the issue differently with my colleague

#

we tried to do something in the shader graph

#

and the modified shader graph doesn't even appear in build, according to frame debugger

#

we even renamed it, but still not appearing

untold moth
hybrid tundra
#

so these two tables are relevant, right?

#

and based on this, we can't tell what goes wrong in the NDA build, right? so I guess I should compare the NDA platform similar tables with these ones

untold moth
#

Like I was saying many times by now...

hybrid tundra
#

but this Pipeline tab doesn't have render target infos

#

or if the RTV is that

#

then it is

untold moth
# hybrid tundra

Are you sure you have the right draw call selected?
The fact that there are no resources in the pixel shader panel, means that no texture is bound to the shader.

untold moth
hybrid tundra
#

under the FrostPostProcess, which is the relevant thing

untold moth
hybrid tundra
untold moth
#

Does it look like the effect is rendered in the render target?

hybrid tundra
#

and I censored it, but under the orange rectangle there's the gameplay screen

#

and in there I can see the frost effect

#

yes, its there

untold moth
#

Try clicking ShowPrior. Does it show the screen before the effect is rendered?

hybrid tundra
untold moth
hybrid tundra
untold moth
hybrid tundra
#

no, I'm an idiot

#

its not here

#

so the effect is not there, when I click on ShowPrior

#

it just took like a few sec until it showed me without the effect

untold moth
#

Ok, then this is the right draw call

hybrid tundra
#

ok, so should I compare this table with the NDA's similar table?

untold moth
#

It's weird that the textures are not visible. Maybe you have somethign turned off in the settings or filter?

untold moth
hybrid tundra
#

when I switch to All, I can see new stuff

untold moth
#

Hmmm... What kind of new stuff?

hybrid tundra
untold moth
untold moth
# hybrid tundra

Select the SRVs and see what they look like. Especially texture 1.
Then compare to the target platform.

hybrid tundra
#

@untold moth since then I have solved it

#

I will tell you the details later

hybrid tundra
#

@untold moth do you have any idea why volumetric fog doesn't appear in NDA platform build AND in unity editor (NDA platform)?

#

volumetric fog is enabled in HDRP settings

#

directional light has Volumetrics enabled

echo coral
#

wow

#

you should not be depending on people helping you 24/7 here

hybrid tundra
dusty wigeon
# hybrid tundra I mean I don't have much time until deadlines...

Mate, we are all have deadline and not a lot of time. I currently have two project that are ending soon. I lost 3 of the 4 members of my team near the end of it and I had to rewrite the whole physics of one of the game because the performance was abysmal while doing some management task on the side of an upcoming project.

#

If you are not able to figure out the issue, there is much we can do here. You are just delaying the innevitable

hybrid tundra
dusty wigeon
#

When you do ports, you always going to face issue that are considerably hard to debug/figure out. Rendering difference between platform is common, so is memory or performance. You need to be able to face issue that you never seen and that are not really easy to understand all the time.

#

It is always something new as well.

cinder dirge
#

Does using bytes, short instead of int, float help me get better performance when I have a lot of data in dots/job/serialize to json ?

stuck plinth
cinder dirge
stuck plinth
#

if you're having performance problems with json it could be worth looking at a binary format alternative

scenic forge
#

Having smaller data means more of your data can fit into CPU cache, but whether that being in CPU cache helps or not is highly application dependent.
And using smaller data type does not necessarily mean your data size will be smaller. Data alignment is a thing and C# by default inserts padding for you, so if you have a struct of int + int, switching to byte + int wouldn't shrink the size of that struct at all.

scenic forge
sage radish
# cinder dirge Does using bytes, short instead of int, float help me get better performance whe...

It's also possible to get more throughput in SIMD instructions with Burst when using smaller integrals. For example, you can perform four add operations in one instruction when using 32-bit ints, but for 16-bit ints that number goes up to 8, and a whopping 16 for bytes.

But the scenarios where Burst applies this sort of optimization is very specific. You have to write your code carefully for Burst to do it for you, or use the SIMD instructions manually. So it's not an automatic performance boost.

split dragon
#

Im making a source generator, it works fine when the .dll is lose in the Assets/ folder, but if i make a unity package and put it in the /Runtime folder, it does not seem to load?

Is there any way to get a unity package to run the code gen?

sage radish
# split dragon Im making a [source generator](<https://docs.unity3d.com/6000.1/Documentation/Ma...

The way Roslyn analyzers and source generator dlls work in Unity is based on their location.

Unity applies analyzers to all assemblies in your projectโ€™s Assets folder, or in any subfolder whose parent folder doesnโ€™t contain an assembly definition file. If an analyzer is in a folder that contains an assembly definition, or a subfolder of such a folder, the analyzer only applies to the assembly generated from that assembly definition, and to any other assembly that references it.

This means, for example, that a package can supply analyzers that only analyze code related to the package, which can help package users to use the package API correctly.

#

So the correct usage Unity expects when packages contain analyzers or source generators is that the assemblies you want to be analyzed or have source generated in must reference the assembly definition of the folder where the source generator is located in.

untold moth
hybrid tundra
#

the infos the Pix tells me tells me nothing

untold moth
hybrid tundra
untold moth
#

The moment you started addressing a graphics issue on a console platform, you are required to understand how computer graphics, graphics API, rendering and shaders work. Or you need to pass that ticket to someone that does.

#

There's no going around it.

hybrid tundra
#

I have found the exact line which causes the issue

#

related to volumetric fog

#

I just either can't build the shader

#

and it works in editor

#

or I can build the shader, but it doesn't work in either place

#

with modifying that exact 1 line

exotic trout
scenic forge
#

At this point it almost feels like dlich is doing your job for you, and you are just playing a game of telephone relaying all the errors. Your employer might as well just hire dlich for consulting.

untold moth
echo coral
#

Shame we cant even know the console name ๐Ÿ˜

untold moth
#

I mean, I'm happy to help, but I expect that the person I'm helping at least learns something from every interaction and maybe does some homework, so that we don't need to go from 0 with each new issue...

exotic trout
echo coral
#

If its the switch for example, id say HDRP is a terrible fit, else the other consoles should handle hdrp fine

echo coral
#

But doesnt explain shader incompatibility in this instance

exotic trout
#

it is ye

untold moth
#

We don't really know that it's "shader incompatibility". They said that the shader compiles properly if they don't touch it.

untold moth
#

If it was a compatibility issue, there'd be a compile error.

echo coral
ebon abyss
#

Yeah

#

8 gigs usable

echo coral
#

HA what a joke

#

It could be something silly like the shader is not included in a build due to addressable funkyness or the default quality level is different to what is being tested with in editor

untold moth
#

Yeah, that could be very much it.

ebon abyss
#

Probably some issue with variants yeh

untold moth
#

I had this issue so many times. The QA fills a bug report on platform X, saying that the issue doesn't happen on PC. Then when I reproduce it, it ends up being different quality settings, debug flags or some other configuration bullshit...

echo coral
#

@hybrid tundra Check the latest build log and see if shaders relating to fog get fully stripped or are included
it should list all shaders and the stripping process.

#

"it works fine on my pc"

exotic trout
#

i wonder if theres any merit to comparing s vs x

hybrid tundra
#

I just didn't know porting needs from people to be pro at shaders

#

I'm a gameplay programmer, not a shader programmer

exotic trout
#

no judgement but was it just kind a "if i can make a game i can port a game" kinda thought process

hybrid tundra
#

no

#

I already ported a game

#

for almost a year

#

but I never needed to touch any shaders

#

thing is that it happened with a publisher, who had a contract with a different company, who did 50% of the work

untold moth
hybrid tundra
#

and I only received some tasks from that

#

which didn't involve shaders at all

#

so back then I thouht "this is the porting and that's all"

#

I had no idea its much deeper than that

untold moth
#

Porting usually involves issues like these.

hybrid tundra
#

okay, now I know

#

anyway, I can't just pass my tasks to others, especially not before deadline, so I "survive" this as it is, and then I open a book about shaders

#

this is all I can do for now

#

it was a surprise to me, yes, but now it is what it is

untold moth
#

Anyways, you just need to decide if you want to delve into it or not. If not, you give it back to your superior and say that a graphics engineer needs to look at it.
If yes, you learn properly even if you have a deadline. If you don't make it in time, you explain that the issue requires deep understanding of rendering and you need time to gain it.

#

It's as simple as that.

hybrid tundra
#

basically I can proceed with it, it just takes time to trying to find hacky solutions

#

and then I will learn it normally, when I will have more time

echo coral
hybrid tundra
#

the problem was that on NDA platform the ternary operator had issues, couldn't make a build with that. BUT rewriting it to "select" caused the fog to disappear.

#

but with the help of chatgpt and NDA forums related to "select" issues and HLSL 2021, someone had similar "select" issues, wrote a custom "select" which worked

echo coral
#

sounds like a weird issue but glad its fixed for ya

woven flower
#

I released a game on Steam before but never a DLC. Regarding DLCs, can I just leave the DLC empty (have no files) and then on the main app, check if the user has the DLC and if they do, unlock the feature? So it'll be the same build and base-app they play on?

sage radish
# woven flower I released a game on Steam before but never a DLC. Regarding DLCs, can I just le...

The Steamworks documentation can answer that question.

Your game can choose to distribute each piece of content in one of two ways:

  1. The content can be included with your game files that are distributed to all game owners. Your game can then use ISteamApps::BIsDlcInstalled to determine if the user owns the content. This method is useful when all players can view the content, but a player needs to own the content to use it (such as RTS units, multiplayer skins, etc.).
  2. The content can be stored in a new depot that will only be downloaded by users who own the content.
    https://partner.steamgames.com/doc/store/application/dlc
woven flower
#

Thank you I see.

What about changing a paid app into a free app + paid DLC? Similar question/use-case to (https://www.reddit.com/r/gamedev/comments/r554hv/how_to_give_new_dlc_on_steam_to_existing_players/). Is there a button that gives the DLC automatically to all previous owners? I considered using SteamApps.GetEarliestPurchaseUnixTime on the main app to see if they got the main app before a certain date but it does not seem to return the correct time for me (rather it gives me the time of the first time I call it) for some reason.

Otherwise, some alternatives I considered are:

  1. Making the DLC free for a time period like 2-3 months.
  2. Then making the DLC paid and the original app free.
  3. But the issue is there will be a small amount of players that did not download the free DLC in time before it became paid.

Or is this an edge-case that might usually involve Valve manual intervention?

analog echo
#

alright, sorry if i'm on the wrong channel for this since i don't know a help channel, but if anyone is experianced with Build tools and Compilers,

how can i fix my game's building separating my directories with spaces? its really confusing

I've tried:

  • Reinstalling unity, ( same errors, )
  • Rebuilding Library, ( same errors, sometimes crashes. )
  • Upgrading Versions, ( same errors, )
  • Reinstalling Visual Studio Build Tools, ( same errors, )
  • Checking building on another project ( same errors, )
  • Resetting Project settings and Preferences. ( same errors, )
untold moth
unborn sky
#

anyone have any troubleshooting advice for getting pix to pick up pdbs from shaders when trying to use the analysis feature? i've read through these docs, added #pragma enable_d3d11_debug_symbols to all the shaders, verified that the pragma is doing something by inspecting the compiled shader w/ & w/o it. my understanding reading through various posts on the unity forums is that the pdbs are embedded into the shader, and pix shouldn't require any external files? i did try checking the "copy pdbs" box in the build and pointing pix at the build folder, to no avail.

(this is my first time using pix, just trying to learn the tool atm)

analog echo
untold moth
#

It could be that some shaders(built in for example), don't have the pragma assigned so there are no debug symbols for them.

unborn sky
#

hm, how might i do that? almost all of the geometry in our game uses custom shaders, and i added the pragma to every custom shader in the project. this seems to suggest that none of the shaders have resolved pdbs, right?

untold moth
unborn sky
#

for example:

Pass {
    CGPROGRAM
    // -- config --
    #pragma vertex DrawVert
    #pragma fragment DrawFrag

    // debug / profiling
    #pragma enable_d3d11_debug_symbols

is the debugging symbols not working expected? since unity generates d3d11 debugging symbols, and running pix with d3d11on12 is not compatible with those symbols?

untold moth
untold moth
unborn sky
#

2021.2.15f1, and yep

untold moth
#

Hmm... The docs page of 2021 says the same thing though.๐Ÿค”

untold moth
# unborn sky 2021.2.15f1, and yep

Ok, so I was able to get the debug symbols working with d3d12 graphics api. Couldn't get them working with d3d11 no matter what I tried.

#

I think this is because unity now only outputs symbols embedded in the shaders binary itself and d3d11 doesn't support that.

olive apex
#

is there any way to get il2cpp to generate debug information that gives the accurate line number if a null ref is thrown on the top of the stack? i'm always getting a line number at the end of a function (for the topmost stack frame) which isn't too useful

jaunty fern
#

Hello, does anyone know why the sprite skin component doesnt work when I add it via "AddComponent<>" but does work when I manually add it in the inspector, even if both have the same bone transform references and same settings?

sly grove
#

Pretty sure it will add that automatically if you add it in the inspector

jaunty fern
unborn sky
#

other tools like nvidia nsight graphics have similar limitations for d3d11

runic lynx
#

Hello! Hopefully someone understands Render Graph better than I do.
https://gist.github.com/Futuremappermydud/95cff862cd2fd66e9d53a4be4188ea76
I'm trying to make a render feature that blurs the screen and then assigns a global texture with the result.
The event is set as BeforeRenderingPostProcessing

The object I want to use the blur in is on a separate layer with a Render objects feature.
The Render Objects feature is set to AfterRenderingPostProcessing

Is there something wrong i'm doing in my RenderPass?

#

The furthest I've gotten is that everything blurs but the RenderFunc for setting the global texture isn't called

pliant belfry
#

Is a bad idea a game with 10 singletons?

compact vault
#

depends

wild bane
echo coral
#

Sometimes you dont need a singleton. If you just need a place with some stateless functions not using unity messages? Make em static.

ebon abyss
#

Exposing the instance publicly is usually unnecessary as well

upper island
#

has anyone been able to write/read anywhere other than /Android/data/packageName with unity 6? It requires API level 30 which no longer supports legacy storage permissions but I can't seem to get manage external storage or anything else working

#

/Android/data/packageName is not really suitable because its content gets deleted with the app

storm river
#

Hey folks! ๐Ÿ˜„
I just made a small utility: UnityPackageIconExtractor โ€“ lets you grab the icon from a .unitypackage without extracting the whole thing. Super light and fast โšก

Gist

Unity Package Icon Extractor - Memory-efficient utility for extracting icon textures from .unitypackage files using TAR stream parsing. Thread-safe with async support. - UnityPackageIconExtractor.cs

wet sail
#

please im hopeless someone help me, ive been here for 2 hours, the code is a simple function that tries to capture gamesobjects as mask (as white pixels), but im getting a full black texture. why? (you could quickly look at the function or try it, its not long, please a glance might help)

https://pastebin.com/UAQG7kb0

wet sail
#

anyone?

sage radish
#

One thing that's missing is using GL.GetGPUProjectionMatrix on the projection matrix you make, to apply correction for manual rendering.

#

Beyond that, the only thing that looks like it could go wrong is the view matrix. Maybe it's not positioning the camera the way you expect. You could try applying these values to an actual Camera, to visualize it in the scene.

wet sail
#

how could the matrix be wrong there

sage radish
# wet sail how could the matrix be wrong there

You really can't make any assumptions when it comes to manually rendering things. Are you aware of this?

Note: The camera space in Unity matches OpenGL convention, so the negative z-axis is the camera's forward. This is different from usual Unity convention, where the camera's forward is the positive z-axis. If you are manually creating the view matrix, for example with an inverse of Matrix4x4.LookAt, you need to scale it by -1 along the z-axis to get a proper view matrix.
https://docs.unity3d.com/6000.1/Documentation/ScriptReference/Rendering.CommandBuffer.SetViewMatrix.html

exotic trout
#

@austere jewel Sorry for the ping just curious on a server rule. Modding discussion is banned but I noticed Unity does have an official package for Mono Cecil that they use for internal usage, if I had questions about using mono cecil for stuff is that allowed if i keep the context appropriate?

#

Honestly vaguely curious on what that modding rule specifically applies to because some stuff that is usually modding related can have genuine usage in non-modding contexts, I assume it's mostly tos-breaking related but overall just wanna make sure im following the rules in good faith

modern meadow
#

Usually I have 1 or 2 in project

ebon abyss
#

Then other classes no longer care about the inner workings of the input mapper.

modern meadow