the_terrible

  • 16 авг 2021
  • Регистрация: 27 мая 2016

    I think I was confused and for some reason only deleted the "Runtime" folder within the "Spine" folder. Looking back at the update guide again I don't know why I thought this. I never imported the "Spine Examples" folder in the first place. And yes, I was also confused about modifying the API vs old script code.

    I deleted the project and reinstalled it and went through the update guide steps again and it seems to be working now. Thanks for the help!

    • Изменено

    I took a few months off working on a Unity project of mine which uses Spine animations but have recently tried to get back working on it. Since last working on it, I've gotten a new computer and have transferred everything to the new computer. At the same time


    and perhaps this was a mistake


    I installed the newest version of the Spine Runtime (v4.0).

    I have many CS0117 and CS1061 "does not contain a definition for..." errors all pertaining to the AttachmentTools Spine Runtime script. In reading the Spine 3.7 to 3.8 & Spine 3.8 to 4.0 Upgrade Guides here on the forums, I understand I'm supposed to replace certain lines of code, but I seem to be struggling to do this. I'm not very good when it comes to coding. The previous version of the Spine Runtime I was using was 3.7.

    As an example, one of the CS0117 errors is 'MeshAttachment' does not contain a definition for 'inheritDeform'. In the AttachmentTools script, the lines of code throwing the error are:

    public static MeshAttachment GetClone (this MeshAttachment o) {
             var ma = new MeshAttachment(o.Name) {
                r = o.r,
                g = o.g,
                b = o.b,
                a = o.a,
    
            inheritDeform = o.inheritDeform,

    According to the 3.7 to 3.8 upgrade guide, I am to replace MeshAttachment.GetLinkedClone() with MeshAttachment.NewLinkedMesh(). However, I don't see a "MeshAttachment.GetLinkedClone()". I only see "MeshAttachment GetClone" and "MeshAttachment(o.Name)". So I'm not really sure what I need to do to fix this error code.

    At the end of the day I'm really just trying to get things working like they were on my old computer. Any help would be appreciated. Thanks.

    Harald написал

    Are you using Unity 2019.3.12?

    I am using Unity 2019.3.12f1

    However, for some reason when I opened my scripts in Visual Studio today the errors no longer display. Very strange. I have no idea what would have changed between today and yesterday to cause this change. I had very recently upgraded from Visual Studio 2017 to Visual Studio 2019. Maybe just restarting my computer was all that was needed for the update to recognize the Spine directive... or something.

    • Изменено

    Visual Studio 2019 returns all sorts of errors for my scripts for Spine-related code. The scripts, however, seem to run perfectly fine and these errors don't seem to prevent the code from running. It is kind of annoying, however. It seems the "using Spine;" directive isn't being recognized? But the code seems to run fine so it must be getting recognized. Does anyone know why this is the case?

    Harald написал

    It however seems to be related to the tree's SpriteRenderers with the Spine shader material, because when I switch the tree material's shader to the Standard shader, the problem disappears.

    This is not the behavior I see. I have the trees as the 'Standard' Unity shader and the problem persists with the medkits brightening. Below are screenshots; you can see that the trees are receiving shadows so they aren't using Spine/Skeleton Lit. I have them set to 'Standard':

    I cannot reproduce this problem. I just reverted all assets to the initial state that your repro-package came with, still this issue does not occur. I only see the incorrect light/dark changes on the trees (with SpriteRenderer components), but not on the medikit, also not on the character.

    Can you show a screenshot or video of the medikit when it's in dark vs light state?

    You are right, it turns out the medkit does not change brightness in the example project I sent. However, I tried duplicating the medkit, and when there are two medkits in the scene, their brightness does change based on the positioning of the player. Similarly, in my full project this brightness change occurs in all pick-up objects except for one. I don't know why.

    The following screenshots show the water bottle on the right of the screen becoming brighter when the player shares a similar Z transform value:

    They receive proper light. I listed the necessary steps for the Spine/Sprite/Pixel Lit shader above, it seems as if you did not provide normals as described - then they will be pitch black.

    Ah okay, I thought the steps you provided were simply for receiving shadows, which I did not need. I enabled 'Fixed Normals' at the material and now the Spine/Sprite/Vertex Lit objects are receiving directional lighting. It seems this material works for the purposes I need, and the brightness issue doesn't occur. Hopefully using this instead of Spine/Skeleton Lit won't result in any surprises down the line.

    I'm curious to know what's going on with that brightness bug, though, if you figure it out. I'm surprised this isn't a common problem that occurs with other users. It makes me wonder what they are doing differently that they haven't come across this behavior, as I feel like I'm just doing some pretty standard stuff here.

    I do not see the same view- or position-dependent changes in light at the character or the medikit. They are consistently lit if I move the view or the objects around. Does this change at your machine?

    If you move the character up and down using W/S you should see the medkit brighten when the character has a similar "Z" value as the medkit. This happens to all pickup-up objects in the project.

    I see them being affected by light. If I rotate the direction of the directional light, the character gets darker and lighter depending on the angle as expected.
    Is this not the case at your machine?

    This is the case on my machine. The problem is the brightening that occurs based on the positioning of the player character. I actually use the 'Standard' Unity shader for most static objects like the trees which doesn't exhibit this behavior. I only switched the trees to Skeleton Lit to make the problem more obvious in the example project that I sent to you. The actual problem is with all pick-up objects


    all of which have imported Spine animations for their rendering


    brightening based on the positioning of the player.

    If you mean they do not receive shadows: you have to use the Spine/Sprite/Pixel Lit shader, the vertex-lit shaders will not provide shadow receiving functionality.

    I don't need them to receive shadows.

    I know that these are a lot of things that need to be set up. I think we will provide a separate documentation page section with a similar description, and/or a button in the advanced section to automatically set things up at one click (although modifications might always be needed from case to case).

    What do you think would help you most?

    Documentation would be nice, but for my purposes I just need to stop the behavior of position-based brightening. As I stated before, I just need my Spine animations to receive lighting (without the brightening bug). It appears to me that Pixel Lit and Vertex Lit do not receive directional lights, and display objects as pitch black in the scene, although I did notice they are affected by spot lights.

    When you say that Spine/Skeleton Lit is unsuitable for SpriteRenderer components, do you mean as opposed to Mesh Renderer components? Because the same thing occurs with objects using Mesh Renderer. In fact, both the player object and the medkit object in that example I sent are just imported animations from Spine. The only thing I'm really trying to achieve here is to get Spine animations to be affected by lighting in the scene.

    Also, for some reason my directional lighting doesn't seem to affect the objects I've assigned to Spine/Sprite/Vertex Lit which is an issue. The objects display as pitch black until a point light is introduced.

    Hey Harald,
    I was just wondering if there was any insight into this lighting bug since the last time you posted.
    Thanks

    Alright, I'd like to be able to simply update the "Skeleton Lit" shader in the 3.7 runtime I have installed, but I'm very unfamiliar with writing/editing shaders. As per your bug tracking entry, I replaced the line:

    clip(texcol.a - _Cutoff);

    with the following line:

    clip(texcol.a * i.vertexColor.a - _Cutoff);

    I get the error "Shader error in 'Spine/Skeleton Lit': invalid subscript 'vertexColor' at line 200 (on d3d11)". I assume I need to declare the variable 'vertexColor' but I don't know how to do that. I assume its something similar to the 'texcol' declaration.

    Okay, I sent the e-mail. As I stated in the e-mail, you'll find a medkit and a series of trees in the scene. If you approach the tree all the way to the right of the screen, it will suddenly become bright in color. Delete the medkit object and the tree darkens again. I'm very confused. As I stated earlier, you can also see the trees brightening and darkening as you move the Scene View camera around.

    • Изменено

    I'm using Unity and it seems that when a sprite or Spine animated object is using the "Skeleton Lit" material, the object's brightness suddenly changes depending on where the camera is. This not only occurs with the game camera during gameplay but with the Scene view camera outside of gameplay as well. Below are two screenshots of the Scene view camera at two different distances from the tree objects in view. All the trees are duplicate images; they shouldn't appear any different in color.

    Two trees are darker than the rest. They should all be the same color.

    As the camera pans closer some trees switch to dark and others become light.

    I only have a single, stationary directional light in this scene. I only notice this occurring with the "Skeleton Lit" material, and no other. Anyone know what could be causing this?

    Okay, I'll try that. Is the only other way to accomplish this without alpha cutoff to separate the blast animation into a separate Game Object?


    I've reduced the alpha value of the slot attachment of the blast sprite to about 50% and it's still displaying a shadow. The alpha cutoff of the skeleton_Material is set to 95%. I've tried messing with the alpha cutoff of the floor material as well and it doesn't change anything.

    • Изменено

    Hi all,

    I'm using a Spine animation in Unity and my floor mesh is set to receive shadows. It normally works great but sometimes there are certain sprites or animations I don't want to cast shadows. For example, once I fire a gun with the Spine animation, a "blast" sprite momentarily appears at the end of the barrel of the gun in the animation. In Unity, the Spine object's shadow now displays a shadow of that blast sprite indefinitely.

    I know that I can turn shadows on and off for the entire Mesh Renderer of the Spine object, but can I simply turn off shadows for specific slots of the animated object?

    Okay, thanks for the info I'll definitely check out RenderTexture. I look forward to seeing the example scene you plan on putting out 🙂

    • Изменено