Unity 5.1.2f
I have Scene with Main Camera, object with rigidbody component and empty game object.
Main Camera has a script attached to it. In public references to Game Object and Rigidbody are getted by drag-and-drop from Hierarchy View to Inspector.
No matter how i try to cast Rigidbody to GameObject I’ve got error whenever it’s as-cast, c-cast or imlicit conversion.
public Rigidbody rocket;
public GameObject gameObject;
void Start()
{
if(rocket != null && gameObject != null)
gameObject = rocket;
}
error CS0029: Cannot implicitly convert type UnityEngine.Rigidbody' to
UnityEngine.GameObject’
If I try as-cast or c-cast I’ve got other errors.
error CS0039: Cannot convert type UnityEngine.Rigidbody' to
UnityEngine.GameObject’ via a built-in conversion
error CS0030: Cannot convert type UnityEngine.Rigidbody' to
UnityEngine.GameObject’
What’s the matter??