Question by
amroko · Oct 26, 2015 at 07:40 AM ·
scripting problemscript.script errorstealth
stealth Frezz when "hit&" play bttn
hey guys sorry for my poor english but i hope u can help me pleas .
could you tell me whats my error and show me how can i fix it pleas!!!
void Awake ()
{
leftOuterDoor = GameObject.Find("door_exitouter_left_001").transform;
rightOuterDoor = GameObject.Find("door_exitOuter_right_001").transform;
leftInnerDoor = GameObject.Find("door_exitInner_left_001").transform;
rightInnerDoor = GameObject.Find("door_exitInner_right_001").transform;
leftClosedPosX = leftInnerDoor.position.x;
rightClosedPosX = rightInnerDoor.position.x;
}
void MoveDoors (float newLeftXTarget, float newRightXTarget)
{
float newX = Mathf.Lerp(leftInnerDoor.position.x, newLeftXTarget, doorSpeed * Time.deltaTime);
leftInnerDoor.position = new Vector3(newX, leftInnerDoor.position.y, leftInnerDoor.position.z);
newX = Mathf.Lerp(rightInnerDoor.position.x, newRightXTarget, doorSpeed * Time.deltaTime);
rightInnerDoor.position = new Vector3(newX, rightInnerDoor.position.y, rightInnerDoor.position.z);
}
public void DoorFollowing ()
{
MoveDoors(leftOuterDoor.position.x, rightOuterDoor.position.x);
}
prob1.jpg
(44.1 kB)
Comment
Answer by TheRobWatling · Oct 26, 2015 at 10:44 AM
One of your objects is likely not being found, check the names to the objects in the scene. You have outer spelt with both capital and lower case o's in your Gameobject.Find code.
Your answer
![](https://koobas.hobune.stream/wayback/20220612042747im_/https://answers.unity.com/themes/thub/images/avi.jpg)