Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Accessing pixelOffset

Discussion in 'Scripting' started by RockHound, Dec 9, 2006.

  1. RockHound

    RockHound

    Joined:
    Apr 14, 2006
    Posts:
    132
    I can't seem to access guiText.pixelOffset in C# without generating a Null Reference Exception.

    I believe the problem can be recreated as follows:

    Create a new project
    Add a GUIText object to the scene
    Create a new C# script and assign it to the GUIText object
    Add this line to the Start function: Vector offset = guiText.pixelOffset
    Run it

    Am I missing something obvious (which I frequently do)?

    Thanks.
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,777
    For one, I don't believe there's a class called "Vector" - pixelOffset returns a Vector2.
     
  3. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Yes, there is some weird bug in accessing pixelOffset. Hopefully we'll fix it soon.