Search Issue Tracker

By Design

Votes

1

Found in

4.3.3f1

Issue ID

587600

Regression

No

Adding a polygon collider 2d on runtime via script is broken on builds

2D

-

-

Priority: 2Necessary for shipping a final release

-

Severity: 2No workaround

To reproduce:
1. Open attached project
2. Open scene "screen". It contains a sprite and a script that attaches a polygon collider 2d component. There is also a script that draws the outlines of the collider
3. Run the scene - the collider looks nice
4. Build and run - the collider is somewhat random and not like the sprite at all

Comments (3)

  1. 1eec5656080a5975586fabe285eb5674?d=mm

    kcarroll_cmm

    Jul 31, 2014 19:35

    Any traction on this? I am using Unity 4.5.2f1 and it is still a problem.

  2. A458a10633dd818a5ee2eba74540ef30?d=mm

    joe_raised

    Apr 28, 2014 12:02

    I am having this exact same problem, but the suggested fix/work around does not work.

    I have my textures in a Resources folder.
    I have them set to Texture type 'Advanced'.
    I have Read/Write enabled.

    When I load them dynamically when testing, they work great. When they load via a build (Web, x86, Mac OSX) they all generated a seemingly random off centre PolygonCollider2D mesh.

    Here is a textures .meta file:
    fileFormatVersion: 2
    guid: 825af6a76cab540b49cd6d74a9b0c867
    TextureImporter:
    serializedVersion: 2
    mipmaps:
    mipMapMode: 0
    enableMipMap: 1
    linearTexture: 0
    correctGamma: 0
    fadeOut: 0
    borderMipMap: 0
    mipMapFadeDistanceStart: 1
    mipMapFadeDistanceEnd: 3
    bumpmap:
    convertToNormalMap: 0
    externalNormalMap: 0
    heightScale: .25
    normalMapFilter: 0
    isReadable: 1
    grayScaleToAlpha: 0
    generateCubemap: 0
    seamlessCubemap: 0
    textureFormat: -1
    maxTextureSize: 1024
    textureSettings:
    filterMode: -1
    aniso: 1
    mipBias: -1
    wrapMode: 1
    nPOTScale: 0
    lightmap: 0
    compressionQuality: 50
    spriteMode: 1
    spriteExtrude: 1
    spriteMeshType: 1
    alignment: 0
    spritePivot: {x: .5, y: .5}
    spritePixelsToUnits: 100
    alphaIsTransparency: 1
    textureType: 5
    buildTargetSettings: []
    spriteSheet:
    sprites: []
    spritePackingTag:
    userData:

  3. 78fe46a857cd7fe3eb75b8f30a4f6157?d=mm

    TomasJ

    Mar 26, 2014 10:45

    In order to generate a Sprite outline, the texture must be readable. Otherwise pixel data is pushed to GPU and discarded.
    Set Read/Write Enable in the texture importer to fix this

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.