Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - viri

Pages: [1]
1
TNet 3 Support / Re: Custom Object Creation functions (1.8.0+)
« on: February 22, 2015, 09:02:56 PM »
It would be kinda nice to have immediate access to the gameobjects. Kindof like
  1. class SpawnerButton :MonoBehavior
  2. {
  3.          void OnMouseDown()
  4.          {
  5.                 GameObject go=TNManager.Create ("Token",Vector3.zero,Quaternion.identity,false);
  6.                 Random r=new Random();
  7.                 //yield new WaitForSeconds(1);
  8.                 go.GetComponent<Token>().SetName("Random name "+r.Next(100).ToString());
  9.          }
  10. }
  11.  

  1. public class Token:TNBehavior
  2. {
  3.         public void SetName(string newname)
  4.         {
  5.                 tno.Send ("SetNameRFC",Target.AllSaved,newname);
  6.         }
  7.         [RFC]
  8.         public void SetNameRFC(string newname)
  9.         {
  10.                 name=newname;
  11.         }
  12. }
  13.  


Pages: [1]