I'm VERY new at programming in unity and it really is not my forte. But I really need help with this.
I need help making a code that will change places with two game objects (8 in total all need to be able to switch with eachother) I want to use the mouse left key click to work.
All I got this far is:
void OnMouseDown ()
{
transform.position = otherObject.transform.position;
}
but this doesn't do anything.. please help! :)
For
OnMouseDown()
message to work you have to attach aCollider
component. Go toComponent->Physics
menu and select a collider that fits your object. Most likely you want to use aBox Collider
.To switch objects you can do this: