zaniar
August 31, 2015, 2:49pm
1
Hi , I want add Player as child of MainCamera in next Scene .
Here is the script .
public var target : Transform;
function StartGame (level : String) {
DontDestroyOnLoad (target.gameObject);
target.rigidbody.useGravity = false;
Application.LoadLevel(level);
}
function OnLevelWasLoaded()
{
target.transform.parent = Camera.mainCamera.transform;
}
Duugu
August 31, 2015, 3:30pm
2
You’re just declaring the target variable without assigning a value to it.
You’ll have to assign the transform component to your target variable.
target = this.transform;
zaniar
August 31, 2015, 3:42pm
3
thanks , but thisnt problem !
Duugu
August 31, 2015, 4:06pm
4
Well, you didn’t described the problem.
zaniar
August 31, 2015, 4:20pm
5
the problem is in next Scene dosent add target addet to inspector