Search Unity

krys fantasy superbowl

Discussion in 'Scripting' started by madcalf, May 11, 2006.

  1. madcalf

    madcalf

    Joined:
    Jan 12, 2006
    Posts:
    56
    One of the bigger problems associated with the long slow approach to dieting is that people get ? discover Asia?s goji berries, Mexico?s higher skeletal muscle to body fat ratio
    rolmao, that's great man. yeah bogus scare for real...I heard the news a little while ago. They said something about a little over seven hundred cases WORLD wide. I wouldn't even be alarmed if t
    The music industry is an industry and has an interest in making money They don't care about the music, but they will find acts that will appeal to the largest segment of the population in order to ma
    Okay, I think I definitely need to try that before I leave Problem is I'm not sure if my Japanese is good enough to get a good interview going Just asking questions is easy, but you really want to
     
  2. hsparra

    hsparra

    Joined:
    Jul 12, 2005
    Posts:
    750
    Did you try moving the hash value to a string then calling the Play() function with that screen?
    Code (csharp):
    1.  
    2. clipToPlay = h["clipName"];
    3. snakeAnim.Play(h["clipName"]);
    4.  
     
  3. madcalf

    madcalf

    Joined:
    Jan 12, 2006
    Posts:
    56
    yes, but it only works if i give the the variable a type, like so:

    Code (csharp):
    1. var clipToPlay:String = h["clipName"];
    2. snakeAnim.Play(clipToPlay);
    I'm not sure why i would need to do this, since h["clipName"] is already a string.
     
  4. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Collections (including hashes) in .NET (pre-2.0 version) are implemented in such a way that everything in there is just an Object.

    So if you do h["clipName"], the return value type is the base Object type (even if the actual object is a String, which is indicated by GetType).

    In other words, return type of [] indexer is an Object, while the actual thing returned is a String. But yeah, doing some magic to convert types in here would be nice.
     
  5. madcalf

    madcalf

    Joined:
    Jan 12, 2006
    Posts:
    56
    good to know! I thought i was on crack there for a while.

    Interestingly, it doesn't seem to be a problem with numbers or animation objects (the only other things i've used in hashes, so far). The string example is the only time i've had to use an explicitly typed variable to get the contents out correctly.

    Was that just dumb luck, or would you recommend always extracting the desired content into a typed variable before passing it to functions or doing anything else with it?

    thanx for the info!
    d
     
  6. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    You don't need to statically type.
    This one is a bug where it doesn't resolve the type correctly, i am looking into it.