i needs script help please
help me please it says
Assets/Scripts/shoot.js(15,31): BCE0020: An instance of type 'UnityEngine.Transform' is required to access non static member 'Translate'.
#pragma strict
var Dammage =50;
function OnCollisionEnter (info : Collision) {
info.transform.SendMessage("ApplyDamage", Dammage,
SendMessageOptions.DontRequireReceiver);
Destroy(gameObject, 1);
}
function Update () {
var translation : float = Time.deltaTime * 60;
UnityEngine.Transform.Translate(0,0,translation);
}
@jazwot did my answer help you? I'd like to know if it worked or not, it worked for me.
Answer by yoda12 · Nov 06, 2015 at 02:39 AM
@jazwot Here this should do it, I removed the UnityEngine
part and changed the T in transform to lowercase, at line #15. I have tested it and it seems to work now for me. http://docs.unity3d.com/ScriptReference/Transform.Translate.html
#pragma strict
var Dammage =50;
function OnCollisionEnter (info : Collision) {
info.transform.SendMessage("ApplyDamage", Dammage,
SendMessageOptions.DontRequireReceiver);
Destroy(gameObject, 1);
}
function Update () {
var translation : float = Time.deltaTime * 60;
transform.Translate(0,0,translation); //Removed the 'UnityEngine'
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612044051im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Script for activating next GameObject after first one has been found/tracked (Vuforia) 1 Answer
How can I load/save a Prefab refference? 0 Answers
[SOLVED]Removing gameobject from list don't change the index 1 Answer
Editing animation curves in a script 2 Answers
[Steamworks.NET] SteamAPI Problem help !,[Steamworks.NET] Problem 0 Answers