- Home /
more Burgzerg Blues
Unity is having trouble with one script, both of these seem to be doing the same thing, but I'm not sure which one needs to go.
public struct ModifyingAttribute
{
public Attribute attribute;
public float ratio;
}
public ModifyingAttribute(Attribute att, float rat)
{
Debug.Log("Modifying Attribute Created.");
attribute=att;
ratio= rat;
}
The debug command cannot exist is a struct. Which one needs to stay and why? Thanks!
Comment
Best Answer
Answer by Berenger · Mar 09, 2012 at 06:49 AM
public ModifyingAttribute(...) is a constructor and needs to be declared and implemented inside the struct scope.
I don't understand... Please explain and forgive my newbieness.
That's what you need to do :
public struct $$anonymous$$odifyingAttribute { public Attribute attribute; public float ratio; public $$anonymous$$odifyingAttribute(){} public $$anonymous$$odifyingAttribute(Attribute att, float rat) { Debug.Log("$$anonymous$$odifying Attribute Created."); attribute=att; ratio= rat; } }
Your answer
Follow this Question
Related Questions
All Arrayinstances get changed -1 Answers
Struct for holding Class Parameters 0 Answers
How -exactly- do classes and structs work in Unity? 0 Answers