Hey, this is my first time using unity and I’m very happy with the power it has.
I’m just not very good in JavaScript nor on C# nor on Boo, but I do program in C++ and Ruby. I just have a question about at least one of those languages…
How do you call components or scripts in Js, C# or Boo?
In C++ or C, you can call a function or a script like “MyFunction(parameter1, parameter2, parameter 3);”
I have already seen this page: http://unity3d.com/support/documentation/ScriptReference/GameObject.GetComponent.html
but I can’t manage to understand how to tell the script what parameters to change.
I’m making a 2d platformer game in Unity and it’s like 3d world constrained to 2d movement and pure 2d player (textured plane) to simulate sprite.
And I want to make the sprite to change if I press the left/right arrow or press A key to jump or D to do a dash. I have this script:
And I want to call it changing uvAnimationTileX, uvAnimationTileY and framesPerSecond, also changing “_MainTex” to something else:
renderer.material.SetTextureOffset (“_MainTex”, offset);
renderer.material.SetTextureScale (“_MainTex”, size);
Is this possible?
This is two questions (how to call component functions, how to animate texture tiling). Could you split the second question off please?
– Waz