The problem is that you referenced Object1Prefab (a living object, not an assembly) on ClickButton On Click (). (But the link to the collection will not work at all)
, . (: ClickButton , script, ? . ClickButton ... .)
ButtonClick() 2 ( ):
using UnityEngine;
using System.Collections;
public class Object2 : MonoBehaviour {
[SerializeField]
private GameObject BallClone;
public GameObject mine;
void OnCollisionEnter2D(Collision2D target){
Destroy (target.gameObject);
mine = Instantiate (BallClone,new Vector3(0f,2f,59f),Quaternion.identity) as GameObject;
}
public void ButtonClick(){
mine.GetComponent<Rigidbody2D> ().isKinematic = false;
}
}
1- GameObject1Prefab ( ) Object2 script "mine". public GameObject mine.
, , :
mine = Instantiate (BallClone,new Vector3(0f,2f,59f),Quaternion.identity) as GameObject;
ClickButton GameObject2, 1, On Click().
? .: ~