public static GameObject Instantiate_And_AssignAutoVariables <T>(this T mb, GameObject original, Vector3 position, Quaternion rotation) where T : MonoBehaviour
    {
        var newObj = GameObject.Instantiate(original);

        AutoAttributeManager.AutoReference(newObj);

        return(newObj);
    }
    public static GameObject Instantiate_And_AssignAutoVariables <T>(this T mb, GameObject original, Transform parent, bool instantiateInWorldSpace) where T : MonoBehaviour
    {
        var newObj = GameObject.Instantiate(original, parent, instantiateInWorldSpace);

        AutoAttributeManager.AutoReference(newObj);

        return(newObj);
    }
Exemplo n.º 3
0
    public static T AddComponent_Auto <T>(this GameObject go) where T : MonoBehaviour
    {
        T newComponent = go.AddComponent <T>();

        AutoAttributeManager.AutoReference(newComponent);

        return(newComponent);
    }
Exemplo n.º 4
0
    private void RecursivelyReferenceChildren(GameObject go)
    {
        AutoAttributeManager.AutoReference(go);

        foreach (Transform child in this.transform)
        {
            RecursivelyReferenceChildren(child.gameObject);
        }
    }
    public static GameObject Instantiate_And_AssignAutoVariables <T>(this T mb, GameObject original) where T : MonoBehaviour
    {
        var newObj = GameObject.Instantiate(original);

        AutoAttributeManager.AutoReference(newObj);
        Debug.Log("AutoAssignment Complete");

        return(newObj);
    }
Exemplo n.º 6
0
    void Awake()
    {
        AutoAttributeManager.AutoReference(this.gameObject);

        if (alsoReferenceChildren)
        {
            foreach (Transform child in this.transform)
            {
                AutoAttributeManager.AutoReference(child.gameObject);
            }
        }
    }
Exemplo n.º 7
0
    void RunTest()
    {
        AutoAttributeManager.AutoReference(this);

        Assert.IsNotNull(myChildrenCollidersArr);
        Assert.IsNotNull(MyChildrenCollidersArr);
        Assert.AreEqual(1, myParentCollidersArr.Length);   //Parent of this object has one collider
        Assert.IsNotNull(myChildrenCollidersList);
        Assert.IsNotNull(myLight);                         //Child has light component
        Assert.AreEqual(2, myChildrenCollidersArr.Length); //This gameobject has 2 children colliders
        Assert.AreEqual(2, MyChildrenCollidersArr.Length); //This gameobject has 2 children colliders
        Assert.AreEqual(2, myChildrenCollidersList.Count);
    }
 private static void DestroyAutoAttributeManager(AutoAttributeManager autoAttributeManager)
 {
     GameObject.DestroyImmediate(autoAttributeManager);
     EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
 }