Ниже приведена функция, которую выполняет кнопка, и функция для создания кнопки (в этом порядке)
Код: Выделить всё
public void makeProgram(int i, Button button)
{
GameObject obj = Instantiate(ProgramObject, programHolder);
programs.Add(obj.GetComponent
());
obj.GetComponent().gameManager = this;
obj.GetComponent().localPosition = button.transform.localPosition;
Destroy (button.gameObject);
}
public void makeButton(int i)
{
Button button = Instantiate(ProgramBuyButton, programHolder)
.GetComponent();
button.name = i+"";
button.GetComponent().localPosition = Tools.makeProgramPosition(i - 1);
button.onClick.AddListener(() => makeProgram(i, button));
}
Код: Выделить всё
// now issue the enter call up to but not including the common root
Transform oldPointerEnter = eventData.pointerEnter?.transform;
eventData.pointerEnter = currentPointerTarget;
Ошибка:
Код: Выделить всё
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Object+MarshalledUnityObject.TryThrowEditorNullExceptionObject (UnityEngine.Object unityObj, System.String parameterName) (at :0)
UnityEngine.Bindings.ThrowHelper.ThrowNullReferenceException (System.Object obj) (at :0)
UnityEngine.GameObject.get_transform () (at :0)
UnityEngine.InputSystem.UI.InputSystemUIInputModule.ProcessPointerMovement (UnityEngine.InputSystem.UI.ExtendedPointerEventData eventData, UnityEngine.GameObject currentPointerTarget) (at ./Library/PackageCache/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs:476)
UnityEngine.InputSystem.UI.InputSystemUIInputModule.ProcessPointerMovement (UnityEngine.InputSystem.UI.PointerModel& pointer, UnityEngine.InputSystem.UI.ExtendedPointerEventData eventData) (at ./Library/PackageCache/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs:402)
UnityEngine.InputSystem.UI.InputSystemUIInputModule.ProcessPointer (UnityEngine.InputSystem.UI.PointerModel& state) (at ./Library/PackageCache/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs:352)
UnityEngine.InputSystem.UI.InputSystemUIInputModule.Process () (at ./Library/PackageCache/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs:2257)
UnityEngine.EventSystems.EventSystem.Update () (at ./Library/PackageCache/com.unity.ugui/Runtime/UGUI/EventSystem/EventSystem.cs:530)
Подробнее здесь: https://stackoverflow.com/questions/791 ... t-has-been