#Assets serialization?

1 messages · Page 1 of 1 (latest)

steel vine
#

Nope

craggy scroll
#

okay

#

what exactly gets glitched about the prefabs?

#

and yes, do you guys use submodules?

steel vine
#

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

craggy scroll
steel vine
#

Sounds fair. Any recommendations?

craggy scroll
craggy scroll
#

you can create an array of key value tuples

#

and then on awake, ToDictionary()

steel vine
#

Program lead refuses this ultimatum

craggy scroll
#

i personally think authoring a custom dictionary serialization is very low ROI

steel vine
#

But that's fair because it then falls under: not my problem you all are stubborn

wispy oasis
#

i just use a array of structs, then at runtime construct a dict in memory from it

craggy scroll
#

yes, that is what i am describing

craggy scroll
#

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

steel vine
#

Yeah

#

No I am not telling him his shit is buggy he'll just dig his feet in

#

And say Unity is wrong

wispy oasis
#

he does not sound very pragmatic then

#

it should be about getting stuff done and solving problems

steel vine
#

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

craggy scroll
#
[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;
  }
 }
}
steel vine
#

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

craggy scroll
#

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

steel vine
#

Nyah I'm the dev

craggy scroll
#

yeah

steel vine
#

A dev

craggy scroll
#

so the nested prefab thing is unavoidable

steel vine
#

A tech artist to be more accurate

wispy oasis
#

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

craggy scroll
#

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

steel vine
#

I advised him on nested Prefabs being annoying and to make variants instead

craggy scroll
#

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!

wispy oasis
#

can also solve that with good communication and not getting in cases where peoples work is stomped on by other changes

steel vine
#

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"

wispy oasis
#

or test it locally see if you can reproduce the issues with the other implementation with the array and tuple

steel vine
wispy oasis
#

but to be fair, that lead seems to care more about ego, then being productive if he acts the way you betray it

craggy scroll
#

i don't think anyone is going to be paying close attention to how an array is used

steel vine
wispy oasis
#

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

steel vine
#

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

wispy oasis
#

is there a custom attribute on the field that contains the Dictionary

#

and does the class tis used on implement
ISerializationCallbackReceiver

steel vine
#

I don't see that at all

wispy oasis
#

is it something like Dictionary<int, string> or its own type that extends from Dictionary

steel vine
#

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