Search Unity

  1. How can our website serve you better? Give us your feedback. Take our survey and let us know.
    Dismiss Notice

LocalizedAsset Property Drawer exception when using List or Array

Discussion in 'Localisation Tools Previews' started by AzurySimon, Jan 20, 2021.

  1. AzurySimon

    AzurySimon

    Joined:
    Jul 16, 2018
    Posts:
    34
    Any time we want to use a list or an array of LocalizedAssets (eg. LocalizedSprite) the inspector stops working and a NullReferenceException is spammed to the console.
    This does not happen when using the type directly:

    Code (CSharp):
    1. // this works
    2. public LocalizedSprite locSprite;
    3. // the follow does not work
    4. public List<LocalizedSprite> locSpriteList:
    5. public LocalizedSprite[] locSpriteArray;
    We tracked this down to the variable 'assetType' being null in LocalizedReferencePropertyDrawer.cs:141. I think there may be more stuff that relies on that variable to not be null, although I did not check. I suspect the instance is not properly created/initialized when used inside an array/a list?

    Is there a way to fix this without waiting for a new version? We are using version "0.9.0-preview".
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    5,174
    Hi,
    We have fixed this in 0.10.0 which we hope to have released in the next few days.

    You can fix it now. Here is the change. You will need to move the package out of the package cache and into the project Package folder to be able to make changes
    Screen Shot 2021-01-20 at 19.08.28.png
     
  3. AzurySimon

    AzurySimon

    Joined:
    Jul 16, 2018
    Posts:
    34
    Hi karl_jones,
    Thank you!
     
unityunity