#Assets serialization?
1 messages · Page 1 of 1 (latest)
okay
what exactly gets glitched about the prefabs?
and yes, do you guys use submodules?
No submodules
We have a list of colors, and their names. And sometimes when we switch branches, this dictionary loses its shit
And also nested Prefabs fuck up a lot but we don't know if this is related
okay i think it's pretty much settled that the custom serialized dictionary is glitched
Sounds fair. Any recommendations?
that's usually because adding an item to the prefab and adding an item in the hierarchy to its reference (an override) is not automatically mergeable
don't use them
you can create an array of key value tuples
and then on awake, ToDictionary()
Program lead refuses this ultimatum
i personally think authoring a custom dictionary serialization is very low ROI
But that's fair because it then falls under: not my problem you all are stubborn
i just use a array of structs, then at runtime construct a dict in memory from it
yes, that is what i am describing
Tjis is my preference too
it sounds like you are in some jeopardy because you will tell this program lead this thing is buggy
and that will motivate the program lead to fix it, instead of abandon it
Yeah
No I am not telling him his shit is buggy he'll just dig his feet in
And say Unity is wrong
he does not sound very pragmatic then
it should be about getting stuff done and solving problems
I've noticed traditional CSajors who are used to web and
.Net have a bug up their ass about Unity not working like the aforementioned
[Serializable]
public struct ColorNameTuple {
public Color color;
public string name;
}
public class MB : MonoBehaviour {
public ColorNameTuple[] colors;
private readonly Dictionary<Color, string> colorToNames = new();
void Awake() {
foreach (var t in colors) {
colorToNames[t.color] = t.name;
}
}
}
Well if I can prove beyond a SHADOW OF A DOUBT its the custom dictionary, then he'll do it.
But right now his voice is: you are the only one complaining
you should just do it yourself
yeah i would just not worry it about it
lol
it's okay
you don't have to say anything because it does not matter, you are the user
Nyah I'm the dev
yeah
A dev
so the nested prefab thing is unavoidable
A tech artist to be more accurate
if fixing a bug, or ripping something open to test if its the cause of a issue gets you in trouble. there are culture issues
whenever you want to avoid adding stuff to a referenced prefab's hierarchy
to be clear, what i'm saying is, whenever you want to add something to a nested prefab as an override, which appears with a little plus symbol and not-blue in the hierarchy on the left
I advised him on nested Prefabs being annoying and to make variants instead
you can create a separate game object outside of the prefab's hierarchy
then, add a parent constraint
this is not meant as an alternative to variants or nesting
it's meant to prevent this issue where one of those objects with a plus symbol (a hierarchy override) conflicts with an object in blue that was newly added (the nested prefab being modified)
that can't be automatically merged because order matters with prefabs and unity isn't sure which should go where
alright hope this helps!
can also solve that with good communication and not getting in cases where peoples work is stomped on by other changes
I might try to ninja the code Pangloss gave me. I might do it on the sly the next time there is a break on the dictionary
And then see if the lead gets fussy
If it doesn't break OTHER shit for him he may just sigh and say "whatever I don't have time"
or test it locally see if you can reproduce the issues with the other implementation with the array and tuple
I have been trying to force the break all morning. It's only here or there that a branch switch fubars the asset in question
but to be fair, that lead seems to care more about ego, then being productive if he acts the way you betray it
i don't think anyone is going to be paying close attention to how an array is used
I don't think it's ego. He usually has to fix everything so I think he has a "it's not REALLY broken. So triage bigger shit to fix."
like i been programming for most of my life, and yes sometimes a junior will find a mistake i made
its fine, it a 2nd set of eyes and problem got fixed
He doesn't get mad when I spot his mistakes he's thankful
But this particular prefab controls some shit. One break and the rest of the app is broke
So when it gets refactored I think he wants to do it
is there a custom attribute on the field that contains the Dictionary
and does the class tis used on implement
ISerializationCallbackReceiver
Nope
I don't see that at all
is it something like Dictionary<int, string> or its own type that extends from Dictionary
Yes
Wait no I found the IserializeCallback receiver
Sorry I jad to follow this damn thing down a chain, to an abstract that inherits from another class with an interface