#archived-dots
1 messages ยท Page 61 of 1
for example, I cannot add to NativeParallelHashSet.ParallelWriter without exceeding the capacity and throwing an exception!
I'v been seeing a lot of hiring companies use ECS, but they use Entitas mostly as I remember
I want to add and abort if its full
I can do it with lists, but not with hashsets mmm
do you really need parallel?
Singlecore job usually does better job with relatively small amounts of data
i have an extension for this already in my library
that that doesn't solve your problem
yeah was about to say this
how to I get a singleton of managed component now?
yeah exactly
life tip is to not do it in parallel
SystemAPI.ManagedAPI.GetSingleton<>()
yes
I didn't know ๐
there's a whole managedapi
mmm then I have to use my own interlocked int to figure out the length of the queue
its a simple pattern: parallel check ents, select ents that need processing, put them in a queue, process them (but limit the queue to N so we dont have FPS spikes)
thanks! in previous pre release version there was no distinction over that
swear people don't read the changelog
(you're excused Krajca since you're just coming back)
but ManagedAPI was half the pre.15 changelog
there wasn't much else added
nah changelog is worth reading when you actively working on it so you know what and where it changes
...
apparently I was aware of incoming change
snippet from another script:
//TODO use SystemAPI.ManagedAPI when it will be available```
๐
@rotund token sir, have you worked on localization for UI?
I'm trying to figure out a proper pattern, without too much boilerplate
I have only been working with kind of existing framework that worked like Translate.Key("PhraseNumberX");
but I doubt it's a good one
(btw this comes natively in 2023 so my implementation is basic as i dont want ot invest too much time in it)
oh mines like automatic
do addressables work with ECS?
wait what?
i based im implementation off this
Some unity dev in UI TOolkit channel told me, that they are working on Binding first
and then on Localization
unity localization localization support was marked as coming in 2023 to ui toolkit
We do have a prototype based on a new bindings feature for UI Toolkit. Unfortunately, it will require Unity 2023 and above as that's the version the feature should land in.
Hi. I found that Unity created localization system for classic UGUI, https://docs.unity3d.com/Packages/com.unity.localization@0.6/manual/index.html
So...
earlier this week
The work is still ongoing with an estimate of landing during the 2023 cycle. We are currently waiting for the UI Toolkit binding improvements to land, once that is completed then we need to apply some changes to the package.
anyway yeah my implementation works like above link
i need to run to gym
but this is my script
that exists in each of my UISystemBase
(i havent looked at this in like 2 months so might be a bit dated)
no but content management is a thing now which should be addressables for dots: https://docs.unity3d.com/Packages/com.unity.entities@1.0/manual/content-management.html - haven't used it myself
they recently said they'll provide a demo with full 1.0 release
from my quick look at it
you can do a lot of interesting stuff
i want to spend a week adding modding support to my game via this and burst loading
just need to find the time
bump
enzi replied to you
oh wow don't know how I missed that
๐ฅฒ If I understand correctly, it's only for Unity engine objects and GameObject scene. I still can't use it to load prefab entity on demand.
because Entity is just a pointer
loading 1 entity Prefab on demand = loading 1 subscene with that entity
which is already doable and very simple
๐คBut I dun really want to tightly couple entity prefab with subscene. I want load entity prefab on demand just like how game object addressables does
you're out of luck then, can't use OOP with ECS after all
๐ What I trying to say is since 1.0 introduce baking, you are forced to bake all entities and prefab entities into subscene which also means there's no path for load by demand. Previously before 1.0, I believe most of the people using runtime conversation to achieve this
I don't think thats really true
It had been known for like 1.5+ years pre 1.0 that runtime conversion was on the way out
And many experienced users had already transitioned
Many grudgingly ๐
๐ฅฒ Not really like the current design that baked entity and entity prefab will never escape from subscene. For the use case that need to load certain entity and entity prefab on demand, it's really hard to achieve it. Currently I just dun care and bake and load all of them as one single subscene but I believe it's really bad for loading time and memory
This I agree with it
What is exact use case anyway?
i also don't have an answer to loading prefabs on demand. seems we have to load the full subscene even when we only want one prefab from the subscene. best would be to introduce a subscene for each prefab but that sounds annoying
Let's say ur game has 100+ hero character to choose from and only pick 8 heroes then u need load by demand to solve it
I'd say load all and them unload unused, but that's also non trivial in a sense
I'm not surw how graphics hangles unloading subcene, if you removed scene component from some of it's entities
I want to say: construct player by hand, but it's a sad solution
i think you need a subscene for each model then
But potentially, you could load subscene, then instantiate what you need, remove scene comps from it, unload subcene, register all graphics manually after
maybe that can be automated in the build pipeline of content management
yeah or what issue said
i think that's better
yeah that seems most reasonable
but still it seems that unity didn't provide a solution for real world case
yeah for world streaming it seems okay though
We have critical bugs out here, better fix them first, before going into such niche cases
oh they updated https://github.com/Unity-Technologies/Megacity-Sample
does it still crash as much? haven't checked since the initial release
Im talking about material ovverides
Hey everyone. Are Blob Assets still a thing? They are absent from the v1.0 docs.
They are a thing
hm, there was a discussion some time ago about getting euler angles from quaternions in burst. not sure if there was any resolution but i kind of need it now. anyone has an idea?
Ok. I've found the doc. Seems like I had a connection issue or something. The search didn't yield any results. Now it does.
I think all you need to do is multiply vector up, right and forward by this quaternion?
checked it and I was wrong. here is a solution: https://forum.unity.com/threads/is-there-a-conversion-method-from-quaternion-to-euler.624007/
nice thanks
dissapointed it's not included in quaternion. i fully get the problems but to pretend there's no use case is flat out wrong ๐
copy pasted a lot of SO solutions and none worked. hope those ones are better
Physics seems to have most missing math function
it's suggested here simple multiplication by vector as in my answer erlier should also work
yeah, total goldmine ๐
nice, bit unexpected that it returns radians but works great
Sorry was at gym. I think the solution is to use weak asset references to the assets, model texture, and load them on demand via content delivery
multiplication by vector?
So you have all your entity prefabs in a single subscene without assets
no a toEuler method in math.cs in Unity.Physics
(this is all in my library as always =D)
can you eleborate on this? i don't think i get the part about weak asset refs
You don't reference the asset directly
You store a guid or however you want to link it
And load (and unload) asset on demand when needed
how does that work with baking then?
I already use weak asset for my entity prefabs
oh i have no doubt that it works. i just don't understand how and why. ๐ some kind of missing link
All my prefabs are stored in an array in a single subscene and I only store the index on other entities (I have a whole complex system around this inspired by eizenhorn)
like where is the entity data saved then
But you can probably see the issue here
Every asset is therefore also stored in this subscene
right, i remember talking about this with you ^^
If u load this subscene I load all assets tied to any prefab
This is basically Lim's issue
wait i'm confused now ๐ are you loading the references/guids or the assets?
Now funny enough, hybrid entities don't have this issue
The subscene is always loaded
Entities in other subscenes reference prefabs by a key
So other subscenes don't also make a copy of these assets
Anyway, need a way to decouple assets from a subscene
I could use addressable or content management
My first pass would probably be to bake 1 prefab per subscene for content delivery
that was also my first idea ^^
Addressable has an option to put everything in same bundle but build them into seperate bundles
This would make work flow much easier
If I didn't need to make 1555 different physical subscenes
But I haven't looked at it and possible tooling enough to know what's possible
yeah that must be handled by the build pipeline
there's an example at the bottom: https://docs.unity3d.com/Packages/com.unity.entities@1.0/manual/content-management.html i think that should be possible
Yeah that sample doesn't really do what I want atm
For the most part in just kind is putting this problem to the side for now while the tooling is improved
It's kind of important to build a project upon
But I think it you make your instantiation and destruction pipelined flexible enough you should be able to swap it out later
๐ค
true, it just looks complex enough from the method calls that we would be able to build a proper pipeline
I remember years of mess work project had adding addressables at a later date though
you'd have to screw something up majorly to not be able to change the asset/build pipeline
hm, open for suggestions. i really dislike OOP style, can't change a value without initializing other values. but that means no caching and some more calculations. currently i'm thinking about this to optimize calculating a math.length every frame. worth it? ๐
Going from synchronous to asynchronous is pretty application changing
I feel like the whole sqrt avoiding is pretty dated thinking these days
The dedicated hardware for this is very fast
Sure if you can avoid it and use sq version you definitely should
But you can crunch a lot of distance calcs before it'll be your bottleneck
nothing about sqrt. it's more for convenience that an offset vector can be changed without any trouble
Ok maybe I missed the problem
length is needed and cached usually. having a changefilter would be overkill but also possible
but i'm probably overthinking this hehe
eh change filter it is ๐ why not
the best investment i ever made. buying a mouse with replaceable switches. they always break and end in double clicks.
i just bought a mouse that has switches that don't break ^_^'
i break mouse wheels instead
new design? how can they be unbreakable? ๐
in 25 years cant say i've ever broken the broken the mouse click
just the scroll wheel on all of them ๐
always gunk up the the button stops working
what the ... ๐ i have gone through 1-2 mice at least a year because of broken buttons. maybe they fk up european mice haha
mostly were logitech and steelseries
interesting i mostly buy wireless logitech
wonder if theres some relation with grip
feb 2013 logitech g602
may 2015 logitech g602 free replacement due to wireless issue
june 2020 logitech g604 lightspeed (was not impressed with how fast i broke the scroll wheel + side buttons on this)
may 2021 logitech g502 lightspeed
this 502 has been flawless
really like it
never had any of that series. my mice always have cable. grip shouldn't matter much. i've investigated this issue some time ago and the result was bad switches with mostly wrong voltage from manufacturers. though on the topic of grip, my clicks are mostly in the back half. small hands ^^
i was thinking more palm vs claw vs fingertip grip
no idea if it'd matter
maybe your just unlucky, or i'm just lucky
i use my mouse a lot since i work from home as well
no it's really a thing here. my gaming friends also have this problem a lot.
I have to have an ambidextrous mouse because I switch from left to right handed
logitech has always been good to me for warranty replacement
may 2015 logitech g602 free replacement due to wireless issue
they gave me a full new mouse even though it was 6 months out of warranty
it's usually a hassle. i had free replacements that also broke
yeah I've heard logitech are the best with replacements
i replaced a set of speakers 3 times with logitech and eventually 3 years later the store was like, do you just want your money back
we cbf processing this warranty again
(this was probably 12 years ago now)
when i replaced this mouse it was so weird
the support was like, yep we'll send you a new mouse
we just need a picture of your current mouse destroyed
i'm like what
am i being trolled
i didn't take a hammer to it, instead I manually dismantled every piece down to the internals and took a picture of that
so in theory i could rebuild it if needed
lol
๐
it was a very interesting experience though getting to look at all the internals
btw. i've missed the train on cheap 3080s. instead of the price lowering it goes up now since the 4x series hit.
i thought that was beginning of 2022 when they did that?
unlucky I managed to get at the original 3080 rrp and glad I did
3080 is still the best selling gpu from nvidia atm
followed by 4090
no one wants 4080s
yeah the prices are just stupidly insane now
and even less the 4070 ti
Its going to effect the PC gaming market
yeah it's beyond stupid when compared to a ps5 or whichever xbox model has rtx capabilities
mid range cards were always around 300 euro. good luck getting that today
yeah i paid like $300 AUD which would be what 200 euro for my 1060
time to be console gamer
minimum price now for a decent card is like 600
much longer of these prices and the PC market will be in serious decline
i mean, the price for midrange cards is around the ballpark but if you look at 3060 vs 3080. the 3060 has like half the performance
I wanted to upgrade during black friday but everything was still so expensive
1080 still going strong
1080 club kicking
not sure about rest of world but black friday in australia is
2 weeks beforehand put everything up 20%
then take 20% off
sales
I've still got my 1080 as backup
650 for what? a 3080?
I wish
i can nearly fly to germany for that
and they are superseded after a couple of years
3080 is like 850โฌ+
same in austria. 800 was the lowest price ever
people still buying. that part i don't understand ๐
I also don't feel like I'm playing a lot of stuff atm that needs a strong gpu
same. i have not even one title which supports rtx
we have a very competitive pc parts market
(though our goods tax is also only 10% so you need to factor that in)
eu too but ... i dunno what happened
it's just gpus though. cpu/memory has good prices
yeah I recently bought everything else new besides the gpu and prices were ok
all in all still expensive though
PSU still going strong though 
i have a quiet a few year old psu now
but it was one of hte first platinum ones
probably actually broke even now
but im not sure it's good enough for a 4090 ๐ฆ
yeah this one is gold I think, and also really old
die shrinks are meant to reduce power...
its only 650W, no way can I put in a 3000+ series
I ran a benchmark on the 13700k and it peaked at 300W
with electricity prices you'll be glad you don't have a larger psu ๐
oh i got so lucky
i locked in my electricity prices for 13 months
before they blew up
i'm currently paying like half what the average price in aus is atm
got this till like july then it's going to be pain
sooner or later it hits everyone -.-
insane what's going on. like the world going to shit in slow motion
Doesn't feel that slow
best thing that could happen when companies pay for electricity when you are in home office ๐
kind of makes you think what it'll mean for media. tv, pcs, consoles take up a huge fraction of the bill
SO's parents are paying our electricity bill ๐
can you adopt me
if you cook once a week its a deal
epic
haha
@rotund token I ordered some vegemite online recently
am I at least a small percentage australian now
You qualify for citizenship now
I was surprised it's not really a thing in germany, since it's made from the leftovers of brewing(?)
and you might not know this, but germans drink a lot of beer
probably doesn't fit in the german reinheitsgebot of beer ๐
after googling I found this, which seems similar
but I've literally never seen it being sold anywhere
It's yeast extract ๐คทโโ๏ธ
I also ordered some marmite with the vegemite and was amazed that they tasted completely differently, with different consistency
Yep
People often compare them but they are quite different
ok some actual dots talk
netcode prediction scares me
i don't mean implementing it
i mean the implications of it
what are the implications
let me quote the documentation
/// per simulation frame, every single time the client receives a new snapshot (see <see cref="ClientServerTickRate.NetworkTickRate"/>
/// and <see cref="ClientServerTickRate.SimulationTickRate"/>). This is called "rollback and re-simulation".</b></para>
/// <para>Thesdlation prediction group ticks also get more frequent at higher pings.
/// I.e. Simplified: A 200ms client will likely re-simulate roughly x2 more frames than a 100ms connection, with caveats.
/// And note: The number of predicted, re-simulated frames can easily reach double digits. Thus, systems in this group
/// must be exceptionally fast, and are likely your CPU "hot path".
/// <i>To help mitigate this, take a look at prediction group batching here <see cref="ClientTickRate.MaxPredictionStepBatchSizeRepeatedTick"/>.</i></para>
/// <para>Pragmatically: This group contains most of the game simulation (or, at least, all simulation that should be "predicted"```
oh you mean from a performance standpoint?
yep
yes, when doing ping tests it's definitely noticable
yep ping ruins your fps
It's a tradeoff I guess, also not every game will need it
further down
Pay particular attention to the systems that run in this group to keep your performance in check.
vs above This group contains most of the game simulation
=S
๐
i think every game should have prediction to make it feel better
I think it depends, if it's not a "fast paced" game it probably wouldn't need it
just not this level of accurate prediction
you don't want a game where you make an action/walk/etc and it is delayed 200ms
that's so 2010
prediction is a must for any multiplayer game
(turn based and stuff ones are fine)
^
but i've been looking at implementing click to move character controller
and to make this predictive, i'd need synchronize my navmesh to clients (done)
then my pathfinding system
and my ORCA simulation for character avoidance
and while these are exceptionally fast in their own right
running them 10 times a frame is never going to be fast
they'd only run for a very small amount of entities on the client though right?
if anyones benchmarked this, a single predictive physics object in a small static world running 10 frames
in netcode causes huge spikes at 200ms
yes only things nearby
is it like an RTS type thing? or do you have a "main character" you control by clicking?
I feel like a lot of networked games still just sync the player position as client authoritive and just leave the remainder server simulated to work around this, but that also has a lot of issues
yes but this isn't really supported
oh thats the other issue i have
you can't change ghost owner
i want to be able to take control of any ghost atm
yeah I saw that a few days back
yeah I find it strange that's still not possible
my game will probably be fine if i don't use any prediction at all
and just make it interpolated
click to move games don't have as big an issue as wasd
poe even uses lockstep
but you play d3 vs poe and d3 movement feels so much nicer because of its prediction
(poe does have a predictive mode and its how the game first launched, but no one except really poor internet quality players use it since they introduced lockstep in ~2013 because it desyncs really badly over time)
I'm still not 100% sure what parts I want to make predictive and which ones I just don't care about because it's too much hassle and the performance impact
I don't think I'm ever going to predict AI on the clients for example, it's just too much work
i don't think theres any reason to predict that
or in general really predict anything but local player and causes of its actions
but the player tends to do the most things
yeah but for example if you swing your weapon and the enemy AI isn't predicted their position will be incorrect to what you saw
not a huge issue but an example of where it would desync
yeah
even if you were predicting the AI
I don't think it's a big issue
I think the delay is by far the most important thing
if i did go fuck it
interpolated only
would make so many things so much easier ^_^'
I'm not even sure if I want to predict my projectiles
the ability system is predicted, and that spawns projectiles, but I'm not sure if I should make those client predicted or not
I guess it would feel a bit better, but I haven't messed with predictive spawning yet
it feels bad if you shoot and your bullets dont come out straight away
but yeah style of game also matters
๐
predicting into the future
gets stunned on the server and the bullet disappears
i do wish it was less focused on shooters/car games i guess
but i think this is just, that's what AAA studios like making
but the majority of users are going to be building rpgs, survival games and simulations
which to me netcode just doesn't handle well yet
I've enjoyed working with it for the top down stuff, I think it also lends itself well, a lot of things are a lot simpler
i like the goals of it
e.g. no need to sync stuff in the "distance" because you have no projected view
and how they make things like prediction much simpler
yeah definitely
if the prediction wasn't part of the framework I never would have bothered and done client side movement
which iirc is also what netcode for gameobjects does
haven't looked at that a lot yet though
we wrote our own network at work
and the horror that was unity 5.6 "networking"
that doesn't sound great ๐
my new rule is dont use a network package without a minimum of 5 devs maintaining it
that still seems like a low number
but I guess it depends a lot on complexity and resources
(and how complete it already is?)
definitely
i was really productive yesterday
I made a monocle
now its time to sleep
thanks, it has the minimum amount of pixels to be recognized as an object
I'm replacing a lot of the art atm so it's not very pretty right now
I did a lot of render refactoring the last few days
better than my capsules
moving everything to actual hybrid components
i should just make a game called capsule
and that's the player controller
and build the entire story around it
how you never fit in school because you had no arms and all your friends did
sounds like an interesting concept
I think there's a lot of merit to very minimalistic games, people often underestimate it
I saw something really cool recently, let me see if I can find it
This is an in progress version of Void Sols: a minimalist, top-down souls-like. This short experience contains one zone, a small collection of items and weapons and one boss. We want to hear your feedback on this game, to help us decide if we will continue to develop it into a larger experience.Souls-Like CombatLearn enemy attack patterns, manag...
I thought it was a very well executed "minimalistic" artstyle
since everything is pretty much just a polygon, but it still looks nice imo
yep, pretty much
valheim definitely the game recently i've been most inspired by
not the pixel art, but just how much more important ambience and post processing is than graphics
yeah definitely
there's a really cool youtube channel that does a lot of interesting "pixel art-esque but it's actually 3d" stuff that goes way over my head, let me see if I can find it
Date of Recording: 2021-01-22
It's been a while since the last update from before the holidays. Several things have been in the works, including a fairly involved procedural terrain generator that deserves its own explanation video some day. Here we are showing off the improvement to the main pixel art shader including light-aware edge colorati...
I really like the style
the models are 3d so it's modeling work though which would destroy me
i just don't do any graphic work
yep, same
if i had a game ever progress far along enough that it was a serious thing
i'd just have convince a studio to pick it up
all of the sprites in my project are just small bits put together at runtime
well not that "small" really, the sword e.g. is 4 parts
I think the concepts and tech behind it are often the more complicated part, unless it's like a massive world with a huge amount of unique textures
I'm not sure if it's me but I feel like recently a lot of games have released that were extremely buggy or very feature light, but looked really good
I'm more into writing libraries anyway than making actual games
I just use games as a test bench
I prefer to find people who want to use my libraries and be my test dummies
haha
I wish I was good enough to write libraries people would want to use ๐
but I guess that's what happens if you never actually work in the field in a professional way
even now doing DOTS stuff I feel like I've "unlearned" 80% of the monobehaviour stuff I used during the last few years on small hobby stuff
interesting, you think that would work?
never heard of this. i'd guess, if it's any good they just copy it.
they don't really know that until it's actually sold well
but if it's an interesting concept and the prototype has already been built, why not pick it up?
well i actually have some contacts now
I guess it depends on the contracts both parties are interested in
but yes it wouldn't be pitching an idea to a studio
it would be hey, here's a near complete game it just needs audio/visuals etc
dont pitch ideas
they will be stolen used
i mean also it doesn't need to be picked up by a studio the alternative is source funding to pay for the completion
but either way, it would need to be a product
I think making a playable prototype and then making art for a small vertical slice and crowdfunding that could also work
not really a novel concept after all ๐
I keep getting ads recently for companies that basically just do that part of video game dev, I assume mainly for larger companies to outsource to
don't think i've seen an ad since 2010
except once around 2016 where i reinstalled PC and watched a youtube
and was shocked it had ads and thought this was a brand new feature
I get reddit ads on my phone when im on the pooper
not sure why pihole doesn't get rid of those
yeah I should really switch off the official one
I saw a post recently that it has like a billion tracking features
i used relay before reddit even had an official one
Rif is also okay
twitter has recently become unusable for me, I don't know what went wrong
"Day in the Life of a Japanese Game Designer"
hey it's unity!
I keep getting random spam bot push notifications
(some random youtube im watching atm)
haha
oh they're using a recent version of unity with the annoying experiemental packages in use bar
and they're using an experimental package!
I watched a dev stream for rogue trader, which is also being developed in unity, and I had to chuckle when the shot they took of the dev had the unity console in view full of error messages
best to write a youtube comment to tell them that experimental packages are not meant for production
๐
you mean like this?
yep, but they had the console popped out so it was actually multiple errors!
don't think that's ever happened to me before...
do it, it is the best
i dont have space
i have an ultrawide
and if i buy a new ultrawide
i'll have 2 ultrawides =S
I have an ultrawide and two normal wides
i cant fit a 38" 34" + something else
i really should give up on this 38" idea
im not sure i can even fit that anymore
tbf I don't use the third monitor for a lot of useful stuff
usually just an entire monitor for the profiler or the scene
38" has got to be sick
mine is 34" and I feel it's already pretty big
only really annoying thing about it is that a lot of game still refuse to support ultrawides
looking at you elden ring >_>
yeah so is mine
but mines pretty old now
i got one of the first ones so its only 60hz
i'd love an upgrade
but its like, the cost of a 3080!
that's because your 3080s are too cheap
๐ Actually this is not my issue that currently I use addressables to solve it. The main reason I need load to load entity prefab on demand is because I use dots netcode that it will process all the loaded ghost entity prefab. If the subscene I loaded has 10000 ghost entity prefab then it will process all the 10000 ghost entity prefab no matter what. lol
prefabs are processed by network?
I don't know, as I never worked with it
but sounds kinda bad if it does
i dont get this
what do you mean netcode is processing prefabs?
Entity prefab with this cute ghost icon
yeah
but these have the Prefab tag
so dont appear in queries for systems unless very explicitly requested
so what is netcode doing with them?
Not really sure but it will go through quite long and complex processing logic. I guess it's mainly use it for validation
yeah only ghost collection system uses it
i'm not really seeing the issue with that?
Maybe it's not an issue for desktop platform but it's really expensive for mobile platform
hmm mobile
yeah ok
not a huge fan of what netcode is doing here looking at code
rebuilds this list every frame
it seems they could just build it once
๐ค Wat. Until now still rebuild every frame?
and only rebuild on order version changed
assume this is server or looking at client? both stuff here
but it's basically doing this on server
{
using var ghostEntities = m_RegisterGhostTypesQuery.ToEntityArray(Allocator.Temp);
using var ghostTypes = m_RegisterGhostTypesQuery.ToComponentDataArray<GhostTypeComponent>(Allocator.Temp);
var ghostCollectionList = ghostCollectionFromEntity[collectionSingleton];
if (state.WorldUnmanaged.IsServer())
{
// The server adds all ghost prefabs to the ghost collection if they are not already there
for (int i = 0; i < ghostEntities.Length; i++)
{
var ent = ghostEntities[i];
var ghostType = ghostTypes[i];
TrySetupInsideCollection(ghostCollectionList, ghostType, ent, out var isInCollection);
if (!isInCollection)
{
// The #if is there because the variables passed to the conditional method are protected by an #if
#if NETCODE_DEBUG
ValidatePrefabGUID(ent, ghostType, codePrefabs, ghostTypeFromEntity);
#endif
ghostCollectionList.Add(new GhostCollectionPrefab {GhostType = ghostType, GhostPrefab = ent});
}
}
}```
Tat system will run at both client and server
yeah it does something different as client though
(there's also no reason this couldn't be done in a job instead of on main thread as far as i can tell)
i might just rewrite this system to be a lot faster at some point if i ever run into issues
So they plan to do it in future?
// TODO: Using run on these is only required because the prefab processing cannot run in a job yet
hopefully
sir, I don't get it. How do you manage language switch?
It seems like you are using table type with already selected locale
do you just recreate UILocalization?
this.stringTable.TableChanged += this.OnStringTableChanged;
it subscribes to an event
you fully switch table with within one object?
but yeah i haven't really touched this in a few months as i said before
i just built the proof of concept at the time to make sure this was something i could work on
mostly hanging for 2023
whenever its added
even if it hits 2024 thats not big deal for me
I guess it doesn't support string formatting? {0} kind of stuff
localization does
it has this whole smart string thing
you can put logic inside the localization strings
totally does
hm
but its kind of separate to this script
I get it, as I need to feed my own values to it
I'm figuring out how to manage this
I thought about using binding-path string field for this
but yeah smart strings are really strong
if you haven't got to them yet in your tutorial stuff
have a read
to give yourself ideas of what is possible
but yeah i am far from an expert on this
i don't do much front end work at work, i mostly assign this to others
so i have a decent understanding of what is possible but not necessarily the fine details of implementation - this is just stuff i try to learn and expand in my own project
I'm mostly talking about your script though ๐
yeah but this was just a 30min proof of concept
i think i linked what it was based off
it's probably a good starting point but it should be expanded a lot
it definitely has some flaws atm
all keys need to be in the same table
I'm struggling to load in a subscene after unloading it, in 0.51.
Can anyone help? It's for a university project with deadline on Monday ๐
Basically struggling to figure out how to do it. We've tried with the instructions in https://docs.unity3d.com/Packages/com.unity.entities@0.51/manual/loading_scenes.html and a GO converted to entity outside the subscene but it said the entity doesn't exist?
I never really did / do it this way
I load via manually adding / removing the component
But I'm still not sure what part you're having issue with
You say after unloading it which implies it was loaded at some point
So how did you load it originally
And how are you unloading it
Unfortunately I was just on my way to bed so I won't be able to hang around and debug this with you
Feel free to ping me in this channel in like 7 hours if someone else hasn't helped you
So the subscene initially is just part of the scene, so loading in instantiation by default.
Unloading it is using SceneSystem.UnloadScene(sceneEntity)
no
subscene is serialized entity data
what you have in scene is monob which basically points to that data
the mode how it loads is up to you
Do you use the World Allocator for native containers now? is it instead of using Persistent so you don't need to dispose manually?
i seem to remember someone saying something about them here before
Ah it replaces TempJob
That should be added to the docs somewhere
Ok nvm that breaks my code
var positionsArray = new NativeArray<PositionData>((int)amountOfSystems, state.WorldUpdateAllocator);
ArgumentException: Use CollectionHelper.CreateNativeArray for custom allocator
Parameter name: allocator
Unity.Collections.NativeArray`1[T].CheckAllocateArguments (System.Int32 length, Unity.Collections.Allocator allocator) (at <44569b2d1c974b5eb5e85c3450cfe46d>:0)
Unity.Collections.NativeArray`1[T].Allocate (System.Int32 length, Unity.Collections.Allocator allocator, Unity.Collections.NativeArray`1[T]& array) (at <44569b2d1c974b5eb5e85c3450cfe46d>:0)
Unity.Collections.NativeArray`1[T]..ctor (System.Int32 length, Unity.Collections.Allocator allocator, Unity.Collections.NativeArrayOptions options) (at <44569b2d1c974b5eb5e85c3450cfe46d>:0)
Works fine with my code that uses NativeMultiHashMap, just not this NativeArray
how do we mult quaternions with vectors in the math package ?
Why can't MonoBehaviors be in editor only assembly so I can separate the Baking and Runtime properly? ๐ค
math.mul() if I remember correctly
thanks
what's yhe problem with it? i've split authoring comps and baking in its own asmdef.
ah editor only, hm yeah i remember having some problem with it myself
I do this
But I don't think you can mark editor only in the tick box
But in the required defines of the asmdef you can add UNITY_EDITOR
this will disallow using monob in scene
figured it the hard way ๐
Same.. Saw some DOTS package had editor assemblies with folder of "Authoring" but they only had bakers in them and had the Authoring components in "Runtime" assembly & folder ๐ Spent a few hours trying to figure out why my scripts suddenly failed to load in inspector.
this is why i said you need to use define constraints
will be stripped in builds but will exist during the subscene baking step
yeah, I got it. Usually I just wrapped code around #if constraints, but assembly is cleaner and easier to manage approach
yeah it's nice being able to apply it to entire assembly
however unity 22.1f1 has broken this pattern of including in debug builds
i really need to make a bug report on this
i need it fixed ๐ฌ
WHY!
and here I thought, hey cool, easy color cycling
UnsafeUtility.As<int, ColorIndex>(ref colorIndex) you can't stop me!
SystemAPI.HasComponent<T> works in IJobEntity right? and does some code gen to do the look up?
It's not erroring for me
hm, afaik, no, it's for ISystem and SystemBase
the comment on it is a bit confusing
you'd need to look at the generated source code. maybe it does
/// When iterating over a set of entities via <see cref="IJobEntity"/> or <see cref="SystemAPI.Query{T}"/>, avoid using this method with the
/// current entity in the set. It is generally faster to change your entity query methods to avoid
/// optional components; this may require a different construction to handle each combination of optional and non-optional components.
But then right at the bottom
/// <remarks> Not working in IJobEntity, Utility methods, and Aspects </remarks>
well, there you go ๐
but the first one implies that it works
you can iterate on entities without a job
via <see cref="IJobEntity"/>
oh wait, yeah
@proud jackal could tell us what's up with that
anyway, usually you'd use ComponentLookup in a job to find out if an entity has a certain component
Well just comes to show that plans change ๐ SystemAPI is in fact only supported in ISystems and SystemBase :3
cool thx
ComponentLookup can be code gen'd with SystemAPI.GetComponentLookup<T>. safes on boilerplate code. then in the job just use componentLookup.HasComponent(entity)
optional aspect buffers when dani ^_^
does that still do a cache?
yes
nice
Dani has done amazing work on reducing the boilerplate code via SystemAPI methods
same goes for GetComponentTypeHandle
pretty sure i deleted like 30% of my code
hehe, yeah, some systems only have a few lines now. it's really cool
Is there a way to do something like SystemAPI.Query from inside a Monobehavior?
no
var query = new EntityQueryBuilder()
pretty sure that works
that's not the same thing
I'd like to iterate over some entities
That's okay
do it in system
If it helps, I only want to do the SystemAPI.Query once
Alright, I'll move the code back to SystemBase's OnCreate then
But it kinda breaks encapsulation
But I don't see any other alternative
if you are doing ECS, any game logic should come from systems
that sounds like an OOP word ๐
in a MB you'd build a query with var query = entityManager.CreateEntityQuery(ComponentType.ReadOnly<T>());
can be cached just fine
Query is foreach
but yeah, systemapi is just generating code for you - you can just write it by hand yourself if you need the behaviour in a MB
I'm sorry for I have sinned
ohhhhh okay
Time will tell, likely not 1.0
๐ฆ
sadge
had this brilliant idea for my AI data management but i ran into this tiny problem
not all AI have the same buffers
oh well, if it comes eventually i'll add it eventually!
enough other things to look at atm
if there's no other way, get the query, get the entities. iterate over the entities and get the components you want. that said, it should be done in a system
Yee.. Then again you never know! I'm just keeping it safe.. Something something don't want people to depend on it.. I was also sure i wouldn't get IJobEntityBeginEndChunk in. Yet look where we are xD
I'll do the querying in a system, store it in the system, and access it from the Monobehavior then
that has been the best gift
I made an AI system similar to GOAP, but it's really clunky.
im also so glad you added the end chunk part
i didn't even consider this but i had a really good use of it a few days ago
Oh nice!
{
this.navMeshQueries = new NativeArray<NavMeshQuery>(this.NavMeshWorlds.WorldsLength, Allocator.Temp);
for (byte i = 0; i < this.navMeshQueries.Length; i++)
{
this.navMeshQueries[i] = this.NavMeshWorlds[i].CreateQuery(2048, Allocator.Temp);
}
return true;
}
public void OnChunkEnd(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask, bool chunkWasExecuted)
{
for (var i = 0; i < this.navMeshQueries.Length; i++)
{
this.navMeshQueries[i].Dispose();
}
}```
๐ โฅ๏ธ
Biggest problem is i need to remember to go in and change the ordering. As version numbers are still updated no matter if it is true or not.
(before someone mentions it, you might think its weird you see a Temp and it's disposing - it's releasing native memory my navmesh is written in c++)
Oh interesting
oh it's just a wrapper to recast/detour
i've slowly being porting individual blocks to burst
but was way too much effort to do that to the entire library up front it's huge
works really well though
Guess you're leveraging Burst playing nicely with DLLs?
Is there also an equivalent to SystemAPI.GetComponentLookup<LocalToWorld>(true) inside of a Monoebhavior?
Autogen keeps getting in the way
oh i wrapped this in a particular way
where all these Recast methods are extern calls
this is all in a burst job
but i can go in and replace each of these extern calls 1 at a time
with code written in burst
as i find time
and it's very easy to compare results if i make a mistake
Well, as with any MB getting access to Entity land you first need access to the world. Most people use World.DefaultInjectionSomethingBlahBlah. Get your IDE to remember it, cause I never can. Then once you have the world use the EntityManager. It has everything you need.
Oh nice!
oh random question Dani while you're here
SystemAPI in an ISystem method requires ref SystemState state on the method right
But in a SystemBase it requires it to just be a non-static method
Indeed
is there a chance we can have support for
method(ref SystemState state)
in a systembase
EntityManager doesn't seem to have anything to generate ComponentLookup
so i can share the same static method between systembase and ISystem
you don't really need component lookup if you're using em, you can just directly use EntityManager.GetComponent
Right, I should've mentioned I'm trying to schedule a job from a Monoebahvior that uses ComponentLookup
I'll just move it to a system anyway
Another design fiasco caused by OOP thinking ๐
internal ComponentLookup<T> GetComponentLookup<T>(bool isReadOnly = false)
it exists it's just internal
I'll just use a system for now
Oh interesting, what's the usecase?
the tldr of what I wanted it for dani was I have this, non-sexy not code generated, ClientAPI/ServerAPI
/// <summary> API to be used on the client for managing game state, UI and input. </summary>
public static partial class ClientAPI
{
/// <summary> Disables a specific client state. </summary>
/// <param name="systemState"> The owning system state. </param>
/// <param name="name"> The client state to set. </param>
public static void StateSet(ref SystemState systemState, FixedString32Bytes name)
{
var state = K<ClientStates>.NameToKey(name);
systemState.EntityManager.GetSingleton<BLDebug>(false).Debug($"ClientState set to {name}");
systemState.EntityManager.SetSingleton(new ClientState { Value = new BitArray256 { [state] = true } });
}```
so I've had to implement it with custom extensions to EntityManager instead of using SystemAPI
Ohh gotcha
And how did you wanna call it in SystemBase? As we do expose .CheckedStateRef
yeah
i pass CheckedStateRef when using SystemBase
i basically just want, if method has SystemState passed in, is it possible to use that instead of CheckedStateRef
because these are static methods so when used from a SystemBase, SystemAPI can't find CheckedStateRef itself
it's not a huge deal, i've worked around it fine
is there any good explaination for this. open subscene leads to this error: InvalidOperationException: GetSingleton<FixedTickSystem+Singleton>() requires that exactly one FixedTickSystem+Singleton exist that match this query, but there are 0. Unity.Entities.EntityQueryImpl.GetSingleton[T] () (at Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/Iterators/EntityQuery.cs:1417) Unity.Entities.EntityQuery.GetSingleton[T] () (at Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/Iterators/EntityQuery.cs:2598) ThirdPersonPlayerFixedStepControlSystem.OnUpdate (Unity.Entities.SystemState& state) (at Assets/Rival_StandardCharacters/ThirdPerson/Scripts/ThirdPersonPlayerSystems.cs:100) closed is fine.
Hmm. Yeah idk, would seem a little odd if the reference changed all of a sudden. But i guess you could argue that something like an attribute on that param could force the switch. Then I guess the question then just is how are you using SystemAPI in a static method as that is a currently a no-go?
its not really switching here though, static methods with SystemAPI are just not supported in SystemBase atm
Load ordering can change between the two. Especially in a build. RequireForUpdate is likely your friend.
basically, i want support for static methods by allowing the user to manually pass in SystemState
someone else reported this here the other day
does it spam over and over, or just a couple of frames?
could have been me ๐ ok, load ordering. got it. was just wondering why this works in a closed subscene. usually my things break when i have a closed subscene and not the other way around
just 1 frame but the graphic for the capsule isn't updated then so there's something else going wrong then
capsule stands on the starting point and doesnt move
when you open a subscene everything is deleted for a few frames while it re-loads async
I actually have a system to auto pause my simulation updates when a subscene is opened until it's done loading to avoid issues like this
this is for Rival so pinging @signal phoenix for it ๐
Ohhhh yeahh well. That's just EntityManager if you did it that way. The pro of SystemAPI would be passing in a compound cached structure. That's how we experimented with SystemAPI in statics for a while, so we have ideas. Just no concrete plans yet.
oh i know, it'd be doing the exact same thing i'm doing
i just wouldn't need internal access and custom entity manager methods
True true.
the other annoyance is that if you do something like
{
systemState.GetEntityQuery().SetSingleton();
}```
it yells at you to use SystemAPI because you are accessing a query in an OnUpdate
but i can't use SystemAPI because it's not allowed
so the dependency is never added to the system if you use EM
Haha yeahhhh.. well it does heavily want you to pass in the query instead xD
obviously this would be terrible practice for constant calls
but this is only used on full game transitions
clicking options button or something
so performance isn't my concern, usability is
anyway low on any priority list, just a slight inconsistency that bothered me
maybe at some point I'll figure out this code gen wizardry and generate this with code gen and pass in the query instead
wonder if there's magic where you can code gen SystemAPI calls ๐ค
It's a little sad but i guess if usability is the name then SourceGen is the game. While SourceGen is not my favorite piece of tech for good API design (i personally do like explicitness) it does help with usability.
Yupp, you came to the same conclusion xD
Nope, SourceGen doesn't know about other generators
FixedTickSystem seems to create its singleton in OnUpdate instead of OnCreate
i wonder why
Don't you just hate it when you get a burst error with no helpful info
(0,0): Burst error BC1091: External and internal calls are not allowed inside static constructors: Interop.BCrypt.BCryptGenRandom(System.IntPtr hAlgorithm, byte* pbBuffer, int cbBuffer, int dwFlags)
And the rest of the stack trace is just all the compiling jobs
ah, i'll see if i used it anywhere
i see no reason. moved it to oncreate, got rid of the check. error is gone
i had a chat with neil henning (sadly I think he's left Unity now) about this error
capsule graphics still doesn't get updated though with open subscene ๐คทโโ๏ธ
does this mean you can't use IEquatable<>?
unfortunately the channel that this was discussed in has been removed
so i can't pull up the reasoning for this breaking
you can
is there a burst hashcode then?
ah, you can just ignore it
i.e.
do this
{
unchecked
{
return (this.Value1 * 397) ^ this.Value2;
}
}```
not this
``` public override int GetHashCode()
{
return HashCode.Combine(this.Value1, this.Value2);
}```
if this is your issue you're kind of lucky i'm on, i don't think many people would have run into this, you probably would have been banging your head against a wall for a while
it's combining a int2 and an int, is casting the int to int2 ok?
as you say, the error message is very vague
you shouldn't need to cast
public int Test2;
public override int GetHashCode()
{
unchecked
{
return (this.Test.GetHashCode() * 397) ^ this.Test2;
}
}```
same pattern works
your ide should be able to just generate this hash function for you though
VS might generate it slightly differently (different primes)
ah, yeah that works
Oh had more burst errors
[BurstCompile]
public void OnCreate(ref SystemState state)
{
var query = SystemAPI.QueryBuilder().WithAll<PlanetSpawnedTag>().Build();
state.RequireAnyForUpdate(query);
}
That should be burst compatible right?
yes
oh
ah lol
public void RequireAnyForUpdate(params EntityQuery[] queries)```
any of update takes an array
any just lets you pass in a bunch of queries
if you only have 1 query it won't be different
i didnt connect the Any to the array
if you do need RequireAnyForUpdate there is a nativearray version that is burst compatible
I wonder if you could make a IDE extension to underline all the non burst compatible functions (or if they just have [ExcludeFromBurstCompatTesting] ) when they are used inside a method with the [BurstCompatible] attribute on
Might be able to make one as well to detect when SystemAPI is used outside of ISystem and SystemBase
does it? i've never noticed lol
yeah its some advanced analysis
and its only on very specific things
like new class or something
but its something they're thinking of anyway
would be helpful for new users and people like me who can't read
humm it is already on
yeah my point exactly
doesn't catch much atm
but it is a feature they have put some time in and hopefully in future gets more support!
i was nearly going insane with vectors going in the wrong direction. then i tried changing some variables
o_O
the pain of porting ๐
i have to find out why the camera controller thinks the offset is obscured and changes directions
99% case it's a backface hit on the player capsule because the error is only when the offset is inside the capsule
i always mix this up
is it unity physics that hits backfaces or the default physics
they have different behaviours here from memory
unity physics does backface hits
tripping me up big time
backface hits makes no sense if you ask me
yeah, filtering that fixed the problem. i need a routine to filter those backface hits. haven't figured it out yet with minimal math. i would need a dot product for every hit. :/
i think i just had an ignore collider collector
that simply removed the player from being hit
or using custom physics tags
was another idea i had but havent tried
yeah, a collector is also what i'm using
port goes pretty well so far. follow cam without any camera input. (still have to fix some stutters)
Sorry if this is dumb but i'm having a brain fart and can't figure this out.
I have an Entity (which there is only one, ie singleton.) and I'm trying to add to it's DynamicBuffer from a lamba function, so I can only use basic EntityManager options...
wdym with lambda function? Entities.ForEach?
no, basically a monobehavior. Actually it's a system where i'm registering an event for later
where are you stuck? just get the DynamicBuffer
Trying to query or look it up...
where T : unmanaged
{
var query = entityManager.CreateEntityQuery(ComponentType.ReadOnly<T>());
var entity = query.GetSingletonEntity();
query.Dispose();
return entity;
}```
then get the DB from the entity via EM
i had that query too, and i was trying to convert it to a component array... which i couldn't for a buffer. and hence my brainfart.
thanks
get the entity then use entityManager.GetBuffer<T>(entity)
then you can add whatever you want
(though i don't recommend it as it interferes with any scheduled jobs)
it's spawned from user interactions anyways, have to be on the mainthread up to this point.
Thanks for the help. Appreciate it ๐
np, you can gather the inputs on main thread and then use the data in scheduled jobs. leaves the main thread unblocked.
yeah this is one of the event functions that will be run on certain user interactions. I'm just registering it now, and it adds the data to the buffer (which i was struggling to grab) and then the systems handle the rest
so basically its run as a response to a user action event, and then just puts data on my entity for the systems to handle
Does using SystemAPI.Query in OnCreate() not return anything because the entities haven't been baked yet? Am I supposed to do that in OnStartRunning()?
they are likely baked but the subscene hasn't been loaded yet
make sure the subscene has been loaded beforehand
Anyone know how WithAny<> for a query works when you have two. e.g. .WithAny<>().WithAny<>()
Does it mean any of those components or needs at least one from each? as i need the second case.
Basically (x || y || z || V) vs (x || y) && (z || V)
The entities have been loaded and I confirmed it in the entity inspector. However, this code block inside of OnCreate always thinks there aren't any entities
foreach(var (prefab, model) in SystemAPI.Query<AnimationModelPrefabComponent>().WithEntityAccess())
{
Debug.Log("one");
var prefabInstance = prefab.Instance;
ModelMappings.TryAdd(prefabInstance, new List<Entity>());
var models = ModelMappings[prefabInstance];
models.Add(model);
}
The entities are also there at runtime
I should also mention that AnimationModelPrefabComponent is a ComponentObject, basically a class IComponentData
do you need it in OnCreate? why not Update?
Here's its definition
public sealed class AnimationModelPrefabComponent : IComponentData
{
public GPUICrowdPrefab Instance;
}
It could go elsewhere if needed. I just need to run some initialization code once
So OnUpdate and then disable the system after running once?
or add a tag component to those objects after which blocks the foreach running on them? Probably safer than relying on a single frame update
I'm currently supposed to delete them after they've served their purpose
it's the first case. no idea how you'd model the second case tbh
cool, thought so. I can work around it
It's definitely been loaded before I even press play
The entity inspector shows the components
Unless it takes some time for them to load?
it does ๐
Ok. That scares me since that means that there's no reliable way of performing setup operations on baked netities just once
Do you have any suggestions?
@viral sonnet not sure if it's been answered above, but the FixedTickSingleton error is because the First/ThirdPersonPlayerSystem are missing a RequireForUpdate<FixedTickSystem.Singleton>(); in their OnCreate. Looks like sometimes things happen in an order where the singleton is created before, but sometimes it doesn't. This'll be fixed in next update
there are more involved ways. what i do in those cases is to have a CharacterSubSceneLoaded comp in the subscene. that way i know when that singleton comp is available the scene has been loaded. then i move all code form OnCreate to OnUpdate and have a RequireForUpdate<CharacterSubSceneLoaded>() for the system
I'll try that. Thanks!
i've fixed that error with moving the creation of the singleton to OnCreate. doesn't seem to have any side effects. second problem i'm having is that with an open subscene the player capsule doesn't move in the scene view. (maybe that's rival unrelated)
yeah that's just something that happens with any moving object when subscene is opened, as far as I know. They just stay where they were originally placed at bake time I believe
hm, do you know any way to fix that?
Do all subscenes load before the first Start callback in Monobehaviors?
Or are they completely asynchronous?
afaik, they are async. Start wouldn't be reliable
Okay. Strangely enough, other system's OnCreate are properly picking up entities through other methods like GetEntityQuery and EntityQuery.CalculateEntityCount
Are those methods different in any way?
It's just SystemAPI.Query that's behaving strangely
it totally depends on load timings. i had the case where i got entities with subscene open but not with subscenes closed.
if you get them or not is random then. another case was that i got all entities with burst disabled. because everything was slower
That means I have to refactor a lot of code. The simplest solution would be to somehow block the main thread until all Subscenes have loaded
I'm willing to take the loading time
Is there a method for that?
then you'd have to manually create all systems
because they initialize no matter what
I think I'm doing something wrong by trying to perform initialization operations outside of baking
you could also disable all systems and move your code to OnStartRunning but this all feels like patchwork
This is all because I need Entities to call Monobehaviors at some point in the setup process. However, those non-subscene Monoebhaviors do not exist in Subscenes
if you can move the init process to baking you should
Okay. That's hard when I need some singleton Monobehaviors outside of the Subscene to help out in the setup process
yeah, with MBs that won't work then in baking
it's a daunting process but you'll get over it
Do Baking systems allow performing operations on the baked entities, or does it have to use Monobehaviors as input?
Like the Baker<Authoring> performs the isolated setup, and then the baker systems consolidates the converted entities and perform World-wide operations
you can do a lot with baking systems. most MB code will work for it
Oh, so you can query for MBs inside of Baking systems?
sure
you can also the same in Bakers
you are still in MB land in this stage
GetComponent, getting parents, etc...
Right, I see the solution now. I'll not change anything inside the Baker classes, but write Baking systems to perform any operations that involve every entity of some type
Thanks!
good luck ๐
Sorry to bother you again, I'm testing it now and it's failing:
ArgumentException: Unknown Type:Unity.Entities.DynamicBuffer1[....]` All ComponentType must be known at compile time. For generic components, each concrete type must be registered with [RegisterGenericComponentType].
hm, the method is only intended for IComponentData. how do you call it?
though on second thought DynamicBuffer<...> should also work
I think I fixed that issue. Had to include state.RequireForUpdate in my Oncreate
other stuff isn't working now, so i can't say it works for sure though lol
Do Systems with the [WorldSystemFilter(WorldSystemFilterFlags.BakingSystem)] attribute exist at runtime?
no
Wasn't there a special [UpdateInGroup()] for Baking systems that allows you to create new Entities that end up in the desetination world?
Not only that, but inside the baking system, whatever entities I create through EntityManager.CreateEntity() aren't showing up
adding entities works a bit different in baking systems. ```foreach (var (_, entity) in SystemAPI
.Query<Add_EntityTest>()
.WithOptions(EntityQueryOptions.IncludePrefab | EntityQueryOptions.IncludeDisabledEntities)
.WithEntityAccess())
{
var sceneSection = state.EntityManager.GetSharedComponent<SceneSection>(entity);
//UnityEngine.Debug.Log(sceneSection.SceneGUID);
var newEnt = ecb.CreateEntity();
ecb.SetName(newEnt, "testEnt");
ecb.AddComponent(newEnt, new FixedStructTest.FixedStruct());
ecb.AddSharedComponent(newEnt, new SceneSection { SceneGUID = sceneSection.SceneGUID, Section = 0 });
}``` here's how it works
the basic gist is that it needs a SceneSection comp so it can be associated with a subscene
Ok, I'll try it out. Thank you for your support!
Is there a cleaner way to obtain SceneSection?
Also, does the baking system inherit from SystemBase or BakingSystem?
it can be ISystem or SystemBase
only [WorldSystemFilter(WorldSystemFilterFlags.BakingSystem)] tags it as a baking system
not really as you need the entity from which it was baked
btw there's also CreateAdditionalEntity in bakers which is a lot easier to use
Alright, I'll make an empty Authoring whose sole purpose is to provide its Baker an entity with the right component
Thanks!
I want to set this entity's componenet
World.DefaultGameObjectInjectionWorld.EntityManager.SetComponentData<TargetPosition>(entity, new TargetPosition { value = new float3(50, 50, 50) });
is this the way to do it
this is really ugly and "hacky" way to do it, but yes, that will do.
what's the better way
depends on use case
but it definetely will come from System
I recommend going through entities manual at first
too much info about how it works
link please?
anyone know how to convert from unity physics to havok physics? the guide recommends to use their PhysicsSample project lmao
you shouldn't really need to do anything except install the package
and then select it from the drop down on the settings script
which i'll find the name of in a second
so if i just add the Physics Body component, it will automatically use Havok as long as I have it installed?
yes
okay thank you ๐
dumb question but i couldn't find the answer anywhere except one reddit comment. do we still put the rigidbody component on entities?
In Unity Physics there are 2 components
Physics Shape
Physics Body
is there a ECS equivalent of colliders?