So I’ve got an array:
private var SceneObjects : GameObject [];
This has all of the objects in the scene.
Now, I’ve got this other array:
private var Platforms : GameObject [];
How do I set the array Platforms to have only the gameobjects in SceneObjects which contain the name ‘PlatCenter’?
for (var Plats : GameObject in SceneObjects) {
if (Plats.gameObject.name.Contains("PlatCenter")) {
for (var i : int = 0; i<SceneObjects.length; i++){
Platforms _= SceneObjects*;*_
}
}
}
I’ve tried that, but it is only producing the error:
NullReferenceException: Object reference not set to an instance of an object -
(wrapper stelemref) object:stelemref (object,intptr,object)
Thanks.