- Home /
What is wrong with this, please? - cant spot my mistake..
function Update ()
{
transform.Find("object").GetComponent(Object_rotate).turnSpeed = 100;
}
This is calling my GameObject, called "object".
Hierarchy like this,
- Slider - script one.
- Object_slide
- object - Object_rotate.js
And it is trying to call,
var turnSpeed = 0;
function Update () {
sPin = Time.deltaTime * turnSpeed;
transform.Rotate(Vector3.up * sPin);
}
Answer by Uniquesone · Aug 26, 2011 at 09:39 AM
And whats the problem with this? Doesnt it work? any errors?
Well first you shouldnt call your objects, objects.. this may confuse the system.
Second: you should save your result in a variable and then access to it
Woops, yeah i should have mentioned. It was a Null issue.
And yeah, 'object' is just for the sake of these test scripts, but it was one of the first things that i checked.
And the results need to be realtime, because it will be for control from a slider, was just testing it with a set figure because i wanted to make sure it worked first.
Thanks for your help though, much appreciated. =)
Your answer
Follow this Question
Related Questions
Why can't I change another script's variable with this script? Thanks, 1 Answer
Neater way to test an Enum in a different script? 1 Answer
Cannot get script component while the game object has a refered script 1 Answer
How to Get TextMesh component from the Gameobject the script is attached to? 3 Answers
Reference from another script Help? 1 Answer