Hi …
sorry for this question …
I’m coding by Java for a long time . but I’d like to try C# coding.
so I made a mini example (sending a Void from script to other and show an object)
my problem …
when the second script receive the “LoadModal” Void will do "
- print (“a”);
- ShowModal = true;
then will stop
- SpiderMan.SetActive(true); // not working
- print (“b”); // not working
Note :
when press on the Button “SpiderMan” will show the model .
First Script
private ObjectManager _object = new ObjectManager();
void SendObject(string modal )
{
_object.LoadModal(modal);
}
Second Script
public GameObject SpiderMan;
public void LoadModal(string modal)
{
if (modal == "SpiderMan")
{
print ("a");
ShowModal = true;
SpiderMan.SetActive(true);
print ("b");
}
}
void OnGUI()
{
if ( ShowModal )
{
if (GUI.Button (new Rect (0, 0,100, 50), "SpiderMan"))
SpiderMan.SetActive(true);
}
}
please where is my wrong ?
Thanks…