C
C#9mo ago
Slazmaz

Passing parameters to overloaded constructor

How would I pass the texture2D variable to be handled in the second constructor. Obviously return does not work but that is what I would do if it is was an overloaded function and not a constructor.
No description
5 Replies
ben SKVU4-9YBC
ben SKVU4-9YBC9mo ago
public Sprite(...) : this(...)
Slazmaz
SlazmazOP9mo ago
but that wouldn't allow me to pass the new texture2d variable?
ben SKVU4-9YBC
ben SKVU4-9YBC9mo ago
sure it would. public Sprite(string texture, ...) : this(Assets.Textures[texture], ...) {}
Slazmaz
SlazmazOP9mo ago
oh yea that did the trick, thanks!
ben SKVU4-9YBC
ben SKVU4-9YBC9mo ago
no problem
Want results from more Discord servers?
Add your server