Search Unity

BCW0028: WARNING: Implicit downcast from 'Object' to 'int'.

Discussion in 'Scripting' started by fredr92, Sep 18, 2014.

  1. fredr92

    fredr92

    Joined:
    Jul 8, 2013
    Posts:
    292
    Hi,
    i would really appreciate some help understanding these warnings im getting.
    I get around 15 Messages With this so im only gonna post an example and hope someone can help me a little so i can fix the rest myself !

    Here is the warning

    Assets/All Plugins/Plugins/FPS Constructor V1/ScriptsDB/CommonlyUsed/Managers/EffectsManager.js(152,25): BCW0028: WARNING: Implicit downcast from 'Object' to 'int'.


    Here is the line

    if(setArray[info[4]].hitParticles[0] != null){
     
  2. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    What is "hitParticles"? Would be be an array of Int?

    If so, (int == null) will never work because a int cannot be null.
     
  3. fredr92

    fredr92

    Joined:
    Jul 8, 2013
    Posts:
    292
    hitParticles are particles that will appear when for example shooting at the ground then a hitParticle called dirtparticle will come.

    Can it be 0 instead of null then?
     
  4. BmxGrilled

    BmxGrilled

    Joined:
    Jan 27, 2014
    Posts:
    239
    ints with a value 0 are usually considered null.

    in some cases -1 is null, it depends on your uses of the ints in particular.