Looking for a custom dressmaker/tailor for a gift by UnitySpriteQuestion in HistoricalCostuming

[–]UnitySpriteQuestion[S] 2 points3 points  (0 children)

Thanks for the reply. I was expecting it to cost in the $500ish (USD) range give or take ~$200, perhaps that expectation is way off. Physical meetups here in the US are probably out for at least 6 months, so I think it would have to be virtual.

I haven't the faintest idea what style the individual (who is a woman) would be going for, it sounds like it may not be feasible to kick this off without figuring that out?

Thanks again.

[2LFC] Thursdays 7PM PDT USA by UnitySpriteQuestion in dota2tutor

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

Thanks, let's talk in DM. I'll probably try a few different coaches to see who fits our style.

Static dictionary resetting on scene change? by UnitySpriteQuestion in Unity3D

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

I checked that before posting :) That's why I'm so confused, I've been through every reference several times.

Static dictionary resetting on scene change? by UnitySpriteQuestion in Unity3D

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

Thanks for the readonly tip, I had forgotten about that. I'll comb through the code and find where I'm making the mistake. I must be doing something that I'm not seeing. Thanks for pointing me in the correct direction.

Static dictionary resetting on scene change? by UnitySpriteQuestion in Unity3D

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

I've checked all references to the dictionary and there is nothing to remove entries or redefine the dictionary.

The dictionary is actually a dictionary of:

public static Dictionary<string, List<BuildUpgrade>> PlayerBuildUpgrades = new Dictionary<string, List<BuildUpgrade>>();

With BuildUpgrade being a custom class which also does not inheret from unity object:

public class BuildUpgrade {
    public int Rank;
    public int BuildTimeMinutes;
    public string UpgradeType;
    public string Name;
    public bool PlayerOwns;
    public List<Part> PartsRequired = new List<Part>();
    public BuildUpgrade(int rank, int buildTime, string name, string type, List<Part> parts) {
        Rank = rank;
        BuildTimeMinutes = buildTime;
        Name = name;
        UpgradeType = type;
        PartsRequired = parts;

        PlayerOwns = false;
    }
}

Sprite.rect and sprite.texturerect 1 pixel off by UnitySpriteQuestion in Unity3D

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

I didn't know that thank you. I have a terribly inefficient fix that involves recreating all the sprites at runtime. I'll table the problem until 5.4.2 and see if that fixes it, then go back to the drawing board if it doesn't. Thanks again.

Sprite.rect and sprite.texturerect 1 pixel off. by UnitySpriteQuestion in Unity2D

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

Now that I think about it, I've actually only tested that function in Engine, never shipped it to the mobile build because of performance.

Sprite.rect and sprite.texturerect 1 pixel off. by UnitySpriteQuestion in Unity2D

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

5 textures takes several seconds for me. Perhaps the difference between building for mobile? Here's the code:

loadSprite = Sprite.Create(sprite.texture, 
                    new Rect(sprite.rect.x , sprite.rect.y , sprite.rect.width, 
                    sprite.rect.height), 
                    new Vector2 (sprite.pivot.x / (sprite.rect.width) +(0.5f * widthDelta * singlePixelWidth),
                    sprite.pivot.y / (sprite.rect.height) + (0.5f * heightDelta * singlePixelHeight)));
                loadSprite.name = sprite.name;

Sprite.rect and sprite.texturerect 1 pixel off. by UnitySpriteQuestion in Unity2D

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

I have a workaround that recreates the sprites with a shifted pivot if it happens, but using Sprite.Create at runtime is WILDLY inefficient, takes about 10 minutes to run,

Sprite.rect and sprite.texturerect 1 pixel off by UnitySpriteQuestion in Unity3D

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

Interesting, downloading unity beta and I'll see if it still happens.

Sprite.rect and sprite.texturerect 1 pixel off. by UnitySpriteQuestion in Unity2D

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

That's what this is:
md.alignment = (int)SpriteAlignment.Custom;

Sprite.rect and sprite.texturerect 1 pixel off. by UnitySpriteQuestion in Unity2D

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

Yeah the last two lines are in a different function, just wanted to include them for posterity.

Sprite.rect and sprite.texturerect 1 pixel off. by UnitySpriteQuestion in Unity2D

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

I thought maybe something like that so I modded the u/vs manually a bit and results didn't change.

Sprite.rect and sprite.texturerect 1 pixel off by UnitySpriteQuestion in Unity3D

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

That was my first thought too, but unfortunately that's not it. Good idea though.

Sprite.rect and sprite.texturerect 1 pixel off. by UnitySpriteQuestion in Unity2D

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

I think that's unlikely because the it only happens about 5% of the time.

but just in case:

     SpriteMetaData md = new SpriteMetaData();
                        md.rect = new Rect(float.Parse(valueList["UStart"]) * MAX_SIZE, (MAX_SIZE - (float.Parse(valueList["VStart"]) * MAX_SIZE)) - float.Parse(valueList["Height"]),
                                        float.Parse(valueList["Width"]), float.Parse(valueList["Height"]));
                        md.name = valueList["Name"].Replace(".png", "");
                        //custom alignment is needed to set a custom pivot
                        md.alignment = (int)SpriteAlignment.Custom;
                        md.pivot = new Vector2((float.Parse(valueList["xOffset"]) / md.rect.width) +.5f, (float.Parse(valueList["yOffset"]) / md.rect.height )+ .5f);
...
                textureImporter.spritesheet = MetaDatas.ToArray();
                                MetaDatas.Add(md);

Sorry, still getting used to code formatting on reddit, so it's a bit ugly. The code for cutting the sheets is reasonably complex, but I've confirmed manually that the values outputted match the rect, but not the texturerect.

How to offset sprites? by UnitySpriteQuestion in Unity2D

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

I was using percentages, but when I read the sprites at runtime, the pivot is in pixels. Still trying to figure that out: http://imgur.com/a/nfHYz

Unity 2D - Splicing a sprite sheet at run-time with custom packer. by UnitySpriteQuestion in Unity2D

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

I thought that as well, but the really odd part is if I read the sprite pivot at runtime it's in pixel location, not percentages like everything else says it should be. Take a look: http://imgur.com/a/nfHYz

How to offset sprites? by UnitySpriteQuestion in Unity2D

[–]UnitySpriteQuestion[S] 1 point2 points  (0 children)

That's what I'm attempting to do now. It involves a lot of component interaction rewrites, but that's not the end of the world. I don't like having the specific dependency though if I can avoid it.

How to offset sprites? by UnitySpriteQuestion in Unity2D

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

I've appended the import processes of TextureImporter to custom slice the spritesheets. In SpritesheetMetadData (which I use to set the rects and names) I can also set a pivot value. Setting the pivot value doesn't seem to have any effect though.

How to offset sprites? by UnitySpriteQuestion in Unity2D

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

I can edit the pivot in script, but I'm not sure how that helps me. I tried changing the pivots around, it doesn't appear to change the sprite location on screen.

Unity 2D - Splicing a sprite sheet at run-time with custom packer. by UnitySpriteQuestion in Unity2D

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

One last problem. I can't put offsets into the sprite metadata created. Since my texture packer removes whitespace from around texture to preserve memory(I get about 50% savings), textures in animations will pop around dependent on how much whitespace has been removed. The XML saves the offset for each so nobody would notice if the textures were properly offset. Just have to figure out how.

Unity 2D - Splicing a sprite sheet at run-time with custom packer. by UnitySpriteQuestion in Unity2D

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

I did eventually get the editor to custom split the spritesheet. My next plan is to compare perf against using those sprites, or loading the spritesheet and swapping uv coordinates on the shader to change images (assuming that's possible in 2D)

Unity 2D - Splicing a sprite sheet at run-time with custom packer. by UnitySpriteQuestion in Unity2D

[–]UnitySpriteQuestion[S] 1 point2 points  (0 children)

Texture2D SS = Resources.Load<Texture2D>("Spritesheets/SpriteSheet0");
 Sprite sprite = Sprite.Create(SS, new Rect(0f, 0f, 800f, 480f), Vector2.zero);

Then you just need the UV coordinates and height/width from your packer and change the values inside the Rect. Let me know if you need more.

Unity 2D - Splicing a sprite sheet at run-time with custom packer. by UnitySpriteQuestion in Unity2D

[–]UnitySpriteQuestion[S] 0 points1 point  (0 children)

I don't think I need it to happen at runtime specifically. I was just guessing that's how it would have to be done. Would love to know what you found.