It doesn't even have an OnEnable
method though.
1) Are you able to check which methods deeper in the call stack it's taking a lot of time in?
2) Also, does it happen every time you Instantiate
a prefab? Or just the first time (per prefab)?
If it's just the first time, it might just be json deserialization that's taking time.
Fortunately, that's something you can do with a preloader so loading can happen, say, before a level instead of when you need to spawn skeletons.
You just need to get references to all the relevant SkeletonDataAsset
s and call GetSkeleton
on each one of them to get them to deserialize at that point.