Skip to content

Latest commit

 

History

History
46 lines (35 loc) · 849 Bytes

File metadata and controls

46 lines (35 loc) · 849 Bytes

UEA0015: InstantiateTakeParent

Property Value
Id UEA0015
Category Performance
Severity Warning
Version 5.4 ->

Example

Code with Diagnostic

using UnityEngine;

class ExampleC : MonoBehaviour
{
    GameObject prefabObject;
    GameObject newParent;

    void Update()
    {
        var newGameobject = Instantiate(prefabObject, Vector3.zero, Quaternion.identity);
        newGameobject.transform.SetParent(newParent.transform, false);
    }
}

Code with Fix

using UnityEngine;

class ExampleC : MonoBehaviour
{
    GameObject prefabObject;
    GameObject newParent;

    void Update()
    {
        var newGameobject = Instantiate(prefabObject, Vector3.zero, Quaternion.identity, newParent.transform);
    }
}