Having trouble with getting my doors to work.

If anyone can give me a little direction that would be great.

This is the error message I’m getting.
NullReferenceException: Object reference not set to an instance of an object
BaseDoor.Update () (at Assets/BaseDoor.cs:29)
InputDoor.Update () (at Assets/InputDoor.cs:16)

My BaseDoor code:



My InputDoor code:


1974584--127986--upload_2015-2-22_1-41-27.png


Please use code tags instead of just posting scripts as text, it makes it much easier to read and numbers each line. That way we can jump straight to lines 29 and 16 instead of puzzling out which lines those are. To use code tags look for the insert icon and select “code” from the dropdown menu.

From the looks of it I’m guessing you’re trying to access functions in other scripts, such as your InputDoor script accessing the update function of your BaseDoor script. This is a rundown of how that works: http://docs.unity3d.com/412/Documentation/ScriptReference/index.Accessing_Other_Game_Objects.html

I didn’t check the BaseDoor script, but in your InputDoor script you’re calling the update function on “base” without defining what “base” is.

base is a key-word which ref to parent in C#

Aah, my apologies. I rarely mess with C#.