- Home /
Question by
princeadj14 · Nov 21, 2013 at 02:40 PM ·
getcomponentgameobject.findbooleans
How to get the value of a boolean in game object to another Game object script.
//First Script
public var spawning : boolean = false;
//Second Script
if (GameObject.Find("EnemySpawnerPoints").GetComponent.<Enemyspawner>().spawning == true) //if boolean is became true then
{
Debug.LogWarning( "The Spawning of Enemy is true" );
var nme : GameObject = GameObject.Find( "Enemy" );
enemyScript = nme.GetComponent( NpcMovement );
}
Comment
Best Answer
Answer by PAEvenson · Nov 21, 2013 at 02:44 PM
Looks like you have a rogue period....
change:
if (GameObject.Find("EnemySpawnerPoints").GetComponent.<Enemyspawner>().spawning == true) //if boolean is became true then
to:
if (GameObject.Find("EnemySpawnerPoints").GetComponent<Enemyspawner>().spawning == true) //if boolean is became true then