Hello, I’am new to all the scripting languages that unity uses, so I would ask if someone maybe knew how to make a script that will do the following:
When I click on an in-game object (such as a box) (A hotkey would also work), it should change the speed of the player to something like 12 (I’am using the standard ‘Character Controller’).
The “property” to change the speed is:
First Person Controller>Character Motor (Script)>Movement>Max Forward Speed
I know other scripting languages, so I’am able to understand most scripts
The hard part is actually detecting the click. This is a C# example for a hotkey…
//Step One - Detect The Key Being Pressed...
//Now, get the 'Character Motor' component from our object (I'm assuming that this script is on the object you want to control)
CharacterMotor Mtr = GetComponent<CharacterMotor>();
//And change the maximum forward speed
Mtr.movement.maxForwardSpeed = 12;
The intellisense will really help you here - once you have your CharacterMotor object, just type ‘Mtr’ followed by a period (.) and all of the options and members of this particular object will appear.
If you are going to script in Unity, make sure you are quite comfortable with one of the main languages (my personal preference is C#).