Example layout:
public class SomeClass : MonoBehaviour {
private struct SomeData
{
private Transform obj;
SomeData(Transform t)
{
if (t.parent == transform) <------ Cannot access "transform"
obj = t;
else
// throw an error
}
}
}
I want to access the Transform that this Script is attached to as I need to make sure that the Transform that’s passed into the Struct’s constructor is a Child of the Transform that the Script is attached to (hope that makes sense).
Note:
I’ve tried adding a public Property to the Class, but the Struct still has no access to it:
// within the Class specified above
public Transform GetTransform { get { return transform; } }
Any help is very much appreciated.