question is above
I assume that you mean the button is on the scene. Like an object as part of your level. You will need a BUTTON component on the button object. Also a SCRIPT and RIGIDBODY component on the platform. In RIGID BODY, put IsKinetic to true.
Here’s an example:
Public bool IsActive = false;
Public float moventSpeed = 10;
Void update()
{
If(IsActive)
{
transform.Translate(Vector3.right * movementSpeed * Time.deltaTime);
}
}
// Don't forget public. It's the way to access in editor
Public Void ActivatePlatform(IsActive)
{
IsActive = !IsActive;
}
Make this button usefull!.. On the button componenent, go to OnClick. Click on + , it will drop down a list off what you need. … On the drop down menu, select the script attached on the platform. A parameters will be available. That’s the ActivatePlatform function we have created. And it will toggle the parameter IsActive.
Thanks