#archived-code-advanced
1 messages ยท Page 132 of 1
If what I said is correct, then at some point it was all used for something.
2.5 untracked memory 2gb tracked, but maximum is 5.66
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.
Ok ๐, async is a good point hmm, about unitask what you think, all code is unitask async
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.
Ok ๐ that theme is important in general, I think
Even better using the platform native tools
Ok dlich thx ๐ for helping
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.
they already do have lod
I think urp has overdraw visualisation so check that next
I don't know how you draw that many tris but could just be the volume naturally taking longer.
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
Speaking of Minecraft, might be researching how Distant Horizons does it's stuff? Might pick up some general ideas that may help
I believe they render terrains only for far distances?
terrains with LOD
basically billboards
or simplified big shapes
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
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
URP has a lot of stuff running on C# side, so it will appear as scripts. But you need to look at the profiler hierarchy properly.
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
isMoving is likely true
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.
Asking more than answering, at scale something like this is better suited for a little burst/jobs thing right?
Definitely
Been looking into jobs for the first time and something like this seems actually not to bad for dipping your toes into?
Or some kind of system spreading the ticks over several frames
Yeah, it's definitely worth it in such scenarios.
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
Then use profiler properly and investigate
I am using it properly
You're not. Or not sharing the info with us.
well this looks like just bunch of scripts checking bool
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.
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
I don't really have time for that. If you don't need help with profiling then we can move on.
well... it takes like 3 mins to replicate this scenario
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?
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
- There's no guarantee that's the cause.
- There's no point talking about it until 1 can be resolved.
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
There's nothing unique to unity about it. Assuming this is really the cause, performing any operation 10k time is gonna take some cpu time. Probably not as much as you think though.
To code and understand better, you need to profile properly.
I really don't think you are correct in this case, literally just create a game object with public exposed bool that prints something onto the console if true, and make like 10,000 of them. The FPS drops significantly even if the bool is false, then compare it with a scene with same gameobject but with the script disabled
This really is the case
I don't have any interest in testing that๐
If you want to prove something, show the profiler data.
It could be calling the script update that's the slow part, not the bool checking.
I think this might be the case as well
yeah
You can try simply commenting out the check but leaving the update method intact and compare.
good thinking!
10k comparisons is peanuts for modern computers, I would assume the update call is what's taking up most of the time.
You are indeed correct
even with an empty
{
/*
if (isActive)
{
Debug.Log("GameObject is active and running.");
}
*/
}```
the FPS is dropping a lot
That's so interesting
Or you have something else that is causing the issue
I really don't understand that stubbornness about not profiling correctly
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.
Debug.Log is actually pretty slow itself, not to mention Update on 10,000 objects
oh the bool is always false so I am not printing anything ever
nothing is ever printed
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.
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
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
is 30k update calls really enough to kill 200fps?
It does cost going from native to managed code
Doing nothing is a lot faster than doing 30,000 things. Calling functions has overhead, doubly so if it's using the messaging system
This is still largly an assumption.
You need to learn to profile correctly.
And I really don't see the point of blocking me๐
ideally tho @mighty shore look into Jobs maybe
ECS would be best to move a large amount of objects quickly or jobs
this same result was re-produced when not using message system, just an empty Update(){} caused the same result
Update uses the message system
You can also just consider doing all this work in a loop in a central manager object rather than individually on each object
yeah I am thinking job will be something I need as well ๐ฆ I really don't want to though
oh well
it's not as scary as it sounds for toe dipping i dont think
I like this approach actually
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
I'm not sure this speeds things up in newer versions. It was a thing back in the day, but I did try it somewhat recently (like a year or so ago) and there was pretty much no difference.
It's definitely cached somehow but I think it's still slower than a normal method call
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
But hey, I'll be curious to see the results if BlueBug tries it (I'd definitely try it in their position)
shivers in fear of ECS
Oh yea for sure, its invoking a managed method in the CLR requiring a large change in cache content
btw talking about ECS and Job why is "Dots" a thread not a channel
I think https://discord.com/channels/489222168727519232/1062393052863414313 should be a chat channel not whatever that is
Perhaps to keep individual topics together I dunno
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
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
look at this example for super duper basic transform in a job https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Jobs.IJobParallelForTransform.html
That doesn't look complicated at all. Vaguely triggers my old memory of attempting DOT
right ๐ if your gonna move it all centrally maybe give that a go while your at it
alas.. I am too scared yet though, I think I am going to attempt what Praetor suggested instead though
i mean its the same general idea
yup
ECS entities will yield the best results as they are structs in large chunks
But doing your own with a monobehaviour will help too
Actually quick question on this example,
If we're minmaxxing would it be potentially worth caching the vector3s that get disposed? or are vector3's like real real cheap
i know you have to dispose the nativearray but your making the exact same vector3s every time in update so was curious
You mean keep the native array and reuse?
either directly or indirectly yeah, or at the very very least referencing the vector3 once rather than creating per
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)
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?
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
heard ty chef
Its better vs managed collections ofc as we don't have GC to worry about or object relocation
not that unity's GC is fancy enough to do object relocation ๐ฅฒ
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!
I donโt recall what it is but make sure you use the correct function too, urp and hdrp have specific ones
Mmmh, I'm trying to find what I can use instead of Graphics.DrawTexture
It does. The first pinned General Discussion thread is it.
I think that form is discouraging
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"
Insired by Caves of Qud https://www.youtube.com/watch?v=U03XXzcThGU
"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...
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
Classes are all heap objects, so they will also be much slower because of CPU cache misses.
indeed, even more risk
Not sure what you mean by risk, but cache miss just results in slower performance, won't impact correctness.
risk to jeopardize the game later
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
a bit old bit still very much relevant
https://unity.com/blog/engine-platform/10000-update-calls
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.
@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?
You can use jobs with entities but I don't think you can control how the scheduled jobs are executed
https://docs.unity3d.com/Packages/com.unity.entities@1.4/manual/systems-scheduling-jobs.html
Otherwise systems run on the main thread
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
okay if thats the case
do you think, each time I need to calculate pathing during Entity update,
it looks at sort of shared pool of pathfinders and get the one that's not being used?
How can it mutate during processing?
I presume this is why you would have multiple instances
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
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?
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
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
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?
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
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
Supposedly it's also quite a good pattern for making management / strategy style games
the expected benefit of being able to simulate massive number of units really make it a fitting approaching for management style game yes
I feel like these machine logics should be done for me behind curtains, not I do it ๐ฆ (tears)
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
isnt it mainly memory cache issues
Yes, ECS is designed to be cache friendly
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
well in c/cpp you can just malloc a region and use it as you wish
ah.. c... shivers in fear of raw c
doesnt really work well in c# without unsafe and marshalling
so you are forced to structs
Unity will not suddenly drop support for Dot right?
It does have all the same functions though:
https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.nativememory?view=net-9.0
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
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
I hope that comes eventually, clean interop with main features usable on both is whats needed
yup
though id take new .net over ecs
must choose one lol
is it bad?
RIP dropped terrain system
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
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
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.
hey guys iโm making a game with procedural dungeon generation, any ideas how i can make occlusion culling work with PCG?
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
Default occlusion culling wonโt do anything for you. You need to use GPU occlusion culling https://docs.unity3d.com/6000.0/Documentation/Manual/urp/gpu-resident-drawer.html
No baking, it just works
right iโll look into it thanks
curious, does this work for hdrp too?
just to be clear this is where the option lies in right
i cant seem to find it anywhere
does it only support hdrp version 17+ perhaps?
Itโs a Unity 6 feature
How can I raise events to communicate between systems in Dot?
How can I communicate between entities in Dot?
no response in dota qq
if you keep misspelling it and spamming unrelated channels nobody will reply
lol this is code-advanced. also YOU do not want to respond. U r welcome to ignore me but dont represent everyone here
@mighty shore Don't spam this channel and use appropriate ones matching your question.
yes but u should warn Anikki for his excessive aggressiveness and dot channel's lack of active conversation into consideration
!warn 205953349093163008 Don't spam the channel. Read #๐โcode-of-conduct and don't post off-topic.
bluebug has been warned.
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
@mighty shore Whatever you typing better be an actual channel related question and not continuation of the spam...
!mute 205953349093163008 3d ignoring warnings, spam.
bluebug was muted.
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?
Not sure what you are talking about. Are you sure you are overriding parent class methods and those are actually being used? In any case you should illustrate and clarify your question.
In the parent prefab, I have added ParentClass component with Show/Hide method and assigned these methods to onclick buttons. In the child prefab, I have added ChildClass. The onclick refs are missing in the child class
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
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.
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
how many vertices/triangles are in this mesh?
i'm actually setting up debug for that one sec
If you're exceeding 65535 it's an issue with hitting the limit of the default 16 bit index buffer.
yeah i doubt that's it cause i've seen that and it was like an incomplete mesh usually
Usually it manifests as triangles being incorrect and connected to the wrong vertices, because you basically get an overflow in the vertex index.
then I think you just have an issue with your code assigning the wrong vertices for the triangles
would you mind taking a look at the logic? i might be missing something
https://paste.myst.rs/8w0n1c63
totally fine if not
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
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
why should it be separated
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
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
perhaps bake a shared smoothed normal into vertex color and scale by that
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
Why would that matter if they're being pushed in the same direction?
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
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)
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
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
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
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
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?
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
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
or like, running it in a debugger?
a native crash may be caught if you do not attach for managed code
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
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?
my understanding the the application hangs, as in the process wont end
Hmm sounds like a deadlock or infinite loop ๐ค
i should have just bought a mac when it came up
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??
thanks for thinking about it,
but I get the impression you don't actually have a mac, so cant really help rn
but thanks anyway
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.
yes, debugging it would likely solve it
Depends on your hardware and how much frame time budget you have for it.
What's a good course to learn C# events?
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?
โ๏ธ
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
๐ Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
๐ Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
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
Praetor can only guess if there isnโt the full context of the problem available
I can only work with the information I am given
nah
thats just not a thing that happened
the release notes are public if you wanna check
has anyone experienced an issue with RenderMeshIndirect not pulling anything for additional light values when DrawMeshInstancedIndirect works fine?
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
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?
I don't think there's a history of how the merge went. Aside from maybe comparing the result to previous revision and inferring from the changes.
An automated merge would only modify lines that are exclusive to local or incoming change. A manual one depends on the person who performed the merge.
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 ?
@untold moth do you know what can be wrong with this shader graph?
on NDA platforms
Is that a quiz?๐
nope...
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?
Work in what ways?
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
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.
it is a post processing effect, yes
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
It's really hard to say. The issue might not even be with the shader itself.
You should use platform native graphics debugger tools.
Unity frame debugger might also reveal some info.
"platform native graphics debugger tools." oh you always suggests things like this
if I would do a throughout researches for things like this, I would run out of time
Hahah. Yeah, because that's the perfect solution.
I have only 2 and a half week left
yeah, its perfect, when there's more time than 2 and half week until submission ๐
You only need a few hours to learn how to use them.
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.
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
That's not how post processing effects work.
You don't want it to be actually transparent.
well, I have zero knowledge about shaders
and I won't have time to learn all from them
Yea try the frame debugger to check what its doing, if its not sampling from the frame buffer it should be transparent.
You were saying that for a month now. Then wasted a lot of time trying random solutions.
??? I'm not even talking about memory optimization anymore
It would've went a lot smoother if you spent some time to actually learn and use the correct tools.
You don't, but you're falling into the same trap again.
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.
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
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
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.
I haven't followed, but I think you're typically of sound judgement so I'll take your word for granted
Two weeks is still a lot of time.
So there's still time to both learn and troubleshoot
yeah, but I still have other tasks as well
not just this one
and I don't know how much time will those require
Then spend some time evaluating the tasks. And tell your management to allocate time per task. Not per some undefined goal.
Or learn to segment the time you have been given yourself.
they won't have any idea how much time needs for certain tasks
Indeed, that you should be able to tell them. At least an estimate.
Yeah, that's not their job. They can compare with what's been done before, and then you can push back with what's different this time around.
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.
I could never tell any estimate well during my years of gamedev work
You take the best guess and add some buffer time to it. Eventually you'll learn to make more accurate estimates.
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.
I'm gamedev in the last 8 years, and I all the time received fully new tasks
so in this way its not easy
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.
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
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?
less about what to fix directly and more about whats different
then figuring out why and/or if that difference should exist
Possibly
should I compare windows PC editor and NDA platform build frame debugger results?
for that specific shader
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
ok I asked it there
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
Thank you.
It might be "transparent" if one of the texture is a screen grab. If you are working with a low performance device, this is usually disable for performance.
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.
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.
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
what BGR do you mean?
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
The BGR is unrelated. It's the render target format.
is it possible that the shader was somehow halfly stripped?
because the tex2D and tex2Darray difference
in rendertarget
No. This is likely unrelated.
Check the texture format/compression settings for the target platform.
for this texture?
For the base color texture used in the post processing effect.
when I select the material, the _basemap is the texture
but the _maintex is empty
not browsed
so you mean the _basemap?
Yes
that's DXT5
Main Tex seems to be assigned at runtime. Ignore it for now.
RGBA compressed DXT5|BC3 sRGB
Is that the settings for the target platform?
yes
Hmm... Bc3 should support alpha.
Then I have no clue at this point. You'll need to use the dedicated debugging tools.
I don't even know where to find dedicated graphics debugging tools for this platform
They're usually installed(or installable) with the sdk. And there should be more info in the documentation.
yeah, I have found that
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...
This is likely something you don't need to worry about. Just look up how to make a GPU capture using these tools.
You don't need to print anything. These tools usually have a gui interface.
Most are somewhat similar to frame debugger, just providing more useful info.
to my surprise, I could find the exact shader in the native profiling tools
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?
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)
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
when I select a black pixel, it says R: 0 1 B: 0 1 A: 0 0.9725blablah
This is just talking about the color that would be used in the preview window for transparent pixels.
This is just the range of values that would be shown in the preview.
I can see "Actions: Pixel history, and a Debug pixel button
but when I click on that, nothing happens
You need to click in the texture to see the pixel data.
that's already done, I clicked the middle of the image
the black area
but the pixel history - debug pixel doesn't show anything
like if I would have not clicked on there
Are you running the analysis/replay mode?
I don't know. This is "live tools", and I paused the title from this app
its API Object 6761
Hmm... Usually you'd make a GPU capture, stop your app and launch analysis or replay mode from the debugger.
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
I'm not sure what you mean by shader graph. From what I can see you're using PIX and I don't remember it having a feature like that.
I mean there are resources in here I can select
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
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).
I wish I would understand what should I do
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
Knowing that it's pix, I guess the platform is Xbox. There's also PIX on windows. You can make a capture on windows and share more info. Then apply the same actions on the NDA platform.
you're very brave stating these kind of things in a public discord channel
on windows the whole thing works perfectly fine
I mean, there's not much of a secret here. Pretty sure everything I've said is in public access.
Yes, and that's exactly why you should look at it on windows. And compare the difference.
ahh ok
Also, it would be easier to explain to you without worrying about NDA.
(not that it matters but im pretty sure the max ram you mentioned a few days ago confirmed it too lol)
in windows build or in windows unity editor?
I don't know when I get access to the PC version build, I asked access
but until then it would be great to figure this out
Build
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?
that would take multiple hours until I could create a build
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
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.
thanks for reminding me I don't have basics knowledge
Basics of troubleshooting multiplatform issues.
Anyways, you can try with the editor.
can't attach to unity editor from the native profiling tools
Hmm... Yeah, that might be difficult.
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
You should be able to see what draw call exactly caused the issue by looking at the render target at each draw call
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
I feel like you should look at the draw calls properly and see where the black screen actually originates.
so you would not even bother disabling a shader and build without it?
It would be faster to find the actual cause in pix. Disabling things one by one, building and testing is gonna take eternity
"It would be faster to find the actual cause in pix." for you, maybe
You should only do that when you have a high degree of certainty of the cause.
you don't consider my low knowledge of shaders
I would also prefer opening a book about shaders
Then learn.
It's still gonna be faster.
and learning it from A to Z
but I guess when I finish the book, then the deadline would already be over
There's no such book. Besides, it could be a non shader issue at all.
ok, if you tell me how to use that app, then I will check it
It could be a render target issue or something.
If you can take screenshots, I can tell you what to check. That's why I recommend using windows PIX.
ok, getting access takes time, until then I tried out disabling the shader and make a build, because it takes 20 min
for NDA platform
because its incremental build
okay, disabling shader didn't work, so the issue will still be with the Frost (the one I already shown)
its now the Steam build
You should launch the build with PIX instead: https://devblogs.microsoft.com/pix/taking-a-capture/
ok it works now
what should I check?
@untold moth
The draw calls list.
I don't remember the exact name, but the second tab(something with pipeline states)
can't see nothing like that
no pipeline states, no draw call list, nothing
You need to take a GPU capture. The UI looks different. Did they change it in the latest version?๐ค
oh wait
"take capture"
The events list would contain various GPU commands. I assume your draw call is somewhere in the hdrp render camera
Switch to the pipeline tab.
That's the one. Or at least the marker. Clear the filter and you should see the draw call under it.
don't know what am I seeing
Expand it more and select the draw call. Then take a screenshot of the tab below(pipeline)
expand what?
is it in the left or the right side?
"select the draw call" select what?
What you have selected in that screenshot
Inside the marker you have selected
@untold moth any idea?
Select srv texture 1. What does it look like?
As well as rtv 0
The former is the screen color before this draw call. The latter is after.
You seem to have too much stuff open. The texture preview is not visible.
Try dragging this to the left.
tried that, but no new window popped up
At this point go read how to use PIX so you can find what you need...
since I don't know anything about shaders as well, I highly doubt I would know what I need from the Pix window
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/
with this mindset, I should also learn shaders from A to Z as well, no?
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
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.
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
Kinda false. Even when you know nothing about something there is way to fix issues or understand them. By example, you can reduce your issue to the smallest thing.
tht's what I try to do
Does not seem like it. I believe the issue lies in one of the texture you are using, remove everything except sampling the given texture.
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).
Is there a support forum for your NDA platform? The Unity team for PlayStation is very responsive and helpful for issues that are platform specific, for example.
already asked them and they said if alpha is 1 in my shader graph, then why do I expect transparency at all....
so it was pretty unuseful
It could also be a limitation of Fullscreen Shader/Platform or even a bug. The effect can be replace with a more manual pass.
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
Have you consider that it might not be transparency
maybe its not transparency. I have no idea
Yeah, if you reduced the issue down to the simplest you would figure it out.
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.
this is the shader
Now try:
Was this made by someone else, since you say you have no shader knowledge? Someone else on your team, or a third party asset?
its a huge team
And try the following after
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.
Also, the Texture2D seem to be completly useless because you always use the first element. You culd simplify it.
I believe it might have been used to hold and history of previous screen grab for whatever effect but is no longer used.
It could be simplify.
and make a build with this?
You test in editor and after in a build.
If it crashes in editor, dont lose time in a build.
Not really
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.
Infinite loops in shaders can crash Unity from a GPU timeout, but I'd be surprised if you can produce an infinite loop in Shader Graph without a custom function node.
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
Do you see the frost effect ?
Is that in replay/analysis mode? And is that really windows?
yes, it is windows
I don't know where is this replay/analysis mode
I could see the frost effect, but it was not transparent
That is some progress, you divided the shader in half. So now you know the issue is the top half.
Or the opposite
if I use this, I can't see the frost effect at all
at the border of the screen
(in editor at least, didn't try it on build)
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:
its not full black
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
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.
maybe I'm making another build
Funny enough, reading the documentation you can learn a bunch of things.
https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@15.0/manual/fullscreen-shader.html
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.
is it what you've meant, right?
And lets see.
Weird that they let the user manage that and don't convert the nodes to the correct shader code under the hood
๐คทโโ๏ธ
Though, I guess then they'd also need to provide some assertions platformwise
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)
well, that's a shader, not a shader graph generated stuff
I didn't check how that works, but that works for NDA
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.
never mind, it seems extreme amount of work to make that other shader work with this image correctly
Ok, finally got to my PC.
First, That's how you start analysis mode
I'm again close to having a panic attack, so now I try to modify the existing bloody shader copy to work with the frozen texture and making that appear instead of this faulty shader
Not the best example, but here's some info you can see during analysis
I will check that after this stuff I try out now
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...
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
do I need to activate the developer mode somehow on my PC?
for this?
I don't think so.
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
I tried this code from someone who seemed like they were having the same problem, but it didn't seem to do anything https://discussions.unity.com/t/setting-scrollrect-position-while-dragging/571040
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.
How is the IntersectBursted implemented?
It's not unity api, is it?
It's not, I inherited the original from the code base and simply made it burst compatible.
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.
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.
69% is how much in ms? How many times is it called?
Also, what do we see on that performance image? That it takes 180ish micro seconds in non-birsted mode?
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.
Well you did say it's 69% so... ๐ if that's also in deep profiling it's also not representative
The time percentage is the only relevant thing you can look at while deep profiling
It's math based on the ms, which is off because deep profiling, isn't it? ๐ค
deep profiling just inflates the ms, but afik it's inflates all numbers relatively the same.
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?
Since this is part of a rather huge and convoluted code base jobifying it would be too time consuming
Ah. I guess you might need to enable it in the windows settings.
ok I could activate that, and now NVIDIA complains for similar reasons
The Nvidia one is probably fine.
are these huge problems?
ok I could switch the Base (locked) to unlocked
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.
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.
if its the only way (to modify common.hlsl) that will take like 2 hours to compile
I afraid
Well, you don't really need it right now.
You only need that if you want to debug the shader code.
but do I want to debug that?
Which you might need to do. But first figure out where the issue originates.
and what are the steps inside the PIX analysis for that?
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.
well, showing that wasn't effective. I'm not even sure I saw any draw calls in those images I have shared with you
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
They should literally say "draw" as you can see in this screenshot here: #archived-code-advanced message
okay, for me "draw" was not meaning "draw call"
I had no idea they are the same
I respect that everything for you is trivial, but not for anybody else
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.
fun thing is that I can't see any Pixel History window, and I can't add that with the "+" button either
I thought you managed to do it yesterday. The way you open it is by right clicking a pixel in the texture and selecting it in the context menu.
yeah, I could open that in the other Pix
but not in the windows version
Even if you right click in the texture?
this is all I can see on windows pix
- Switch to the pipeline tab
- Select the draw instanced entry in the events list.
You will see the pipeline(vertex and pixel shaders and resources bound to them as well as the render target in the bottom left.
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.
DrawInstanced is the draw call?
Yes.
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
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
RT is straightforward that its something render related (but for me, RT stays rendertexture, not rendertarget)
And the output of the shader is the render target.
PS was not straightforward that it means pixel, because no idea from where S comes from
Render texture is sort of a render target as well.
Shader..?
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.
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
Maybe shader compile error during the build? Really hard to say without more context.
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
Not really. The pipeline tab is.
Like I was saying many times by now...
but this Pipeline tab doesn't have render target infos
or if the RTV is that
then it is
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.
RTV is that
I have selected the DrawInstanced
under the FrostPostProcess, which is the relevant thing
This is on windows, right?
yes
Does it look like the effect is rendered in the render target?
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
Try clicking ShowPrior. Does it show the screen before the effect is rendered?
maybe this is why we can't see the texture in there, no?
No. It should be visible even without the shader debug symbols
nope, the effect already there
Then this is not where it's actually rendered. Or it's the first draw call to this render target.๐ค
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
Ok, then this is the right draw call
ok, so should I compare this table with the NDA's similar table?
It's weird that the textures are not visible. Maybe you have somethign turned off in the settings or filter?
Ideally, you need to understand how the effect works. And the missing resources make it difficult.
"display resources: was setted to referenced
when I switch to All, I can see new stuff
Hmmm... What kind of new stuff?
Oh, that's what I was expecting to see.
Select the SRVs and see what they look like. Especially texture 1.
Then compare to the target platform.
@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
#archived-lighting ask here instead OR check the doc page to verify you set it up correctly
https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@17.3/manual/fog.html
I would rather ask
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
"delaying the innevitable" which is?
Not being able to accomplish the task at end because you do not have the appropriate skills.
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.
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 ?
it can but generally don't worry about it until you've got a very specific problem you've found in the profiler
Yes i do, saving to json takes so long as I run it frequently each 5 minutes, I also targets mobile and only the shader took it down to 25fps, so i want to optimize the logic as good as possible
well json in particular is a text format so it has very little to do with that, it's not saving the byte representation of any of those numbers
if you're having performance problems with json it could be worth looking at a binary format alternative
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.
For JSON specifically, I use System.Text.Json, while I never benchmarked it against other solutions in Unity, I'm under the impression that STJ is made to be fast.
And more importantly, STJ does support async de/serialization, which means that you can offload it to a background thread rather than main thread, eliminating FPS drop regardless of how fast or slow it is.
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.
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?
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.
I can only way the same thing as before: use the graphics debugging tools to investigate it. There's no reason for a volumetric dog not working on current gen consoles.
I could partially solve it without any graphics debugging tools, because I still don't know how to use that
the infos the Pix tells me tells me nothing
You need to learn to understand that info. If you can't understand it, how are you gonna understand the cause of the issue and solve it?
well, basically I should already be done with these stuff, not just starting to learn what is what
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.
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
not having time to learn doesn't mean you get to skip the learning
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.
That's great, but we can't really help you without you sharing the info. And I assume you can't, since it's related to NDA..?
Shame we cant even know the console name ๐
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...
its not a switch and its not a playstation
If its the switch for example, id say HDRP is a terrible fit, else the other consoles should handle hdrp fine
maybe its the xbox and their dumb less powerful version ๐ค
But doesnt explain shader incompatibility in this instance
it is ye
We don't really know that it's "shader incompatibility". They said that the shader compiles properly if they don't touch it.
10 gigs of memory 
If it was a compatibility issue, there'd be a compile error.
is that unified?
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
Yeah, that could be very much it.
Probably some issue with variants yeh
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...
@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"
i wonder if theres any merit to comparing s vs x
I will open a book about shaders once I have reached the deadline for sure
I just didn't know porting needs from people to be pro at shaders
I'm a gameplay programmer, not a shader programmer
no judgement but was it just kind a "if i can make a game i can port a game" kinda thought process
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
Then you're not really supposed to deal with these issues.
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
Porting usually involves issues like these.
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
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.
I mean it would depend on the company if they would wait until I learn it or not. And it can cause serious issues for me.
And btw its my responsibility that I wrote I can do porting, and I thought I can do porting until now
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
#archived-code-advanced message do this
I have solved it since then
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
sounds like a weird issue but glad its fixed for ya
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?
The Steamworks documentation can answer that question.
Your game can choose to distribute each piece of content in one of two ways:
- 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.).
- 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
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:
- Making the DLC free for a time period like 2-3 months.
- Then making the DLC paid and the original app free.
- 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?
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, )
It's probably your os locale or a character used for space. Check the regional settings.
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)
Ah, i already fixed it, i just decided to use Mono instead of IL2CPP for right now lol.
Did you have a look at the draw calls that actually use your shaders(that you added the pragma to)?
It could be that some shaders(built in for example), don't have the pragma assigned so there are no debug symbols for them.
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?
Seems so. Where did you add the pragma?
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?
I'm not sure. But you can try switching to d3d12 graphics API and testing d3d12 directly.
What unity version are you using? And are you building a development build?
2021.2.15f1, and yep
I think the way to output debug symbols in 2021 might have been different.
Hmm... The docs page of 2021 says the same thing though.๐ค
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.
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
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?
Are you also adding a SpriteRenderer?
Pretty sure it will add that automatically if you add it in the inspector
Yes I also have a sprite renderer
yeah, i think it's because of what is mentioned in this link i shared: https://devblogs.microsoft.com/pix/debugging-d3d11-apps-using-d3d11on12/#limitation:-no-shader-debug-data. i'm not sure it's a good idea for me to switch to d3d12 at this particular juncture, or if profiling and optimizations in d3d12 will translate back to d3d11, so i'm weighing the decision.
other tools like nvidia nsight graphics have similar limitations for d3d11
It will mostly translate.
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
Is a bad idea a game with 10 singletons?
depends
A singleton is only a pattern which dictates that only one instance of a certain class can be present at a given time.
It depends on how you use that pattern whether it's a good or a bad idea.
Sometimes you dont need a singleton. If you just need a place with some stateless functions not using unity messages? Make em static.
Exposing the instance publicly is usually unnecessary as well
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
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 โก
- Stream TAR parsing, finds .icon.png directly
- Low memory usage, works in background threads
- Great for custom package managers, browsers, etc.
๐ Check it out: https://gist.github.com/DuyTaDinh/5e42401cb6f17f74da63c7d94971caa3
If you find it useful, drop a ๐ โ cheers! ๐ง
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)
anyone?
DrawRenderer is better for this. I assume you've tried it and changed to DrawMesh when it wasn't working. There are a few things that could be causing a black texture. The most likely issue is the view projection matrix. It won't be obvious if it's wrong, because it's essentially like the camera is pointed away from the scene, but you have no way of knowing that.
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.
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
@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
Maybe not an advanced question but I saw this here, I use singletons pretty much exclusively for reading player input, or other values that will be changing every frame. Is that a good use for them?
Usually I have 1 or 2 in project
Your input mapper can have a bunch of static Action delegates other objects can subscribe to instead
Then other classes no longer care about the inner workings of the input mapper.
I kind of have it like that https://hastebin.com/share/pacecateha.csharp
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
