Hello, I want to use this asset in conjunction with another one and I have compatibility problems between them, will there be any solution for this. I have tried to solve the errors that the console shows me in Unity, but I don't have good results.
top of page
bottom of page
Hi!
This problem is probably due to the existence of a class called "Type" in your project.
Since we wrote the "System.Type" class as "Type" without specifying the "System" package in a lot of code, ambiguity occurred and the above error occurred.
This is our fault for not taking into account conflicts with users' project's code.
We are very sorry.
We'll remove this ambiguity in the next update we're working on, but for now, you'll have to use one of the three methods you can take to fix this issue.
Note that.
Since we don't know what other assets you're using, this answer assumes you can modify the script code in which a class named "Type" appears.
So, we would appreciate it if you could understand that "Your Code" in our answer refers to both the script code you write and the code of other assets without distinguishing them.
1. Replace "Type.." code in AnyPortrait with "System.Type".
As shown in the image above, open the code in which the error occurred through the error log where the problem is reported in the console window, then change the "Type" code to "System.Type".
This will fix the error.
A caveat is, you shouldn't replace this problem in batches with a feature like "Replace All" in the IDE.
If you conveniently change the universal word "Type" in a batch, there is a high chance that another error will occur.
Anyway, we do not recommend this method.
In fact, this is the way we should take it, and it requires too many code fixes for users to do.
2. Rename the class "Type" in your code.
Depending on how many times the class "Type" is used in your code, this may or may not work.
If you don't see many of your classes called "Type" in your project, renaming this class might be a good idea. (e.g. "Type" > "myGameType")
In particular, using common class names that appear in "UnityEngine" or "System" packages such as "Type" may cause conflicts with packages other than AnyPortrait.
3. Use the namespace.
This would be a much more efficient way.
Encapsulating code like a package using namespaces.
Prevent external references to your "Type" class by using namespaces like the following code:
namespace myGame
{
public class Type {...}
}
And add the code below to the top of other .cs script files where your "Type" class is used.
using myGame;
Then your "Type" class will not be referenced by any external package (such as AnyPortrait for example).
As we said earlier, this issue will be addressed in our next update.
Fortunately, our long update work is currently being finalized and will be uploaded to the Asset Store soon.
However, if you want to fix the error right now, please refer to the above methods.
If you are unable to edit the script, please wait for the update to complete.
If the problem is not resolved, please leave a comment.
Thank you.