Search Unity

Error using getPixle, the error is "NullReferenceException: Object reference not set to an instance"

Discussion in '2D' started by TheZadok42, Aug 22, 2017.

  1. TheZadok42

    TheZadok42

    Joined:
    Aug 22, 2017
    Posts:
    1
    The error is
    the code is
    Code (CSharp):
    1. Texture2D img = Resources.Load(@"\images\1") as Texture2D;
    2. Color try1 = img.GetPixel(0,0);
    3. print(try1.ToString());
     
  2. radonthetyrant

    radonthetyrant

    Joined:
    Feb 14, 2014
    Posts:
    6