Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

Experiencing strange issue changing a SpriteRenderer's sprite at runtime.

$
0
0
I'm getting error messages when trying to change a SpriteRenderer's sprite at runtime. The error doesn't seem to make any sense. Here's the line that is producing the error: myRenderer.sprite = Skirt_UDLR; myRenderer is a variable of type SpriteRenderer that is properly assigned in Start(). myRenderer = GetComponent(); Skirt_UDLR is a public variable of type Sprite in my code that has been properly assigned with a Sprite in the inspector. So, in theory, there's no reason the code shouldn't work, yet I'm getting this error in debug: NullReferenceException UnityEngine.SpriteRenderer.set_sprite (UnityEngine.Sprite value) (at C:/BuildAgent/work/d3d49558e4d408f4/artifacts/EditorGenerated/SpritesBindings.cs:176) But this error has nothing to do with **my** code, I don't think, as it's an error with a base Unity script. Anyone know what's going on here?

Viewing all articles
Browse latest Browse all 7934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>