Search Unity

Error with Resources.Load

Discussion in 'Windows' started by AllanMSmith, Sep 27, 2013.

  1. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    180
    Hello,

    I´ve been trying to get my game to work under Windows Store Apps, but I just cant get past this error:

    $UnityError.png

    The code is there, I dont usually do all that just to instantiate a prefab, the line was just Instantiate((GameObject)Resources.Load("DataStore", typeof(GameObject)); but I´ve been trying to do it differently, cause I have no idea what to do.

    Can anyone please help me?

    Thanks in advance,
    Best regards,
    Allan
     
  2. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    180
    PS: The error is in the first Resources.Load call... I dont know exactly which error though =(
     
  3. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    What exactly is DataStore?
     
  4. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    180
    Its a class with a ton of info I use in the game. Lists, Dictionaries, Arrays, custom classes... but it barely has any methods, its basically just an organized repository of information for quick access in runtime. It is a MonoBehaviour.
     
  5. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Does it use ArrayLists or Hashtables? Chances are one of the collection types of classes in it isn't supported in Windows Store Apps.

    And why are you instantiating code as a GameObject? That makes no sense.
     
  6. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    180
    This is what DataStore looks like, basically:

    $Screen Shot 2013-09-27 at 00.57.49.png

    The same script also has some classes declarations, they are all similar or more simple than the one Im showing below.

    $Screen Shot 2013-09-27 at 00.58.02.png

    This does work on every other platform I've tried so far... Mac, ios, android, blackberry, pc, web... =/
     
  7. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    180
    Its a prefab. I make a ton of configurations on this prefab, I use it as a local database... that is why I instantiate code as GameObject. If there is a better way to do this I would gladly do it in another way... but its the only way I know unfortunately.
     
  8. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,893
    Looks like a bug, can you report it ?
     
  9. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    180
    Sure. But is there anything I could at least try to get it working? unfortunately this DataStore is crucial to my project (everything depends on it), but if there was something different I could try... I dont know... I really wanted to be able to send it over for the contest =(
     
  10. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,893
    Enable exceptions in Debug->Exceptions, and continue until you hit this exception, then add "this" word to watch, this way you'll be able to determine where the serialization error occurs.
     
  11. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    180
    Alright, I will try it. Will update when I have news. Thank you