Best practice for modifying a class like ActionPanel

thanawat

New member
Hi there,

I have a question.
What is the best practice for modifying a class like ActionPanel and others classes in the Opsive namespace that will not affect the UIS new release update?
Ex. If I want to update UIS and I have to delete the Opsive folder I don't want those modified classes affected.

Actually, I wanna comment(delete) a code on line 85 m_ItemActionButtons[0].Select(); but I don't wanna modify ActionPanel class.

Please advice.
Thank you in advance.
 
The best way is to create a custom class and override the function.
This way even if you update the asset, your custom code won't be overriden by our changes.

In this specific use case it would require you to copy paste a fair amount of code since the OpenInternal function does a few things.

So I'll add an option for you so you don't have to worry about it:

I added this at the top
Code:
[Tooltip("Select the first button on open")]
[SerializeField] protected bool m_SelectFirstButtonOnOpen = true;

And I added this if function in the function
Code:
if (m_SelectFirstButtonOnOpen && m_ItemActionButtons!= null && m_ItemActionButtons.Count > 0) {
    m_ItemActionButtons[0].Select();
}
 
I was about to ask you to add that variable.

Actually, I wanna make the ItemAction without interactable(show only) that is why I need to comment on that line of code. Because when an item is selected and the ActionPanel showed up. It lost focus and the m_SelectedSlot became null.

It is working now.
Thank you so much for the suggestion.
 
Last edited:
Top