Hızlı yanıt: kod örneği
Your issue is with the line that reads .Your class inherits from and like the error states, you are not allowed to create a using the keyword, but you can add MonoBehaviours via the AddComponent() Method.You have two primary courses of actions
var instance = new ApiPost();
ApiPost
Monobehaviour
MonoBehaviour
new
- Remove the inheritance from in your first line. Instead of
Monobehaviour
just usepublic class ApiPost : MonoBehaviour
.public class ApiPost
- Restructure the base of your code to create your instance in a different way. You can
ApiPost
the object it is attached to,Instantiate
the object, or a different Method. For example you could access by attachingGetComponent
toApiPost
and then call:ApiGameObject
var instance = ApiGameObject.GetComponent<ApiPost>();