Suppose I have a class Foo and some member data that I wish to encapsulate in a struct Bar, like so:
Code (csharp):
- using UnityEngine;
- using System.Collections;
- public class Foo : MonoBehaviour
- {
- public struct Bar { public int a; public float b; }
- public Bar m_bar;
- }
Is there a way for me to make the members of m_bar editable through the Inspector of Foo?
---------------------------------------------------------
Want to re-resurrect, I have also gotten this to work, I got allot of errors, but I copy and pasted your code, swapped some stuff, deleted your code and put in my own and it works,
EDIT: I would also like to note that structs in structs work also, very good for organization!
ref : https://forum.unity.com/threads/how-do-i-make-member-structs-accessible-in-the-editor.36395/
반응형
'게임엔진(GameEngine) > Unity3D' 카테고리의 다른 글
유니티 UI 버튼 PointerDown, Up 스크립트로 받아오기 (0) | 2018.10.12 |
---|---|
how to make a transparent color with CreatePrimitive (0) | 2018.10.08 |
Physics.BoxCastAll (0) | 2018.10.08 |
How to get a List<> from GetComponents? (0) | 2018.10.07 |
Can Rigidbody 2D collide with 3D Colliders? (2D, 3D Collision) (0) | 2018.08.04 |