コード例 #1
0
        internal static void ApplyPrefabAddedComponent(object userData)
        {
            ObjectInstanceAndSourcePathInfo info = (ObjectInstanceAndSourcePathInfo)userData;

            if (!PrefabUtility.PromptAndCheckoutPrefabIfNeeded(info.assetPath, PrefabUtility.SaveVerb.Apply))
            {
                return;
            }
            PrefabUtility.ApplyAddedComponent((Component)info.instanceObject, info.assetPath, InteractionMode.UserAction);
            EditorUtility.ForceReloadInspectors();
        }