Skip to content

Swift Compiler Error (Xcode): Value of type 'UnityAppController' has no member 'unityMessageHandler' #920

Open
@iamtobgay

Description

@iamtobgay

Describe the bug
Tried to build and run the following example code :

import 'package:flutter/material.dart';
import 'package:flutter_unity_widget/flutter_unity_widget.dart';

void main() {
  runApp(
    const MaterialApp(
      home: UnityDemoScreen(),
    ),
  );
}

class UnityDemoScreen extends StatefulWidget {
  const UnityDemoScreen({Key? key}) : super(key: key);

  @override
  State<UnityDemoScreen> createState() => _UnityDemoScreenState();
}

class _UnityDemoScreenState extends State<UnityDemoScreen> {
  static final GlobalKey<ScaffoldState> _scaffoldKey =
      GlobalKey<ScaffoldState>();
  UnityWidgetController? _unityWidgetController;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      key: _scaffoldKey,
      body: SafeArea(
        bottom: false,
        child: WillPopScope(
          onWillPop: () async {
            // Pop the category page if Android back button is pressed.
            return true;
          },
          child: Container(
            color: Colors.yellow,
            child: UnityWidget(
              onUnityCreated: onUnityCreated,
            ),
          ),
        ),
      ),
    );
  }

  // Callback that connects the created controller to the unity controller
  void onUnityCreated(controller) {
    _unityWidgetController = controller;
  }
}

got the following errors :

Swift Compiler Error (Xcode): Value of type 'UnityAppController' has no member 'unityMessageHandler'
**Swift Compiler Error (Xcode): Value of type 'UnityAppController' has no member 'unitySceneLoadedHandler'
**

Unity (please complete the following information):

  • OS: MacOS 14.2.1 (23C71)
  • Version 2022.3.16f1

Smartphone (please complete the following information):

  • Device: iPhone 13pro
  • OS: iOS17.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions