Closed cevanno closed 3 years ago
Can you send me a simple scene that reproduces the issue?
I will take a look
Note: Just the scripts, the scene and the prefab
sure. Not sure best way to send privately so posting here. This small project lets you click mouse on the cube in the scene to place an object at the hit point. You will see the new object instantiated in the Hierarchy. This works as is. But the Outliner component is disabled on the Marker prefab (sorry, for clarity I thought changing the instantiated object to this marker was easier to get the point across). Stop the play and enable the Outliner component on the Marker prefab and run again. You will see the error. SurfaceLineMaker-stdpipe.zip
Ok so the reason why it's crashing and it won't work is because you don't have a MeshFilter component on the one you're trying to use the outline.
The outline will not show if there is no object being rendered.
In your case you need to add the Outline component to the "Marco" or "Vidrio" objects instead of "Marker"
Wow thanks. This error doesn't seem too noob crazy for a user so a try catch when you get the meshfilter would give the opportunity to report the error in a log and assist integrators.
The problem is that you don't need a MeshFilter in some cases like for adding an Outline to a SpriteRenderer so I can't throw an error if there is no MeshFilter.
But I added a check and it doesn't crash anymore in the latest commit :)
Just downloaded this and have run into a (hopefully) noob issue. I put the Outline script on a simple cube (with OutlineEffect on Main Camera) and it works. Can toggle the effect easily. Then I put the Outline script on the same cube as a prefab that is instantiated at runtime and in its construction process (when Instantiate() is called) I get this unhandled exception: NullReferenceException: Object reference not set to an instance of an object cakeslice.OutlineEffect.OnPreRender () (at Assets/OutlineEffect/OutlineEffect/OutlineEffect.cs:228)
I assume this is a timing or order of construction issue because that line of code accesses objects created by the component. Any suggestions?