UnityNinja Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UnityNinja CommunityLog in

UnityNinja - Video Game Development Community, including Resources, Forums, Marketplace & More.


descriptionChanging Variables from different script (SendMessage) EmptyChanging Variables from different script (SendMessage)

more_horiz
Hi everyone! Today you are going to learn how to send messages to another script/gameobject.
so what you want is to change this variable A from 0 to 1.
So you want to send it to a player transform/gameobj

Code:

var playerobj : Transform;
function Start() {
   playerobj.SendMessage("WhatCoroutineNameIs",1,SendMessageOptions.DontRequireReciever);
}
2nd Script
var A = 0;
function WhatCoroutineNameIs(mynum : int) {
   A += mynum;
}


That is the basics of SendMessage! Thanks for reading. please leave a comment of what tutorial i should do next!
Thx Wooden

descriptionChanging Variables from different script (SendMessage) EmptyRe: Changing Variables from different script (SendMessage)

more_horiz
Hey wooden_sword thanks for sharing your mini tut! I fixed it, but please in the future when you put code at the start and the end use these tags: [c ode][/cod e] (but w/o spaces) or just press the code button when making a post.

descriptionChanging Variables from different script (SendMessage) EmptyRe: Changing Variables from different script (SendMessage)

more_horiz
Ok thanks for the help MisterNinjaBoy
~Wooden

descriptionChanging Variables from different script (SendMessage) EmptyRe: Changing Variables from different script (SendMessage)

more_horiz
I am So EXTREMELY sorry for my long absence and not coming on unityninja! please forgive me?
~sincerely wooden

descriptionChanging Variables from different script (SendMessage) EmptyRe: Changing Variables from different script (SendMessage)

more_horiz
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply