#archived-code-advanced
1 messages · Page 32 of 1
then you have to use the API correctly
then you have to use the profiler to see if any of this stuff makes an impact
I've been doing this so far, so good
you can use the burst debugger to ensure burst compilation did indeed work, or why it didn't
IJobParallelFor with the meshes you mean?
Yup, as far as I've seen there are no errors regarding burst compilation
It makes an impact already, It took in c# around 8000 ms now it takes 100ms
i'm not 100% sure yet how your thing all comes together
So, The jobs work with mesh data, and it's parallelized through vectorization of the vertices
if i were you, i would generate an image, and then use unity native terrains
since it looks like you are generating a heightmap
and use the unity terrain tiling techniques that e.g. Gaia Pro does
you can also use the runtime terrain assets
What do you mean by that?
there are unity asset store assets
for designing procedurally generated infinite terrains
using built in unity terrain as the rendering / rules backend
which helps a lot
it's hard to say what your goals are
I see, my goal is to do most of it myself, too learn mainly, and see what can I do
Hi all! I have a few questions regarding Unity's asset bundle system (particularly for Unity 4). 
Firstly, what happens during the process of an asset bundle being cached to disk? Also, what are the differences (in detail) between an asset bundle and its cache? And how is the name of the cached file generated?
This is to try get an old game from 2014 that got shut down back up and running, as such I suppose the crux of this question is - what would I need to do to turn these caches back into bundles that can be downloaded from a server 
(putting this in advanced as it's rather niche. thanks for any help!!
)
which game is it?
you can try using many tools on github to unpack these files
and try to repack it using the editor
you've made really great progress so it looksl ike it will all work out
you're really close it's going to be like 1 or 2 api calls to tie it all together
A game called Monkey Quest by Nickelodeon. I would like to have a way to repack it automatically as we can't redistribute the assets themselves due to copyright
hence why I'm looking into the process itself - surely if you can decompile and repack it, the cached form isn't too different from its original?
there are tools for doing a lot of this since modding unity game sis popular
I'm unaware of ones that can directly convert these or, to be honest, what the differences are
what actually happens during the caching process
i don't remember there being anything notable about caching in unity 4. caching meant saving the asset bundle to a well known place, and rolling your own way of keeping track of which are newest
there's prior work on this game, i'm sure you can find it
the earliest version of unity i used was 3.5
the prior work was by me
, we used to decompile and recompile in the editor, but that takes a long time to do, so I'd rather automate it and streamline the process by sticking as close as we can to the original files
if there's nothing different in it being cached, would it not be the case that a simple rename would work? am I just overthinking things?
I haven't a clue what happens behind the scenes tbh as the Unity API calls the internal C++ dlls when it reaches that step
you should decompile and recompile in the editor headlessly
it will be more valuable to learn to do that in the long run than something specific about the file format or whatever
automation is useful
headlessly ?
Thanks! You are all have been really helpful
I am learning the Single Responsibilty Principle with coding. I am following a long this tutorial: https://www.youtube.com/watch?v=f5zJ4D2E0dI He creates a script that is purely for OnTriggerEnter. So he can put that script on an object and define a UnityEvent in the inspector that should run after the trigger enter is called. How would this apply to Visual Scripting? Is this possible? I can not seem to find it
Just Here To Plug My Social Media Stuff:
https://www.patreon.com/dapperdino
https://www.twitch.tv/dapper_dino
https://twitter.com/dapperdino4
https://github.com/DapperDino
Read up on S.O.L.I.D: https://en.wikipedia.org/wiki/SOLID
Take part in the Community Game Jam: https://itch.io/jam/cgj
Afaik you cannot expose events to the inspector from within Visual Scripting. 🤔 Its 💩
Also #archived-code-general or more likely #💻┃unity-talk
I have a readonly nativearray that I would like to be accessible at all of the jobs that are called parallelaly and have it inside, however im getting this error
System.IndexOutOfRangeException: Index {0} is out of range of '{1}' Length.
This Exception was thrown from a job compiled with Burst, which has limited exception support.
0x00007ffd18ca5c93 (1559e67c07d3fa3f234957e8a168a8e) [unknown:0] Unity.Collections.NativeArray`1<System.Single>::Unity.Collections.NativeArray`1<float>.FailOutOfRangeError
0x00007ffd18ca5bda (1559e67c07d3fa3f234957e8a168a8e) [unknown:0] Unity.Collections.NativeArray`1<System.Single>::Unity.Collections.NativeArray`1<float>.CheckElementReadAccess
0x00007ffd18ca5cd8 (1559e67c07d3fa3f234957e8a168a8e) [unknown:0] Unity.Collections.NativeArray`1<System.Single>::Unity.Collections.NativeArray`1<float>.get_Item
How can I make it sharable?
#💻┃unity-talk message <- maybe someone here has thoughts about this project structure problem?
Hey. is Unity's physics system dependent on the global space of a piece ? like, when I move my whole scene to some y += 20 position, can I expect the exact same results as before?
I did this quick test that surprised me really. in here the global offset actually changes the physics results! so I came here to see if this is a common issue, or perhaps my test was wrong?!
physics simulation happens in world space
yes, I know. but I'm asking if the results will change if we move the whole thing to some other offset position. I think you'll see what I mean if u watch the video
I'm trying to capture steering wheel X value when window is out of focus. I have set runInBackground and IgnoreFocus in settings. Am I missing something for it to work?
I am just reading now that Device layout can override canRunInBackground but I am not sure if this will work and how do override wheel layout
From what I see now Its not possible at all to do this. Im trying to figure out a way to do this with windows api. Any tips appreciated
I don't know about Windows APIs for gamepads, but you could use DirectInput through SharpDX.
Will it work with window out of focus?
Also any tip how to reference SharpDX in unity?
I don't think DirectInput knows or cares about what window is in focus. You can download the NuGet package here:
https://www.nuget.org/api/v2/package/SharpDX.DirectInput/4.2.0
You can open the file as an archive with 7-Zip or WinRAR or something similar and find the compiled .dlls under the lib folder. The one under "net45" is probably the best match for Unity.
Alternatively, you can use the NuGet for Unity package to install it through the editor, but I've have mixed experiences with it, which usually end with removing it from the project.
https://github.com/GlitchEnzo/NuGetForUnity
If you install it manually, you'll also have to install its dependencies, which is just SharpDX itself:
https://www.nuget.org/packages/SharpDX/
Gotcha I'll try this and update later if I manage to do this. Ty @sage radish ❤️
Ok I am receiving inputs from wheel when out of focus. It was easier than I expected. I still need to to change the calculation for what I need but thats another problem. Thank you i though I was gonna kilometers. ❤️
No, you can't expect the same results. Even in a deterministic physics engine (which Unity hasn't), getting deterministic results require having the same inputs.
This is exactly what you are doing here, modifying the inputs. Moreover, you're doing it by mouse-dragging stuff manually around, causing FP imprecisions to be compounded over hundred/thousands of individual translations.
meaning you can script the editor to run from the command line
I didn't realize Unity had the ability to run Editor actions via the command line
excellent
how would you achieve that?
it's in the docs
command line editor batch scripts or similar will get google results
if the results will change if we move the whole thing to some other offset position
in principle, the "results" will be the same regardless of which "offset position"
it looks like you are working in xy space for an xz game
since ya talking about nuget i got an issue with downloading dependencies through the unity package, the thing seems like a mess
I'm getting unity assertion exceptions on some code of mine (well, a library I'm using). I've narrowed it down to one line of code but the unity code doesn't "fail" per se, it just throws an assertion exception which is spamming up my console.
Is there a way to break on unity assertion exceptions? I'm not sure if this is a me-bug or a unity-bug, and googling hasn't been super helpful.
(the stack trace on the exception isn't super helpful but I can post it as well)
something's failing in the unity mesh bake on particle trails
the only problem that I have with this is that many programs have the tendency to introduce weird bugs during decompile - even DevXUnpacker, which we have a license for, seems to have issues. Hence why I'm interested in the process of caching, it's differences, and possible reversion, as this seems more friendly for the end user
I'll definitely look into headless decompiling though 
hmm you can't really rebuild a working game using something like devx, you can only use it to retrieve assets
and for education
oh! no you can 
I really don't see why it wouldn't be possible to revert the conversion though
the only problem is that it's not documented
It would be impossible because unity doesn't disclose their packing process. It's not an open source engine you see.
At least the implementation. Things that you don't need to know as a developer that abides their user agreement.
People seem to have reverse engineered the unpacking process, so I'm just looking around to see if people have information about the differences

As for what you can and might want to know is mentioned in the docs:
https://docs.unity3d.com/Manual/AssetBundlesIntro.html
An official discord is probably not the best place to ask that then. It's against the server rules to discuss decompilation of built unity apps/bundles.
That's why I was simply asking about the differences between bundles on servers and 'archives' stored on disk, as well as how the names of caches are generated etc
more general questions than direct
although I do see what you mean, I apologize - I didn't give the guidelines too much of a read, just didn't want to create an XY problem
Probably not much difference.🤷♂️
If the docs don't cover that I'd assume there's none. At least as far as a regular dev should be conserned.
Does anyone know if theres anything faster then AnimationUtility.SetEditorCurve
It seems creating a animation pragmatically takes quite a while. Im having to split the workload in a coroutine only calling it < 30 times per frame
Is there a dictionary/key-value type that requires both the key and the value be unique?
Hashset<Tuple<int, Foo>> for example
Sorry - I meant to say, guarantees that each value is unique as well as each key. also do tuples naturally compare-by-value?
but could be that you need to make your own data struct (depending on the types you want to have in there) and implement a hash function that reliable hashes both values... not sure
word. nothing built in tho?
ofc not
but its also really simple to build that in a custom structure on top of two hashsets
yes. you can fill in from here:
class UniqueValueDictionary<K, V> : IDictionary<K, V> {
Dictionary<K, V> m_Inner = new();
HashSet<V> m_Values = new();
...
}
Do you guys know how I can get the values from an array on a ScriptableObject to a property drawer field within that Scriptable Object? I need to fill a dropdown with the values of the "Object Events".
What are the minimum specs for a Unity Headless Game Server? I setup one up on Ubuntu 20.04 LTS, but as soon as clients join and game starts, I get 100% CPU spikes, and game gets laggy.
I was on a GCP (Google Cloud) e2-small at first which is (2) .25 w/ burstable to 1.0 VCPUs, 2GB RAM. I have since upgraded to a e2-standard-2 and I am still pegging the CPU at 100% with 8GB RAM and 2 dedicated VCPUs.
This wasn't an issue when I tested locally on both Windows and Linux at my house.
Any ideas?
Typically for a game server you want at least 2 full (v)CPUs if you have just one CPU you will constantly have lag issues due to resource contention
but are u sure about the "even in deterministic physics engine" ? I mean, 2-1 should be equal to 9-8, right? isn't it part of the deal with deterministic systems to generate the same output for two inputs IN1 - IN2 and IN3 - IN4 such that IN3 = IN1 + C and IN4 = IN2 + C ?
I mean since they use soft floats, the results of a subtraction should be the same if in real math it is
it's a 2D game. unity's default coordinates for 2D is xy. where did u take xz from? and besides, changing coordinates is still merely "changing offset" , since rotation is also part of a transform matrix, which affects the local transform in the end. so in theory, if the physics system is ideal, it should give the same relative results if you rotate everything by some angle
I mean, 2-1 should be equal to 9-8, right?
Nope, it isn't. Read about floating-point arithmetic.
I mean in deterministic physics system where they use soft floats
(which I'm not super sure what they are, but the special name makes me think it works like Real numbers)
That doesn't exists in the the context of real-time physics engines, for performance reasons.
And that's not what "deterministic" means. Deterministic means that for a given input, you will always get the same output.
This is often useful in multiplayer games where you need to "replay" the player inputs server-side while being consistent with the client-side results.
And even scientific/engineering physics software (at least those that I know of) work with limited precision numbers.
can I install unity 2022.2.0b8 on Ubuntu OS? Im only seeing downloads for windows/mac on the page
which affects the local transform in the end
There is no concept of local transforms or object hierarchy at the physics engine level, it operate on each object final world position.
Beside, the only way to get more precision out of the hierarchy would be to traverse the whole hierarchy between two transforms to discover the shortest path, every time a position is queried.
This wouldn't solve anything, as you would still get non-coherent behavior between similar setups (you just reduce the error, you don't eliminate it), and you would tank performance.
I'm only seeing 0b16 (Beta) and 0a21 (Alpha) on Ubuntu
0b16 might work, let me try
you are a brave man
Got no fear bro hehe
O wait i found a Linux download for 2022.2.0b8
tbh if you are using beta releases latest is best
ah. good to know. well that's a disappointment :(
would make sense if they needed to take advantage of GPU calculations on any normal machine
Makes sense, in my case I'm already using 0b8 because of the project of my research, would be riskier to change at this point... or maybe it doesnt change anything but wont take the risk
Thanks. I am updating garbage collection and debug/verbose logs to nothing to see if that improves it.
which is more performant - Physics.OverlapBox or Physics.OverlapBoxNonAlloc?
Depends on the use case
what factors should be considered?
NonAlloc is faster in aggregate if there are more than a few calls to the same method
The allocating version is quicker for a single use, but creates garbage
perfect, thank you. How come alloc one is faster?
because it doesn't need to copy anything?
i have forgotten the details of why. Might be internal stuff, fewer transitions to native code etc.
fair enough, I'll take your word for it 😛
the info is somewhere, you can Google it
I read the same thing before somewhere on unity answers or google but I couldn't find it anywhere
probably searched the wrong terms
oh, another question about the OverlapBox I just got - it doesn't need to be a perfectly square box?
like it could be a rectangular box?
I just saw that you need to provide halfExtents which is a Vector3... but I remember explicitly that somewhere it said it needs to be a equal-sided box
I’d be surprised if it needs to be a cube if you can give it arbitrary sizes as input. Probably also why it’s called box and not cube
that's exactly my thoughts... this means that I had wasted approximately 12 hours of my time a few weeks ago trying to get it to work with combinations of cubes
Computationally checking a cube and a box shape have identical cost
yeah, I did it by having multiple checks
but you can in theory optimize a cube version further since it is a more constrained shape, the difference however would be marginal
instead of checking a box of (1,2,1) I did two cubes of (1,1,1) and (1,1,1)
thought I was being super smart solving a problem when there was no problem to begin with
Yeah, that’s pointless
Fewer checks is always better than a hyper optimized shape when the original shape was already super optimized
Not the least because it saves development time 🙂
i didn't really watch the video, but the answer to your question is that if you make 10 little pool tables with identical objects in them, in 2d, and applied the same forces to the balls, and you modeled your scene correctly (for example, but not limited to, working in xz if it's a pool table), things will behave more or less identically, the way you'd expect, in all the pool tables
you can't use unity on linux practically speaking. what is your objective?
unity 2d physics actually supports a level of determinism that is sufficient for networked multiplayer out of the box for some scenarios
it's distinct from 3d physics
i think there is a lot of noise on google about this so it's hard to find knowledge about it
the user has some other problems going on in his scene but it will work
the reason physics 2d determinism is a priority is not because of networked games though, it's because people design puzzle games with it
Good to know. I'm not actually familiar with the Unity 2D physics implementation, was mainly talking in the context of the PhysX (3D) implementation.
But yeah, maybe is something more than just FP precision related variance due to varying inputs going in the @real blaze case.
even their own knowledgebase article seems a little wack
I'm in a high performance research
what are you trying to do
I'm trying to compare performance with multithred jobs and variations (sorting, one thread, multi thread, no jobs)
Actually the lab is entirely on Ubuntu due to better performance
hmm
what is the big picture purpose of this?
the lab
what do you mean?
can you be a little more precise here?
because the stuff in your parenthetical doesn't sound right to me, as categories of stuff you are trying to compare
what are you actually trying to do?
unity editor only works well on Windows and macOS, and the players work best on Windows, macOS / iOS, consoles and Android
The machines I use in the laboratory uses Ubuntu as OS
okay so is your goal to have something that works
or to like, futz about a bunch and not get much done
i rank "dealing with linux desktops" very very low on my personal, subjective list of things worth doing for any reason, even intellectual reasons
I already have this implemented and working. Just will have to figure out now why the plastic SCM option doesn't shows up anymore
So I have an interesting challenge on my hands, I'm trying to develop some functionality for objects in my game (namely NPCs and the player) to accept callbacks that may modify or add onto existing functionality. (i.e. a callback that may run a second attack when the player attacks)
While I have gotten most of the way there, I am stumped on how to let the callbacks take contextual information in their parameters and be able to change it, like say, taking a reference to a damage value and being able to increase it before an attack happens. A delegate for every possible context seems like the solution (I was already planning on enums to define what exactly a callback is supposed to be applied to), but that complicates storage and the adding of these callbacks. Any thoughts?
The intention behind this is to allow the nondestructive addition (and removal) of powers from an external source.
delegate for every context is definitely wrong way, look at how new input system's context works and you'll see how it's done normally
Aight I'll take a looksee
the architecture to do this as flexibly as you want is complex
can you give a concrete example
i think it was replaced by a package
Will read more about it, thanks for the info
Well I'm developing a text adventure, but it uses a complex D&D like architecture in the background, so use cases would include passive effects such as "doubling any attack sent, increasing damage dealt by a fixed amount, allowing entirely new abilities, having a 50% chance to block an attack" etc. And these are all effects I need to be capable of extending the base player class, with no need to have the effect built-in in some way (although the checking for and running of the effects must still be built-in of course).
An implementation would ideally look like "player is told to attack thru text input, player class checks for callbacks before attacking, runs those callbacks if they exist, accepts any modifications to the attack made by the callback, and then proceeds"
At least that's what I'm seeking to do. It's a very big inclusion evidently so what I'm looking for is probably more so examples of what other games have tried to do to solve this problem.
The way I solve a problem similar to this is to have an event/message bus that allows listeners to modify the event/message as its on its way to each listener, and a way for each listener to include their priority when subscribing, in the form of a number, like how Unity's script execution order works.
So in this case, some player script would listen to the AttackEvent/Message to do the attack with whatever data that is in that event/message, but another ability script could also listen to that event with a higher priority and modify it however it wants.
That's an interesting idea, actually. I'll think on that.
Here's a library I wrote with that concept. I can't recommend using it directly, because I've kind of abandoned it, but you can maybe borrow some concepts from it.
https://github.com/PeturDarriPeturs/GenericEventBus
Here's the section on modifying event data
https://github.com/PeturDarriPeturs/GenericEventBus#modifying-event-data
Oh, no intention to use that directly, I'll take a look though and see if I can get inspired by it for my own implementation. So far what I've wrote is an "aura" object that carries the callbacks (and also stat mods to allow for nondestructive transformations to stats), with which my entities can implement for their own needs. The only questionable area right now is the actual storage of those callbacks and their execution though. Deliberating on it.
okay well you can look at the xmage or spellsource code (mine), which are both java projects, or Sabberstone (C#), for an implementation of, essentially, card game text & rules / spells for games
i hear what you are trying to do. it is essentially the same for any kind of game like this, including what it sounds like you are doing
it's really useful to think of these things as strategy card game cards, and to describe their effects with short text. D&D already does this.
so don't get too hung up on the genre differences here
it is really challenging to try to do this if you already have some decoupled architecture in your game. for example, if you are representing monsters and items with scriptable objects, and if game objects have references to each other, and game objects represent monsters and items, etc.
since you are making a text adventure, you might already be doing something very tightly coupled
which is usually good
you can't really do this in a decoupled way
an "event bus" is just one piece of a much bigger puzzle
there are a lot of architectural insights that make these sorts of things way more realistic to program.
i don't know how else to put it, it's really hard
Hm
for example, imagine all the spells that can be associated with an item, like casting a fireball, healing someone, conjuring a creature, combining two effects together, applying and de-applying an aura, etc., were functions with exactly the same signature, but simply chose to use (or not use) certain arguments in the signature
so instead of
void Heal(int healingAmount);
void Damage(int damageAmount);
void Conjure(string nameOfCreature);
you'd have
void Heal(int? value=null, string nameOfObject=null);
void Damage(int? value=null, string nameOfObject=null);
void Conjure(int? value=null, string nameOfObject=null);
this for example is an essential feature of architecting this kind of game
it is so tremendously important that pretty much every version of this whose source code you get to see in real life, like xmage and spellsource, do this, and 100% of the other things that never ship and no one plays and don't work and are too buggy do not
because this lets you do
void CastSpell(string nameOfSpell, int? value=null, string nameOfObject=null);
and now, you have a way to simply do
void ModifyEffect(CastSpellInvocation myInvocation) {
var targetInvocation = myInvocation.targetInvocation;
var algebraicOperator = myInvocation.algebraicOperator;
var appliesTo = myInvocation.nameOfObject;
...
case AlgebraicOperators.MULTIPLY:
targetInvocation.value *= myInvocation.value;
break;
}
and
var doubleDamageSpell = new CastSpellInvocation("ModifyEffect", value: 2, algebraicOperator: AlgebraicOperators.MULTIPLY, nameOfObject: "Damage")
and now, CastSpellInvocation can be [Serializable], you can design it in the editor (Spellsource), or simply write the code - you can, after all, just call ModifyEffect with the right arguments (Xmage)
@sterile snow this is like 1 big part of a big big puzzle
for the examples you gave, you don't necessarily need a ton of implementation. but you do need the bones
🫡
Well. I'd say you've given me a lot to think about, never really thought about all this.
slay the spire uses all code like Xmage - https://github.com/GDami/UpgradedDefectMod/blob/master/src/main/java/upgradeddefectmod/cards/blue/Infuse.java
I'ma take a looksee
in which case you end up with class DamageSpell : AbstractSpell
but the fields in abstract spell are the arguments to the spell function i described
it's two sides of the same coin
observe AbstractPower has amount and source for all powers
@sterile snow is this helpful?
okay feel free to ping me on this journey!
I've decided to implement a container object with properties like "attack", "value", and so on to give information on the contexts I was concerned about for the meantime. So a callback that extends attacks can just look to see if this object has an attack it can apply a change to.
I've been doing something similar already with the payloads the parser sends after it figures out the player's intention.
The container won't necessarily have its properties filled out but it doesn't need to, and it can have additional ones added later if I see the need to.
As an aside: decided to make a pretty rudimentary global event system (add listeners, fire events, and extend with new events super easily) and wow this is making things a lot nicer.
you can use unirx for this
don't actually make your own event system
Aight I'll do that
ah, yes that's exactly what I expected the 2D physics to do. but in the video, I duplicated the whole board to different positions and applied the same force to the same object to all of them. the results were different... perhaps my board had a little problem, although I had removed all the custom components that change the Transform in any way.
- also if I may ask, what's the source for this? is there any articles or official page on it? because I searched a lot and didn't find a single thing.
here's the video if you wanna check it out
@undone coral
This is a very specific question, but does anyone happen to know if NativeQueues work with Burst? (I could do some work to verify this myself, but just wondering if anyone has experience with it already)
I don't think any of the collection types in the Unity Collections package are incompatible with Burst.
This package provides unmanaged data structures that can be used in jobs and Burst-compiled code.
https://docs.unity3d.com/Packages/com.unity.collections@2.1/manual/index.html
Okay thanks, that’s what I initially assumed 👍 I’ve been getting some random crashes in the editor after I implemented NativeQueues, so I thought maybe that was it. But it’s probably something else, I’ll have to dig a little deeper.
Just an idea, but I’d consider a sort of “tagging” system, where you have values (that represent healing, damage, armor, etc) and these values can be tagged, eg. They have a list of strings attached to them. It can just be a class { float value, List<string> tags }. Then they can be stored in a dictionary, and modifiers can look in the dictionary for the type of values that they modify, if they exist. So when a character attacks, they put the attack value in a holding area, and any character can look in that area to modify relevant values (by reference). I can explain more if you like. But generally I’d try using dictionaries and having any modifier/effect search the dictionaries for relevant values (string keys), if they exist. That keeps the system flexible imo. Or that could be the wrong approach. Just an idea.
I'm having an issue building my project from a gitlab runner (elevated powershell).
I don't have any issues when I run the commands manually but once the runner executes same commands it gets stuck :(
okay it sounds like you are doing something pretty sophisticated
for starters, you should never run unity with an elevated shell on an ordinary desktop
on windows, unity does not print anything to console
you have to tail the log file
so | Out-Default doesn't do what you think it does
it does nothing, because it never prints to the console
i think you must have seen that
yea I saw that
so then it will appear to hang while it is building
yea but it never stops building
what do you mean by 'tail the log'? I don't know that term
hmm
before i continue, do you want to be a devops engineer? is that something you want to learn?
no
but I need automated builds
what do you do with the automated build?
I run it the next day to see if everything still works after I merged something into master
by still works, you mean, you want to know if the project builds?
but you merge locally on your machine
help me understand the purpose of all this
I have a gitlab repositories set up on my old laptop and my old pc is functioning as a runner, to run tests and build
okay, when you say run tests
do you mean run automated tests?
or do you mean, you as a human being QA a build of your game?
I run automated tests but also build the project so I can do some manual playtesting
okay, like unity editor tests right?
yea
so far everything you've told me is 100% supported by Unity Cloud Build
it also isnt' clear to me why you are not using GitHub
GitLab lets me do all this self-hosted
As an means to an end I suppose, but not primarily
i've authored a unity building automation solution. this takes months of product development
you're not going to get this to work
in a reasonable amount of time
you're already doing a few things totally wrong
that you will have to scrap
so i really think you should use unity cloud build
as soon as you didn't know what tailing logs meant
this isn't going to happen
do you see what i am saying?
what things am I doing wrong?
well you're using gitlab, and you're using gitlab runner, and you're using gitlab runner on windows
yes, because linux can't build for windows
you're trying to run a CI runner on a desktop, with desktop security model and desktop crud
like i said
there are a thousand "tailing logs" between here and there
not 1
you can certainly run your builds headlessly on your own local computer. that's what i recommend you do
and like, use github
i don't know what the purpose of all of this is really
running your own source control is as reckless as running your own database
it would make anyone, not just me, seriously doubt all your other decisions
Why is it reckless? It's running on linux with custom firewall.
hmm
well i think you can keep going down this path of learning how to be a devops engineer
It all used to work perfectly before I upgraded to Unity 2022 btw
Do you mean this?
Devops is boring which is why I say, no I don't want to be a devops engineer. But I do what needs to be done xd
then you should seriously use unity cloud build and github
yea if I can't get it to work again I'll use that. But I like my local GitLab machine ^^
When writing a custom generic class, is there a way to have a static method that doesn't require the T parameter?
class BaseClass {
static void SomeMethod();
}
class GenericBaseClass<T> : BaseClass where T : GenericBaseClass<T> {
}
but if you are trying to do this, you are probably doing something wrong, like making a "singleton class" or similar
Hello! I want to create a custom animator that uses an external time variable as a time multiplier. I can't however create a script that extends an animator and use that, since it needs to be a monobehaviour. How can I do that?
i think you can reference pieces of the state machine, which supports time multiplication on the states
so you would copy the state machine and modify it in a separate script maybe
not sure
For all the animators? I have no idea on how to do that
@undone coral im writting a wrapper for flattening a 2D array into NativeArray and when I schedule the job I cant pass the class cause its just a wrapper, I'm not ready to write my own collections. So instead I pass the internal nativeArray but once in the job I want to use a method from the type to read/write to it https://pastebin.com/09Tc8jwR
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
okay well your jobs, how many types do you need
like 3?
you can author the 3 methods
and move on with life
you can't do what you want to do. you can't make a struct a class
its a class that contains a struct
i see that now, well it' snot burst compilable then
in which case you moot the point of using jobs
most of it anyway
Ok that's what I was trying to do, but I need to do it in an automatic way
you can subclass FlatNativeArray2D for the 3 types you will use it with
I pass the struct to the job though not the class
I can't create a script and modify all the states and parameters each time, it's a lot of work
I was trying to find a better solution
like creating my animator component extending the unity's animator and then, in that script, accessing states of the state machine and multiplying all of them by a timeSpeed variable (found in the game manager, universal to every custom animator)
does that make sense?
yes the struct is a nativearray
are you saying I could pass the class?... mmm the thought never occured to me. lol
no you have to pass value types if I remember right
no
i'm saying
do public class FlatNativeFloatArray2D : public class FlatNativeArray2D<float> {}
and move on with life
now in that class, you know it's a float, make the method you need
you will literally only have floats and vector3s
or whatever
then you are done
does that make sense?
i don't know what you are trying to do yet
like what is the job? where do you want to use a static? it doesn't make sense yet
@undone coral oh i see what you mean there is no need for a generic type
I need to store data per charater and LODLevel
by now you could have declared the three subclasses
i think you can figure this one out
you're almost there
thats what I'm doing now and I need to change it to add a level
Its been functional for months, I was trying to add a method
i see
Hi! How does Unity know which mesh to load from an fbx into a mesh filter's mesh?
I have the GUID for the asset (the fbx file) from the meshFilter, there is also a fileId provided there that should tell Unity which mesh to load from the asset. The problem is I can't find anything that would tell Unity that that ID should correspond to that mesh
The metadata of the FBX file has no mention of this ID and I can't find this ID listed in any node of the FBX file either. Anyone has any experience with how this works?
nevermind I found it, I was searching incorrectly, here is the answer for anyone interested: Unity hashes the mesh's name: https://forum.unity.com/threads/fbx-submesh-fileids.948882/
hi devs! question some of you suffer the crash issue related with libc.so and firebase recently? if yes you solve it? some walkaround idea to that problem?
Very confused by this error. Wanting to have a simple Unity build pipeline in TeamCity. This doesn't occur on developers machines. Only on the team city machine.
I've had a lot of trouble personally getting CICD pipelines to build packages properly.. so much so that I generally default to just tossing the source directly in my project instead of using packages when possible. I've done this 3 times in my current project (for Ruffles rUDP, UIParticle, and Telepathy networking) - all of which claim to have easy package support with unity but then failing in build pipelines.
I'd start with making sure your packages json files are in the repo, and that the packages themselves are as well. I don't know the nitty grity of how unity resolves those packages but .. it's not always trivial to get them working for command line builds.
@pulsar owl
How not to repeat code stored in supposedly protected/private (access modifier) methods when using composition over inheritance? (decorators)
Let's say I am making a state machine for movement. I am trying to create states by creating the base class and then building decorators around it. But there's supposed to be an event in interface IState. How to trigger the event from a decorator when IState interface's client doesn't need a method like TriggerEvent in interface IState?
So far I've come to only two solutions:
- make IStateChanger and then pass it to the states, but then there would be circular dependency between state machine and states
- making an interface which would inherit from IState and then implement the new interface in the most basic state, not a decorator, but it would also mean that the most basic state has to know about an interface made especially for decorators
pleading for your comments
So I ended up inheriting from StateBase with StateBaseExposedForDecorators implementing IStateExposedForDecorators. Tho looks like over-engineering
So I was trying on friends pc and SharpDX.DirectInput is not finding his wheel. Itcan find his normal gamepad though but the gamepad itself still doesn't work out of app focus. What do you think can be a problem for this? @sage radish
After some googling, it looks like DirectInput is actually an old API that has been replaced by XInput, so that might explain why it's not working. Sorry about that. Here's an XInput C# API, but I haven't used it before.
https://github.com/speps/XInputDotNet
But the documentation also recommends to support both APIs, because XInput won't work with old devices.
https://learn.microsoft.com/en-us/windows/win32/xinput/xinput-and-directinput
So i also tried using sharpDx.xinput it doesn't detect neither my gamepad nor my wheel. I think it only works with Xbox360 controllers
Did you enable unsupported devices?
wdym?
And there should be remote devices or so, and there unsupported devices, you can I think right click or similar and enable unspported devices
Sorry, can't test right now, unity is loading a huge project right now 😄
I think this is only for Unity.input or new input system. Yet both of those don't work for me out of window focus. And I changed to runinbackground and ignore focus.
Ah okay, was not sure if this is just fir inputsystem or the whole input detection inside unity
Hey guys, I am not sure if anyone has done this before, but here we go 🙂
I am trying to compile a rust plugin in unity using webassembly (rust compiled to wasm). We are running into some issues regarding pointers...
Right now we got something working using a lot of copying:
We allocate a buffer in unity, associate this with a javascript array in the jslib, allocate a native buffer in rust, use that native buffer to call our rust function, copy the result to our javascript array (and therefor the unity buffer) and then deallocate stuff.
This is not really feasible as this would be very slow.
I cannot imagine unity being able to work with web assembly but not being able to pass heap allocation somehow, is there anyone who knows a sollutions to this issue or anyone who worked with this technology before.
Thanks every, sorry for the long post
Any ideas how to get racing wheel input out of window focus? Im running out of ideas
Elaborate?
I want to receive Steering wheel X axis data while the game window is out of focus. I've tried unity way of getting input but its only working while the game window has focus.
Did you try Google?
I did for more than one day.. I havent found anything thats working. Im looking for angel to enlighten me of my stupidity 👼
Hm, can't really help you on that front then, sorry
There definitely are ways though
Maybe packages or smth
I g you are not the angel im looking for ty though ^^
Maybe I found something of use
Thats still unity way. It only works for supported devices. Wheel doesnt count as supported.
Ooooh
You're talking about an actual hardware piece a physical steering wheel for say like a racing game?
ye
Ah yeah that might be an issue
Cuz that's probably a niche that has a lot fewer answers
well will still look for a while for an answer
Good luck!
With your good luck I can already see an angel stomping down from heaven wanting to give me an hint how to solve this. TAKE ME ANGEL INTO YOUR ARMS 🫂
XD
If it’s not supported by Unity then you may need to use platform native API (windows API for example?)
I tried using Windows.Gaming.Input in UWP instead yet it doesn't detect my wheel at all. I don't think I saw any other good windows one.
The WinRT documentation mentions about appxmanifest, did you edit it for your build?
I have not seen anything related to input in winrt and I use C#, when winrt is for c++. So no I didn't change anything in manifest since i havent seen any info relating to it
WinRT is not for C++, it’s implemented in C++ like how Unity Editor is implemented in C++.
The API you are trying to use is part of WinRT API.
i tried this, but where do you see the manifest mention?
also
The doct also says
A Windows application must have focus to receive input from an Xbox One Controller.
So that’s not good for you
You’ll see when you scroll down, not sure that’s about vib function or in general
Anyways, you might need lower level API or you might be out of luck
what do you mean by that? like anything specific ?
also I tried doing DirectInput it worked for me but it didnt work for my friend. Any reasons you can think of what can be blocking access to controller ? At the same time direct input found normal gamepad for my friend but it was blocked when out of focus, any indeas what can be blocking controller when out of focus that i am being blind about?
I think blocking when out of focus is just spec, Does it work for you?
it does , thats why i am so confused. his wheel doesnt even get detected, but his gamepad just doesnt work out of focus. My wheel and my gamepad work with and without focus
i have a way to check internet reachablity
how can i check slow internet connection
????
In Unity?
I tried rawinput through sharpDX. yet i cannot receive a single rawinput windows message while subscribing to everydevice type that sharpdx offers. It's like something is blocking it idk
why is the game window out of focus?
I want it to receive input while out of focus
i know, but why is the window out of focus
just help us understand what's actually going on
I just click other window so the main app is out of focus.
im not doing it through code
i undersatnd
o
is this a driving game?
why is it windowed?
just to confirm, the wheel works fine when the game is focused?
thats because the main focus of the window will be on other games. The app is supposed to run in the background gathering X axis then sending it to another application through websocket. I did web socket part and connection to antother app just the input im stuck at.
okay but why
what is going on in this application (in the general sense. not a specific executable, but application means "the thing you are trying to do")
what does it do
are you asking about the app gathering input or the app that's receiving input through websocket later
see
i'm asking about both apps
i'm asking about this whole thing
what is it?
however many apps there are
i have 8m
until i have to go
its a plugin for vtube studio.
okay
so what you're saying is, you're trying to connect a racing wheel to vtube studio?
Interacting through websocket is the only way they allow it i cannot run in inside the vtube studio itself
so yes but not directly
i never used vtube studio, and i only vaguely understand what it's for, but super succinctly - what is the idea? so let's say you could just directly connect the steering wheel
to vtube studio
what is it used for?
you know vtubers?, its for someone who is vtubing basically. Its just supposed to look good on streams while they are turning the wheel the avatar does also
I must say using unity for this really doesnt sound like a right tool.
this is ridiculous
why not remap the steering wheel to a mouse input?
there are a bajillion ways to do this
because they are playing racing games using the wheel ?
here you go
huh?
okay help me undestand
what is this for
i've asked almost 10 times
you should be able to express what htis is for
because it will help you engineer it
what more do you need to understand i feel like i said enough that anyone should already understand
its basically it
alright
that's the best we can do then
you can use UCR to achieve this
it's your best bet*
good luck out there
its not
when i remap axis it wont translate to the degree, you turn the wheel. It would be like a pressing a key giving max value
I think he wants to use the regular input in a racing game and at the same time send the input to vtube studio to control character there, like you had a youtuber playing game fullscreen and pip showing the tuber
yeah but UCR lets you create virtuawl output devices
as many as you want
the wheel can be mapped to (1) a virtual wheel and (2) a virtual input device supported by vtube studio
it supports axis to axis mapping
okay i gotta go ran out of time
there is no input device that is supported by vtube studio that has gradual axis like wheel does. They only have api to connect that you send the value itself
yes
its basically stream visual thingy
Hey im trying to create a multiplayer game with steam and managed to create function that creates a lobby now i want to invite friends i also found a solution for it, but if the friend accept the invite this here does not get triggered:
{
Debug.Log("Requested to join lobby");
SteamMatchmaking.JoinLobby(callback.m_steamIDLobby);
}```
Does anyone have an idea?
do you have a screenshot of your game?
just so i can understand what it is
i can make one, but why do you need it for my question?
it helps me understand how far along you are in this journey
in our class declaration we can do generic classes with a constraint on the type; lie MyClass<T> where T is IInterface. Is there a way to this for list declarations? IE, I want a List<ConcreteClass> to be passable as argument to a function that accepts <IInterface> (assuming, of course, that concrete class implements the interface. Can this be done?
Isn't that just List<T>?
Am I missing something about what you're asking?
I might be asking the wrong way
Or are you saying you have made T the interface type, not constraining it
not sure i full understand, so you want something that is List<IInterface> to be passible to a arg that accepts IInterface?
little confused since when you say MyClass<T> where T : IInterface that does not mean MyClass implements the interface just means a T arg used in the class must implement the interface
sorry yes, it means T implements the interface
https://learn.microsoft.com/en-us/dotnet/standard/generics/covariance-and-contravariance
You cannot assign an instance of List<Base> to a variable of type List<Derived> or vice versa
Edit: i believe i initially misread the question and this info isn't exactly applicable here, for some reason i thought the question was about making the List parameter the Interface type instead of just using literally List<T> as the parameter for the generic method and constraining that generic type for the parameter and method
my issue is that if the list is of type Interface, then I have to downcast things back into concrete classes
chances are i would just use linq to convert the list
like items.OfType<IInterface>().ToList()
which will return you a new list with every casted that was possible to cast
either way if you need a list of a certain type i would just make a list of that type
assuming you don't need to use any List<T> specific methods you could just use IEnumerable<IInterface> as the parameter instead
let me get back to my underlying issue: I'm trying to create a modal selection window: Select one of these X things - Select a card to add to your deck; select a trinket to add to your inventory, etc. What I want to do is make a new Selection Request - something like create a *new Selection<T>(List<T> options) * where T is constrained by needing to implement the interface. This allows me to do something like pass in a callback that can receive type T, which is nice. Actually this is what I have, that all works. But I want to put an event on that Selection class and be able to subscribe to it without knowing the type beforehand so that my UI can subscribe.
so I was hoping I could remove the generic declaration from the class and use the same Type constraint on a function that replaces the constructor.
if it was accepting just T you could do that
but not with List<T> for the reason @thin mesa posted a link for
I'm thinking there's just a different/better way to accomplish what I'm trying to do?
really just think i would not being has as much generics in this situation as you are
so while you can't actually assign a List<Derived> to a List<Base> if you are just constraining the type to a specific interface it should work for the method, but as i said you could alternatively use IEnumerable<T> as the parameter if you aren't adding/removing from the list and just looping over it
How should I approach this? I want to get selected object(s) back - what's the alternative to generics?
well if you really want to use this pattern, can simple rebuild the list with the right type
if you know all items implement the interface, just make a new list or IEnumerable with that interface type and manually populate it
for eg, "Select a Card to Add to your hand" - I want to be able to pipe in a List<Card> that is the options, and receive back a List<Card>. And I want to be able to reuse that for Items, Weapons, whatever type. Do I just need to come up with version for each conceivable <T> ?
for example this would work: https://dotnetfiddle.net/zXzryt
not sure what you want really can work, since with what you are saying it sounds like you are also wanting every item in the list be a different concret type, and being able to get that type back on return without casting again
no, any given list would be of a single concrete type
oooh that works? Excellent news.
nvm
you have to convert List<Concrete> to List<Interface> unfortunately
hmm
do you though
i think so
yo
i need help
my weapons trigger collider isnt identifying my enemy's collider
anyone?
@lapis summit does one of them have rigidbody? are layers/masks all good?
Yep i fixed it 🫢
neither had a rigidbody
Did you find a solution? I'm facing the issue that my bootstrap scene fails to switch to the main menu scene in my build.
The last logs I can see are also from Enlighten.
This is how the lobby currently looks
Hey! I was wondering, I have 3 ScriptableObjects
WeaponSO
UtilitySO
ConsumableSO
I want to pass them through as a parameter of a method, but I don't want to specify the type as I don't know what tipe it would be . Is this possible?
public void AssignScriptableObjectMethod(UnknowsScriptableObject unknownSO)
{
var scriptableObject = unknownSO; //<-- depeding on what is passed will chage to WeaponSO, UtilitySO, ConsumableSO
If(scriptableObject.name = "WeaponSO")
{
//do something
}
If(scriptableObject.name = "UtilitySO")
{
//do something
}
}
The better way to do this is:
Have them all derive from a common base class, or implement a common interface
Pass the base class or interface in as the parameter type
then just call a virtual method on it
I have something set up like that based on feedback last night, but I was hoping to try something different . Guess that will be the best way forward then
In this case you might have a common base class like:
public abstract class Item : ScriptableObejct {
public abstract void Use();
}```
And each subclass implements the "Use" method
and then in your function you just pass in an Item and call Use on it. No need for the if/else stuff
this is sort of the basics of polymorphism
Quick question about the job system.
For ScheduleParallel there is the innerBatchLoop. Does that basically do this in a thread
for (int i = jobIndex; i < jobIndex + innerBatchLoop; i++)
{
job.Execute(i);
}
instead of just
job.Execute(jobIndex);
You can imagine it like it creates n threads and runs each iteration of the loop in a separate thread
that's not quite true but it creates n executions and schedules them across the threadpool
Right, so instead of running a job once in a single thread, it will run it n times in a loop.
Oh sorry IDK why but my brain glazed over the whole inner batch loop thing you're asking about
so yeah I think your example is pretty accurate
I'm not sure if they are consecutive like that
but probably
Okay, cool. I was about to do exactly that haha
I think basically the whole job size n is split into t batches where t is the number of worker threads available
and each worker thread gets a loop like that
more or less
Yeah that seems right
Another jobs question. Do we have any idea what point it is better to have one larger job vs multiple smaller jobs?
Generally I think you want to split into multiple jobs only when you:
- need some intermediate result (in which case you split into a job before and after that result is created)
- The output of one set of calculations is required as input for another set (job depending on another job)
I am working on a mesh thing that can instance meshes and then run modifiers on them, but the instances meshes can create instances which can have modifiers and so on. So if I have one job per instance, than each of those instances also instance things which have their own jobs.... that is a lot of jobs potentially...
Or when you're just doing multiple completely independent things with no interdependencies, those should be two jobs
So I am trying to figure out if the instancing should just be a single job where each execution creates the mesh, instead of creates/sets part of the vertices/indexs
Is this how interfaces are meant to be utilised - by having a larger body iterate through them and perform separate functionality on those that have the interface?
I have known about interfaces and what they do for a while, but I never worked out what the intended purpose/use case was
I got a pretty nifty use out of it in my UI Manager, but I don't know if this is how I'm supposed to do it
The purpose on interfaces is to be able to treat a bunch of disparate objects the same without worrying what they actually are.
So, contrived example:
public Interface Item {
void Use();
}
public void UseAll(List<Item> items) {
foreach (Item i in items) {
i.Use();
}
}```
now each of those items could be a different thing like...
Oh, I get it
class Potion : Item {
public void Use() {
HealthManager.health += 50;
}
}``` for example
So the functionality could be extended with many different script types
but the code that calls Use() doesn't have to know or care what the thing actually is
It's basically a contract
Any class, no matter which one, that has signed the contract, aka inherited it, has to do what it says, aka implement the method needed
Hi, how can I make my "Debug" variable maintain it's current value instead of it defaulting to False when the Play button is clicked?
you'd have to save that variable on a serialized object
The Editor itself is not persistent
so for example making it a field on the BezierPath could do it
Or you'd have to save it in an asset (SO) somewhere. Like a BezierPathEditorSettings asset
Nice font, rocking that Eurostile/Square 721 BT
yes they use a lot of obscure words to say, "when using parallel yob, your Execute method implements the body of the loop you would ordinarily author if you were executing this serially." batchsize is a hint for how many of these inner loop executions should be assigned per thread
Ok cheers
one of the limitations of mesh generation afaik is that you are doing some function f(x..y..z) = f(x..y) U f(y..z) (i.e., something that can be parallelized, like generating a heightmap). then you want to turn the result of that function into a mesh, and you'd like the procedure that turns that data into a mesh to obey g(f(x..y..z)) = g(f(x..y)) U g(f(y..z)). which isn't possible in a general way. i believe this is what mesh shaders are for
It's the font used on the car badging of the car I want. I'm guessing you knew haha
does that make sense?
which car if i may ask haha
Honda s2000
I know a few different ways of doing this fairly efficiently depending on what/where interaction happens, are you generating the mesh itself in code, or is it stored as an asset/acquired file?
I am generating the whole mesh.
How 'baked' is the morph? Is it going to be changing per frame or so, or is it like a generate, morph, save kinda deal?
Both, it is a modeling thing
Hmm, Is your 'raw' data an abstraction fed into a mesh generator on change, or are you sort of keeping track of the polygon soup and applying deltas on change?
I regenerate it each time there is a change. No point in applying deltas.
I think I came up with a good solution where I just have a single job execution handle generating a whole instance. That will work best I think for how the job system handles things. And most instances will be a pretty small number of vertices. And with the way it is setup I can always schedule it to be one job per instance instead of it is a really high vertex count.
Good on you, thats the way, I would say handle it mesh-per-job by creating a static map of deform functions to apply and feed that into the job,
Pretty much what I was thinking
Not really sure how help static deform methods would be. I would still need to give it all the data and that would than require me to hard code in support to the generator for each deform type.
My plan is to just have each modifier/deformer be a job that is scheduled just like the generation.
How do systems like Siri understand what you're asking, or abstract what you're saying to provide answers?
Because everyone words stuff differently
there's like 100 ways to ask how someone is doing, you have to figure there's some sort of abstraction?
There's probably a collection of keywords that when combined in certain ways trigger a certain response. It's not ideal, so Siri wouldn't always understand what you're saying.
Siri especially is not ideal, and gets it wrong very often, lol. Its a lot of heuristic guessing essentially, machine learning has brought it way farther up then even like 5 years ago;
At least when I was contracting on Cortana Connected Home (RIP) at MS, there device model was a fairly simple categorizer that would attempt to identify proper nouns (device names) then actions (verbs), it would then send that as a data block to the glue systems we were working on that would act as middle-men between the MSGraph and whatever 3rd party there was
It tries to determine intent from the context. Siri isn't really as complex as most AIs these days though, most things just take you to google... Imho
This is a pretty good intro to intents
https://cloud.ibm.com/docs/assistant?topic=assistant-intents
Find documentation, API & SDK references, tutorials, FAQs, and more resources for IBM Cloud products and services.
Hmm that's interesting
Although modern AI doesn't require this kind of spoonfeeding as much
I was considering adding some sort of OpenAI functionality into my game, but I'm not sure if they have a suitable SDK/API to use
A lot of mobile devices have built in 'neural cores' or whatever that have accelerated on-device processing, there are a few games that train a model offline, then use the devices onboard network to run the output model. Desktops and consoles can just use GPU as the processing, but the concept remains the same
Right I know I can make my own models and train them, but I'm also not an AI master, I just understand the basics of how the structure is and how they kinda learn
that's why I have no business writing some complex AI 😄
I thought it would be cool to have some sort of voice input which deciphers to text (which I can find open source I'm sure) and then the tricky part is understanding what the user is saying
and then from there the AI can respond and I can use TTS to make it talk real-time in the game
but that's an extremely complex subject
The problem with the natural conversations problem is that english, and any modern language really, is messy. If you provide a subset of stricter grammar structures, a reduced abstraction and synonym vocabulary, and a bit of directional nudge with bias inputs, the conversational potential of AI goes way up
siri is an NLP based model. for every possible task it can do, its developers author every pattern of question they can think of that corresponds to that task
Siri is to ChatGPT what Scribblenauts is to DALL-E
It’s been a while. I think I tracked it down to memory management bug in fishnet. Which is a third party network solution. It was using a span and direct reading from memory it shouldn’t have. This has been fixed in their solution after I found it.
👀 thanks for giving an update. I'm also using Fishnet. I need to try this right now!
Question: I have a high poly character (20k vertices) and want to detect mouse click/hover on him. How can I make it accurate without being too costly in resources? Knowing that I'll have several characters on screen, sometimes with colliding animation like hugging each other.
- Adding a box collider wouldn't be accurate enough depending on the animation, if it even update with animation. Plus if characters are colliding with each other, which collider takes priority?
- Mesh collider would be accurate but isn't 20k vertices a lot for such a collider? For each character?
I'm using raycast on the character list to check collision with mouse at the moment. Dunno if it's the most efficient way either.
Any help welcomed ❤️
20k is ludicrous even for a high poly char, bake some of that fat to textures instead. use primitive colliders for anything that moves, unless you can give a really good reason for why players would pay attention to 100% precision
Combining primitive colliders is almost always better than mesh colliders
Don’t think your character as single collision and instead consider having collider per bigger bone (and possibly joints)
Got it, thanks a lot
Let's say I'm executing an IJobParallelFor. I want to perform graph algorithms like Depth First Search in each execution. Therefore I want each execution to have its own Stack or Queue data structure to use freely.
How do I do this? Can native collections be allocated within jobs on a temporary basis? I.e. can I create a new native queue inside the job (with the TempJob allocator)?
DOTween question.
How to properly change a gameobject's parent while it is performing a dotween animation?
Because if I do it, the animation just stops and the object teleports to 0,0,0 coordinates (setparent's keep world position is set to true so it shouldn't do this).
why not re parent after the animation is done?
the problem is that it has to be parented during the animation, and if it does then it teleports to 0 0 0 and stops animating. so re parenting something won't fix anything
can you show the code
it's in different scripts but it's just this:
thing.DOMove(newposition, 1f);
and for example 0.5 seconds later another script can call this: thing.SetParent(newparent, true);
and as soon as the setparent is called, the object teleports to the 0 0 0 coordinates and the animation it was doing stops completely
You can, and I believe you should use Allocator.Temp inside jobs. At least, that's what I've seen in Unity's jobs, like here:
https://github.com/Unity-Technologies/Graphics/blob/master/Packages/com.unity.render-pipelines.universal/Runtime/Tiling/RadixSortJob.cs
https://github.com/Unity-Technologies/Graphics/blob/master/Packages/com.unity.render-pipelines.universal/Runtime/Tiling/TileRangeExpansionJob.cs
Ok cool. Do you know what the difference between Temp and TempJob is?
oh also thanks for the examples I almost forgot I need to call Dispose() on them 😱
Temp is the fastest, but also can't live long and can't allocate a huge amount. TempJob is next fastest and can live for up to 4 frames.
This articles goes over the differences in detail
https://www.jacksondunstan.com/articles/5406
JacksonDunstan.com covers game programming
SO if I'm creating and executing and Complete()ing the job in a single frame, Temp should be good
Yep, and I think you should always use Temp if you know it's going to be disposed of quickly.
Although now that I think of it I might actually be able to get away with running these jobs for at least Time.fixedDeltaTime which may actually span multiple frames... 🤔 I'll tackle that after it's working
Changing parenting during an animation is a flawed idea in the first place. DoTween is not designed for that case.
Hi! So I was trying to draw a ray in unity but it didn’t work. I am doing it in the update() method so every frame and I am using the DrawRay, I tried multiple configurations of it, but that’s what I am currently using now:
Debug.DrawRay(transform.position, mousePos-transform.position, Color.green)
where mousePos is my mouse position.
What am I doing wrong?
I can shoot a ray with the camera, from the mouse position successfully like that:
ray=camera.ScreenPointToRay(Input.mousePosition)
But I can’t draw it.
I also apparently cannot do Debug.DrawRay(ray) and use the ray I am already casting from camera so no variables I guess
mousePos is screen point as you know .. so it does not make sense to subtract world position
What ray are you trying to draw
Also make sure your gizmo is turned on
gizmo?
I am just trying to draw a ray from my mouse cursor
To experiment
Well I did convert the mousePos to a world point but it didn’t work either
What is that gizmo?
The line will be drawn in the Scene view of the editor. If gizmo drawing is enabled in the game view, the line will also be drawn there.
https://docs.unity3d.com/ScriptReference/Debug.DrawRay.html
hi, I got another problem and I'm here to find solution. I need to make distance airblast check, (projectile is very fast). And check when is projectile in-front (not left / right side especially mid screen) of player and return true / false. Is it possible to make?
raycast transform.forward, if it hit nothing you can intantiate projectile at end, if it hit wall you can use vector3.reflect for ricochet
if in-front as in "inside cone" is fine, use Vector3.Dot
How can I make a method run every time a new scene starts
I have tried onEnable in the past
but it is not called at the beginning of a new scene for objects that persist across multiple scenes
does anyone have experience in integrating python code to unity?
I want to use some ML models implemented on python in my app, how can I do so?
@lyric dragon Have you tried the Python for Unity preview package? They have an out-of-process API
could you please send me the link to the package you're mentioning?
A quick Google search will yield you a link to the package
But since you asked nicely lol https://docs.unity3d.com/Packages/com.unity.scripting.python@2.0/manual/index.html
Thanks a lot hahah))
I really appreciate your help!))
Yeah, I remember checking that link too, the documentation says that it doesn't work with python3, but the packages I want to use require python3 :((
Anyways, thanks for the help!
Guys, I still need help with python
but procedural geometry nodes accept it
*procedural from blender
and unity reads alembic pretty well
rewrite the packages from scratch in c#?
wow, bro, that would take tons of time, I will have to reimplement the whole pytorch, numpy and train the models on my machine hahah
did you try ml-agents
I assumed to post this doubt here since the advanced code users will have a more keen eye to spot what might be going on here
This code is open source and im trying to apply it in apersonal project, but it gives me a CS1022 error and i cant seem to spot what is wrong with this thing
(mind you it worked fine with no errors in its original project)
Hopefully someone can lend some help with this, thankful nonetheless.
@spare wharf you fucked up brackets
pretty sure someone in #💻┃code-beginner would've helped you too
just copypaste script again without losing brackets lol
although it's not that hard to fix
It has been directly imported
is it really
it would be fine if it was inside namespace
i'm not gonna count the rest of them, that last bracket needs to be either before class or removed entirely
Ill try to fix it and give an update , thanks for the answer
no need for the update, you can skip straight to sitting in the corner of shame
is there a way to force unlock the save file path ? by default unity file savepath can only be application.datapath or persistentdp
i want to save the file to anywhere i want
never heard about it, let me check that out.
Thanks for the directions!
Who said that?
There is nothing blocking you from writing where you have permission
It depends on the platform, but you'd usually have access to any path that is not used by the system, like Program files, System32 etc...
I guess ml agents does not support python for now...
How much python integration do you need ? I have a old answer here that might be of help https://gamedev.stackexchange.com/questions/123526/a-python-script-controlling-a-unity-game/123545#123545
How do I get the json string of a Unity scene file, cause I'm trying to parse it to get the sepcific values from keys
string[] _names = new string[6] { "Sam", "Tim", "Jonas", "ME", "YOU", "US" };
for (int i = 12; i >= _names.Length; i--)
{
Console.WriteLine(_names[i]);
}
can someone tell me why this forLoop can be wrong
i am starting from 12, decrementing till 6
#💻┃code-beginner
pretty sure you broke a rule by asking it in 3 channels at the same time
Hello Is there any option in Unity
Hi everyone, I have a Git question.
Since a few days ago there is a scene which is always shown as having changes, even if I revert any changes with Unity closed.
It's making it impossible to do rebase because you can't have local changes when rebasing.
Is my Git VCS corrupted or could this be caused by something else?
_names[i] will throw an error when i >5
ml agents specifically supports python
you should start with a tutorial from ml-agents, and get help for it in #💻┃code-beginner !
I mean this isn't a git problem it's a Unity problem. Unity is changing the file for whatever reason. There have been lots of scene file instability like this for years in Unity
Git is doing exactly what it's supposed to do - keep track of file changes
Also helps to not store scenes as binary
Yea but the file keeps 'changing' even after I shut down Unity :p
I need to look into that, thanks. I though I had already set everything to serialize to Unity's jsonish file format but I must have missed something.
Would at least give some insight on what's changing
you say jsonish...
it's yaml
i think you are in some jeopardy
are you working iwth other people, or is this only your work?
@cerulean scaffold Have you tried fresh clone?
(I haven’t yet encountered problems like this with git, but with svn just taking fresh checkout and copying modified files will solve all local problems, even if it’s something even ”hard reset” svn commands can’t solve)
I am trying to catch when the admob finishes initializing. What should i put inside the initialize function?
MobileAds.Initialize(InitializationStatus => { });
it says it requires "Action<InitializationStatus> initCompleteAction" in the function info
does anyone here have experience with asset labels in unity packages?
#💻┃unity-talk message
what do the docs say about InitializationStatus?
i was unable to find any docs for it
this is the class definition:
{
public class InitializationStatus
{
public AdapterStatus getAdapterStatusForClassName(string className);
public Dictionary<string, AdapterStatus> getAdapterStatusMap();
}
}```
Only my own work.
Good idea, I'll try that tomorrow if I can't resolve the problem.
This project had corrupting twice on me already, so yea maybe 😅
Real quick question, anyone know if WaitForSecondsRealtime is frame dependent? I.e., would it run correctly on an extremely laggy pc?
Are you doing binary serialization?
Your scene file does not seem like YAML format
Every yield instruction suffers from at least a one frame error.
It will be called after given seconds but does not guaranteed to be called exact moment
It will continue on the first frame after the amount of time has passed
so if you wait for 1 second you'll actually get something like 1.01 seconds
and that error is up to the duration of a whole frame
I see, makes sense, thank you both
Yea, but the scene is from a unitypacke which I imported which is still using binary.
Is that intended? Text serialization should be used for version control
totally joking lol. if i come across anything i'll ping you
are you using built in render pipeline, and assets like microsplat or amplify shader editor?
you can ask jason to fix it for you
Im using Microsplat with HDRP
I'm using text serialization but the scene wasn't converted to yaml
that's right
yeah ask jason
he'll help
in his disceurd
either way it's not such a big deal, either the file is changing 'by itself' or git is corrupted. I'll fix the problem tomorrow.
Even in force text mode? I would save it again to reserialize
I do think that's part of issue 🤔
Is anyone here experienced with spherical harmonics? I need to extract the brightness at a given point
hmm...
but sometimes it's necessary, there are multiple cases where you would want an object to change its parent. and often these objects might be ones that are moving around while the parent-changing happens. is there a way to do this then?
you can use things like parent constraint, aim constraint and position constraint to make animatable effects like these
the animation rigging package has good support for this stuff from the point of view of someone with CG / VFX experience
oh im using DOTween, does that have constraints?
the setparent function has an override that says "world position stays" and setting it to true doesn't make it stay for some reason when the object is currently in the process of moving via DOTween
it goes to 0,0,0 coordinates and stops animating
what is the idea
like what is the effect
what are you trying to animate
for example "i am trying to animate a hand picking up an object in a 3d FPS game"
"i want it to look natural regardless of the position of the hand and object"
UI objects are moving. setting parent is how i change ui object sorting order. so i want an object to sort differently while its moving
an item that moves from the game into the inventory
its parent must be set to the inventory's gameobject
okay
finally
thank you
so you don't have to do anything complex to achieve this.
here is an example
IEnumerator TakeToInventory(
RectTransform targetObject,
RectTransform inventorySlot,
RectTransform topmostLayer,
float durationSeconds=1f) {
// bring it to the "top" layer
// this should be an empty rect transform game object at the
// topmost hierarchy (meaning bottommost in the hiearchy view) with anchors
// configure to fill the screen with no margins
targetObject.SetParent(topmostLayer);
yield return targetObject.DOMove(inventorySlot.position, durationSeconds);
targetObject.SetParent(inventorySlot.parent);
}
@serene pawn does this make sense?
so don't change it mid animation. if you need to do that, you know, break it up into two tweens. it seems traightforward to me
oh i forgot to mention that the item is moving around in the game, even when the time comes for it to need to go into the inventory it can be in the process of currently moving. your example is basically how im doing it right now, the first setparent call is the one that teleports my object to 0,0,0
the first setparent call is the one that teleports my object to 0,0,0
it does not do that unless you set worldPositionStays to false
which why would you do that
i don't even touch world position stays
I dont touch it either, but it goes to 0,0,0.
it can be in the process of currently moving
then you have to duplicate it / create a special object you use just to act as the UI-only duplicate
so
setparenting while a dotween is happening does that apparently. and i dont want to recreate my entire system from the ground up to fix this one bug
alright
i think you'll figure it out
but i didn't figure it out, that's why im here
there must be a way to avoid it teleporting to 0,0,0
it sounds like you know what the solution is, but
nd i dont want to recreate my entire system from the ground up to fix this one bug
is interfering with your ability to code it
that's a bug
i haven't seen your code
it's a bug in your code
it's in different scripts but it's just this:
thing.DOMove(newposition, 1f);
and for example 0.5 seconds later another script can call this: thing.SetParent(newparent, true);
and as soon as the setparent is called, the object teleports to the 0 0 0 coordinates and the animation it was doing stops completely
and for example 0.5 seconds later another script can call this: thing.SetParent(newparent, true);
well, that's wrong
you can't do that
it's buggy
what doy ou want?
i showed you an approach that works
I removed the setparent call and it no longer teleports. but then i lose the setparent functionality which is essential.
you will have to create a special ui only duplicate of this object, that is already on this topmost layer
okay
well like i said you'll figure it out. i am repeating myself now
for what you want to do, the approach is clear
i'm not 100% sure what you mean by "it's still moving"
i think you are trying to do something kind of complex
duplicating the object makes things worse i think, since how do i give it the same position as the original and having it continue the original's animation from the point it left off?
it sounds like you are trying to take a thing that has some sort of velocity and have it arc into an inventory slot
is that the effect you want?
it just isn't clear yet what you want to do
forget about the approach you currently have
dont' talk about it anymore
just answer my questions
yeah, except it needs to be sent to the topmost layer without having its movement stop
so give me the full picture of what you actually want
stop talking about topmost layer and movement and whatever
i feel like i could have said anything and you would say yes. so what is it?
what's actually happening in the game that you want to animate?
🥺
@serene pawn Are you trying to do something like subnautica?
don't get distracted by the beautiful celebrities. focus on my question
i dont know what part of subnautica you mean but heres what should happen.
item is moving around in the game, player clicks on it, item gets sent to the topmost layer while moving, it must keep moving to where it was originally going to move and like 1 second later it starts flying into the inventory.
what actually happens: item is moving around in the game, player clicks on it, item gets sent to the topmost layer and teleports to 0,0,0 and stays still, and 1 second later it flies into the inventory
no
i hope that clears it up
you're talking about your implementation again
what is the game?
last chance
what are you doing?
grabbing dishes of sushi off a moving sushi conveyor belt?
and it has to look like it flies off the conveyor belt into an inventory slot?
don't talk about your bug anymore
please
i'm begging you
the bug is because the implementation is wrong and has to be approached a different way
you don't comprehend well enough to fix it
stardew valley but you have to click on items that are rolling on the ground and when you click them they start glowing but keep moving and then after 1 second they fly into your inventory..
so don't worry about it anymore
OKAY
thank you
what's rolling on the ground?
just give a specific concrete example
Calm down, doctor. John, you've been falling into the trap that software people get into where they describe the implementation before they describe what they are actually trying to accomplish. What is the goal of this whole routine
there we go
just so it's super concrete
cabbages
dotween
okay
the animations are great and everything but the problem is the teleporting to 0,0,0 coordinates when i do the setparent
please enough with the 0,0,0
it's over
you're not going to worry about that problem anymore
last question - you click the cabbage, it's still moving with its current velocity right?
so after a "short period of time", it abruptly should move into your inventory? the effect would be the same if it were stationary
yeah it must be abrupt
okay
class CabbageLike : MonoBehaviour {
bool interactable { get { ... } set { ... } }
void Glow() { ... animate glowing ... }
void StopGlow();
}
IEnumerator TakeToInventory(
RectTransform targetObject,
RectTransform inventorySlot,
RectTransform topmostLayer,
float delay=1f,
float durationSeconds=1f) {
var cabbage = targetObject.GetComponent<CabbageLike>();
cabbage.Glow();
yield return new WaitForSeconds(delay);
cabbage.interactable = false;
// kill all pre-existing animations
cabbage.StopGlow();
targetObject.DOKill();
// bring it to the "top" layer
// this should be an empty rect transform game object at the
// topmost hierarchy (meaning bottommost in the hiearchy view) with anchors
// configure to fill the screen with no margins
targetObject.SetParent(topmostLayer);
yield return targetObject.DOMove(inventorySlot.position, durationSeconds);
// it is now in your inventory
targetObject.SetParent(inventorySlot.parent);
}
@serene pawn
that's it
the thing it sounds like you were missing was to cancel the previous animations
all this stuff about your bug and layers and whatever...
it doesn't help me write a correct example for you
does that make sense?
my feedback is: always say what it is that you are doing
this is just psuedocode, you can't yield return on a tween directly
one problem, it needs to go to the topmost layer the instant its clicked though, and 1 second later it should go to the inventory parent
why?
what is the effect?
well my inventory doesnt have a list to keep track of objects, i do that by just counting everything that's a child of the inventory gameobject as being in the inventory. and objects have to count as in the inventory immediately. so im also counting the topmost layer as being in the inventory, this way there will be no bugs where if you are quick enough you can go past the inventory limit or something and break the game
okay
so surely you see
what a problem that is
i mean obviously you have to keep the list of inventory objects separately from the hierarchy, which is meant for rendering
but everything else has no issues, its just the fact that i need to set parent while its moving. surely i dont have to redesign the entire inventory system from the ground up for this
this is the issue
why are you saying everything else has no issues?
why lie
to yourself and your ancestors
why besmirch them
i am being facetious - i am trying to add some color to how ridiculous this is
you do indeed need to redesign the inventory system
so here's what my question started off as. how to setparent while a dotween is running without it teleporting to 0,0,0?
you're trading a good inventory system for crazy code elsewhere
you sitll have the same amount of new code
do you see that?
what do you mean? this is the only thing i need to fix
observe that the answer to the qeustion, "what is the effect?" was "there is no effect"
it depends. do you aspire to be a better programmer?
you can spend your time writing a workaround for your bad inventory system, which will have another bug later
or you can spend your time on making a better inventory system
either way you must write new code. one option is worthless code, and the other option is good code
do you see?
@serene pawn it's good that you went and asked about this though
you must see
it'll break my entire game if i wanted to recreate this system though. i cant change it. i dont think it will have another bug later, it's been working perfectly except for this one thing. there MUST be a way to change parent without having it teleport to zero coordinates, there has to be
and redesigning a system entirely because of one small bug will definitely introduce many new bugs
okay well maybe create a ghost object
then you can move it into the inventory slot later
how do i make the ghost object continue the original object's dotween from the exact point it left off though? or do you mean something else?
i suppose you just read its position
the original object
and you create a new tween with the right amount of time remaining
hope that helps
well if i knew how much time it had remaining then after the setparent i could just teleport it back and start a new tween on the same object, problem is i dont think there's a way to know how much it had left nor what its position was. unless i make a database where i store timers and positions and stuff for each object, seems like way too overkill of a solution though
okay, so. What is the best way to go about detecting light levels for a stealth mechanic? I'm trying to use light probes and sphere harmonics, but the equation I got for extracting lightness from it is a bit of a black box and I don't totally understand it. What if I pointed a low resolution camera at the player and averaged the light value I get from there?
manually placing light zones (trigger colliders) that have nothing to do with visible lighting (but can be illustrated by it)
That would work in interior, but what about with dynamic lights?
uuuhhhh well. the sun does move. so yeah
yeah what?
is it critical to your game that you have moving shadows and that you have a lot of them just before/after dark?
i think overall its very difficult to dynamically detect whether a certain agent is fully shadowed relative to a dynamic light source... it may be possible to do for a single agent with a utility cam & shader but for N to N visibility checks you can't realistically calculate that to any degree of accuracy, not even with probes
there's only one sun though right? So it'd be easy to do a few raycasts from your sun towards your player for that one special case
also considering that you'd have to check for silhouetting of an agent against a lit background
but you could generate/bake shadow volumes for certain times of day and cast them as convex mesh colliders
or just assume that when an agent stands on a shadowed surface they are entirely "in shadow"
thats how you'd do it in a 2D top-down game
I would say light probes would be the best option in terms of performance and reliability, but that really only works if your light is static and baked. Not unless you're using Realtime Global Illumination, which I believe updates light probes in real time.
boy this is tricky
real time light probes are extremely expensive if any amount of precision is required
basically your gameplay has to be cleverly designed around the limitations/issues of how shadows are calculated
AAA producer would just tell you to do it with custom authored widgets that a level designer can place and art direct, then automate once the manual system works
tbh, if you have an engine that uses shadow volumes (instead of shadow maps), it would actually be much simpler
so maybe try to get an id tech license 😉
The question is whether you're going to do this on the CPU side or the GPU side. The ideas Anikki and PraetorBlue have suggested have all been CPU side. The idea you suggested, rendering a low res camera of the player, is more GPU side. Another thing you could do is render a custom shader that does all the same lighting calculations a pixel would do, but just writes it to a 1x1 texture. That should be faster than rendering an actual camera of the actual player.
But doing anything on the GPU side means you will eventually have to copy it over to the CPU, which can take a bit of time, a few frames of delay.
i think this isn't necessarily a CPU vs GPU issue, any solution would involve both
and mind that extra cameras in SRPs are expensive
Here's an idea to tackle both how much of the player is visible and how much of the player is in light:
- Raycast to make sure the player is potentially visible (in an FOV and not completely obscured by an obstacle: I've already done this)
- Have a low res (32x or 64x) camera pointed at the player and render the whole scene to a texture, and then render a texture with only the player layer not culled (perhaps also somehow fit the fov around the player?)
- compare which pixels are the same between the full scene and the player to get how much of the player is obscured by something (Can't stencil buffers also do this?)
- Make a mask of the overlap between the player-only texture and the full texture, and then average the albedo light value of everything within that mask, giving us our perceived brightness of the player
- Could also figure out contrast?
Sampling light probes, checking collision triggers, raycasting to the sun, all of these don't require the GPU.
i mean a proper solution would probably involve GPU und CPU components
for how many agents do you want to do that?
imo doing 3 raycasts to the sun for each agent (feet, torso, head) is probably the easiest solution that gives plausible results if the origins are placed well, should also be quite fast if you cull raycasts based on player proximity
The resolution of the additional cameras wouldn't be the main overhead. You probably wouldn't see much difference in performance between 1x, 32x and 64x. The main overhead would be everything that happens before the GPU takes over; the culling and draw calls. If you only needed to render the player, then it's super cheap. But figuring out what part of the environment also needs to be included is more expensive.
It's just the player's layer, and then everything. You mean occlusion culling?
uuuhhhh hm. That is a good question. The only agents running this would be the ones who can actively see you in their cone of vision and dont have an obstacle between you and it, so probably a dozen maximum?
as a strategy, i'd try the raycast to the sun method, make sure its not good enough before diving any deeper into camera based options
after all, stochastic path/raytracing is the best of all solutions
What about interiors, where there's no sun?
depends on the light source
you can cast to the closest point source or make colliders that define volumetric sources and cast towards those
@jovial totem Would using CullingResults.visibleLights help?
Spherical harmonics has been working alright, but the output's space confuses me. I'm tryhing to get the value, but these are all magic numbers I got from reddit. Does anyone know how to make sense of the data that comes out of it?
LightProbes.GetInterpolatedProbe(point, null, out SphericalHarmonicsL2 harmonics); //Get light for point
return
((0.2989f * harmonics[0, 0]) + (0.5870f * harmonics[1, 0]) + (0.1140f * harmonics[2, 0]))
.Do(r => r / 0.3f)
.Do(r => math.clamp(r, 0, 1));
(Do is basically just the |> from functional languages, because my brain works better that way.)
That... is an idea, yes
You don't necessarily need to calculate spherical harmonics or use realtime probes everywhere. Shooting a raycast to all visible lights to detect occlusion, then use the inverse square law and add the visible lights together. Indirect light is the problem then, but from what I understand visibleLights includes light sources that are obstructed (and would fail the raycast).
You can then sample the part of the screen that your player model is in and detect any lights that affect that area (see VisibleLight.screenRect)
But isn't the point to get the brightness of the player, from the point of view of the enemy? So if the light is behind the player and backlighting them, that's not as bright as if the light was in front of the player, between the player and the enemy.
I suppose you can apply N dot L as part of the inverse square attenuation calculation to account for that.
I also have to ask if indirect lighting actually matters in this case.
because the AI perception doesn't have to be 100% true-to-life, the camera thing was just the only thing I could come up with
how can I get a CullingResults from a monobehaviour? The documentation only shows how to get it in a render pipeline script.
Yeah you can get them from the CustomPassContext.cullingResults
yes
There is an optimization on that coming soon (now in alpha) that doesn't sort but yeah FindObjectsOfType is pretty expensive
wait... oh, I'm confused. How am I to use a custom pass to get visible lights? Can I get it from just regular passes?
are they less expensive in built in?
i've noticed that e.g. realtime reflection probes are much faster in built in
i don't understand why - as long as i do camera.render in late update or earlier, can't unity batch the CPU side of stuff a lot better?
I'm using URP myself
I am not sure whether you can time that correctly or if there's even an interface for that. With a custom pass you are more or less guaranteed to have the timing consistent and have frame-specific information on the visible lights etc.
Custom passes are available in URP as well afaik, I was assuming you're using HDRP but I guess I was wrong 😄
HDRP is using its own reflection probe code that is separate from URP and Built-In
It's fancier 🙂
is it just hdrp that is unusually slow?
i actually want to do some innovation with multi-camera unity, especially at the level of performance of single pass stereo
in other words, i would love to disable culling and render all cameras "simultaneously", if it would allow camera N + 1 to reuse all the non-view-dependent stuff from camera N
You are probably better off forking URP/HDRP and writing your own passes or writing an RP yourself if you want that flexibility