Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"GetOrAddComponent()" function does not exist in a base Unity 2021.3 LTS install #3

Open
ByteSz opened this issue Mar 4, 2025 · 1 comment · May be fixed by #4
Open

"GetOrAddComponent()" function does not exist in a base Unity 2021.3 LTS install #3

ByteSz opened this issue Mar 4, 2025 · 1 comment · May be fixed by #4

Comments

@ByteSz
Copy link

ByteSz commented Mar 4, 2025

Hey, trying to use the plugin in Unity 2021.3 LTS and it's giving the error that the GetOrAddComponent<>() function does not exist. With a little bit of research, this is a GameObject & Transform extension method, and is not part of a Unity 2021.3 LTS base install. These errors are on lines 170 & 181 of the "LibreFracture.cs" script.

I made a quick fix on my end by replacing each of these with "GetComponent<>()" & "AddComponent<>()" calls as needed (checking of course if we got the component before calling AddComponent) and this seems to work just fine.

As a side note, really love the library so far! Using it on a large project. I'd love to help contribute/maintain the project as well if you're open to it.

@HunterProduction HunterProduction marked this as a duplicate of #1 Mar 6, 2025
@HunterProduction
Copy link
Owner

HunterProduction commented Mar 6, 2025

Hello! First of all thanks for the interest on this tool!

I am aware of this little problem of compatibillity, I used that short utility method just for ease of use, but your solution to fix it should be more than enough.
I'll try to find some time to wrap these simple fixes in a new release, but for now thanks for noticing it!

@ByteSz ByteSz linked a pull request Mar 8, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants