Example #1
0
        public void SyncVarAttributeTest()
        {
            SyncVarAttribute attrib = new SyncVarAttribute();

            Assert.That(string.IsNullOrEmpty(attrib.hook));

            attrib.hook = "foo";

            Assert.That(attrib.hook.Equals("foo"));
        }
Example #2
0
    public void GetSyncVars()
    {
        svlist.Clear();

        MonoBehaviour[] sceneActive = GameObject.FindObjectsOfType <MonoBehaviour>();

        foreach (MonoBehaviour mono in sceneActive)
        {
            Type        monoType     = mono.GetType();
            FieldInfo[] objectFields = monoType.GetFields();

            for (int i = 0; i < objectFields.Length; i++)
            {
                SyncVarAttribute attribute = Attribute.GetCustomAttribute(objectFields[i], typeof(SyncVarAttribute)) as SyncVarAttribute;
                if (attribute != null)
                {
                    svlist.Add(new SyncVars {
                        name = objectFields[i].Name, classInstance = mono.GetComponent(mono.GetType()), FI = objectFields[i]
                    });
                }
            }
        }
    }
        public void SyncVarHookDefaultsToEmpty()
        {
            var attrib = new SyncVarAttribute();

            Assert.That(string.IsNullOrEmpty(attrib.hook));
        }