Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

"SuperTextMesh is not a Unity Component" error

A topic by draque created Jul 24, 2024 Views: 96 Replies: 4
Viewing posts 1 to 5
(2 edits)

I'm trying to manipulate SuperTextMesh objects in code, but running into issues with the object types not being recognized. I'm fairly new to Unity and feel like I must be missing something pretty simple in regard to having SuperTextMesh be recognized in the main assembly, but am kind of scratching my head here. I have already imported it into Unity and am able to use SuperTextMesh objects in the scene editor, but when I pass them as objects into scripts and try to snag them like this:

public dialogText;

. . .

var Text = dialogText.GetComponent<SuperTextMesh>();

I'm given the error "SuperTextMesh is not a Unity Component"

I have watched the tutorial video, and at the linked time, it shows the object being used without issue. I don't believe that I missed any steps in the manual for installation, so I am wondering whether there's something else that might be wrong?

video at 159 seconds

Could someone walk me through this one? I have looked through the installation and do not see anything there mentioning this. Any assistance much appreciated! : )

Ok... replying to my own post here with what I believe is the correct answer. If this is correct, it might be good to include in the installation instructions. I know this is pretty basic, but for anyone new to Unity, it might be pretty esoteric.

  1. I went to Assets/ClavianSuperTextMesh/Scripts
  2. right click->Assembly Definition and name it SuperTextMesh
  3. Go to the Assets/Scripts folder
  4. Select Main assembly file (NOT script named main, but the file with a puzzle piece)
  5. Add a new Assembly Definition in the Inspector
  6. Set new Assembly Definition to SuperTextMesh

If this is the wrong way to go about it, please let me know. This seems to be what it needed, though.

Developer

Huh, that's quite strange... Super Text Mesh should intentionally not use a namespace... even though it's technically a bad practice, I wanted it to be able to be imported into any script without needing to import it.

If I had to guess, I think the assembly definition in your scripts folder just didn't know about SuperTextMesh... Assembly definitions are a bit of an advanced feature in Unity, relatively speaking... Did a tutorial have you put that there, or was it there by default? I may be behind on a few Unity versions, so please let me know if that's a new default feature in Unity I need to account for in my assets...


Additionally, I'm just assuming that it's pseudo-code, but try defining the declaration like this:


public SuperTextMesh superTextMesh;

That way, you'll immediately be able to know if the type is recognized, and you can drag the component into that field in the Unity inspector, instead of using GetComponent(); (You said you were new to Unity, so I feel this is worth mentioning! It took me a while to realize you could do this at first)

The code you have there would have given the same error, as it did end up being an assembly definition error. I have my game itself within a namespace, and manually define the assemblies that are included (this lets me keep my builds super lean) and might be the cause of it.

Developer

That's probably just it, then! Not a bad idea!