What do I have to write instead of “change tag” in the script to change INSTANTIATED OBJECT’S TAG
first of all What is the name of new instantiated object?
I’ve been searching in help it says that Instantiate returns rigidbody, object, missle,… but I need to get into that object’s Tag or Transform (I need GameObject)
I’ve tryed to get that rigidbody
ty
btw that means that RIGIDBODY owns (is parent of) gameObject?
I though that gameObject owns rigidbodies
I have seen in help manual that they are instantiating Rigidbody, but now I’ve noticed that I’m instantiating GameObject prefab, so my variable InstObj can’t be Rigidbody (it says that it should be Object)
Error:
Assets/Scripts/Game/TerrainA.cs(45,41): error CS0266: Cannot implicitly convert type UnityEngine.Object' to UnityEngine.Rigidbody’. An explicit conversion exists (are you missing a cast?)
when I put GameObject;
Error:
Assets/Scripts/Game/TerrainA.cs(45,41): error CS0266: Cannot implicitly convert type UnityEngine.Object' to UnityEngine.GameObject’. An explicit conversion exists (are you missing a cast?)
I have tried to set a GameObject variable first but it didn’t worked.
Errors:
Assets/Scripts/Game/TerrainA.cs(45,74): error CS0119: Expression denotes a type', where a variable’, value' or method group’ was expected
Assets/Scripts/Game/TerrainA.cs(45,62): error CS1502: The best overloaded method match for `UnityEngine.Object.Instantiate(UnityEngine.Object)’ has some invalid arguments
Assets/Scripts/Game/TerrainA.cs(45,62): error CS1503: Argument #1' cannot convert object’ expression to type `UnityEngine.Object’
I’ve told you only Object works:
Object InstObj = Instantiate ( Waypoint…
heres a script i use that works it might help. you can yous more then just object if you cast right
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(Rigidbody))]
public class InstantiateExplosion : MonoBehaviour
{
public GameObject explosion;
private GameObject tempExplosion;
public float timeOut = 5.0f;