Is it possible to leave a comment on components like prefabs?
Hi! Is it possible to leave a comment on some components e.g. like prefabs? I'm a programmer and different sensors and other stuff that is used in code is pretty obvious to me, at least I can leave some comments for myself in code, but the artist often wonders of what is it I created in the project? I need to leave comments for him. I see it like this: he clicks on some sensor prefab and sees a text like "this sensor is used where the player should be able to climb up the wall" or "this sensor is placed where the player needs to slide down the slope" or stuff like that. Is it possible somehow? What is the best way to leave "notes" like this in unity?
Thanks!
Answer by Mmmpies · Jun 03, 2016 at 06:18 AM
As long As it's a brief description you could just add a readme.cs script with a tooltip in it (or add a readme section to any script attached to the prefab).
They should see that in the inspector:
[Space(10)]
[Header(" [Readme]")]
[Tooltip("IUsed as a hand grip location for wall climbing.")]
[Space(10)]
So, is it only possible for the objects that have scripts attached? Doesn't seem to be what I'm looking for
The script probably doesn't have to do anything though. Can't really test this as I don't have access to Unity right now.
Create a CS script, call it PREFABNA$$anonymous$$E-Readme.cs and clear out everything apart from the using and class name. Replace that PREFABNA$$anonymous$$E with the actual name of the prefab (so you get a unique one for each prefab) and put in the header line
[Header("This prefab does a thing but I'm not saying what!")]
put it on the prefab and see if it shows up in the inspector. So no Start() or Update(), no code of any kind just a Header line. I think it should work without any real impact on game performance.
Yep. This works. But it's all in one line. Is there a way to add a multiline header? Anyway, thanks for this!
Again I can't check, it might respond to an escape key but more likely it won't so the simplest way would just to have multiple Header lines. I doubt it's got intelligence built in to expect a variable under the header before the next header.
It's kind of strange Unity does not have such a trivial functionality. I think it'd be great to be able to use something like this: Inspector - Add Component - Comment Block, and so this block would be visible after one selects any object
Your answer
Follow this Question
Related Questions
Why won't script work on 3d text? (menu script) 1 Answer
Disabling a script while pressing a key down 2 Answers
Create a clone without components at runtime 0 Answers
Use of if(Component) 1 Answer