flame-engine / flame

A Flutter based game engine.
https://flame-engine.org
MIT License
9.29k stars 913 forks source link

Paint.isAntiAlias is null while loading flare animation with flame #421

Closed HesterS closed 4 years ago

HesterS commented 4 years ago

I am creating an application for android and am getting the following error when trying to play a flare file made with svg images:

E/flutter ( 1413): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: Failed assertion: boolean expression must not be null E/flutter ( 1413): #0 Paint.isAntiAlias= (dart:ui/painting.dart:1114:25) E/flutter ( 1413): #1 FlutterColorFill.update (package:flare_flutter/flare.dart:401:9) E/flutter ( 1413): #2 ActorArtboard.advance (package:flare_dart/actor_artboard.dart:327:21) E/flutter ( 1413): #3 FlareAnimation.load (package:flame/flare_animation.dart:28:14) E/flutter ( 1413): E/flutter ( 1413): #4 new FlareComponent (package:flame/components/flare_component.dart:14:20) E/flutter ( 1413): #5 Test._start (package:flutter_app/Test.dart:52:22) E/flutter ( 1413): #6 new Test (package:flutter_app/Test.dart:22:5) E/flutter ( 1413): #7 main (package:flutter_app/main.dart:18:15) E/flutter ( 1413): E/flutter ( 1413): #8 _runMainZoned.. (dart:ui/hooks.dart:247:25) E/flutter ( 1413): #9 _rootRun (dart:async/zone.dart:1190:13) E/flutter ( 1413): #10 _CustomZone.run (dart:async/zone.dart:1093:19) E/flutter ( 1413): #11 _runZoned (dart:async/zone.dart:1630:10) E/flutter ( 1413): #12 runZonedGuarded (dart:async/zone.dart:1618:12) E/flutter ( 1413): #13 _runMainZoned. (dart:ui/hooks.dart:239:5) E/flutter ( 1413): #14 _startIsolate. (dart:isolate-patch/isolate_patch.dart:301:19) E/flutter ( 1413): #15 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12) E/flutter ( 1413): I/urg.flutter_ap( 1413): ProcessProfilingInfo new_methods=624 is saved saved_to_disk=1 resolve_classes_delay=8000 Lost connection to device.

Here is an example code that gives this error message:

import 'dart:ui'; import 'package:flame/gestures.dart'; import 'package:flame/game.dart'; import 'package:flame/components/flare_component.dart'; import 'package:flutter/material.dart'; class Test extends BaseGame with TapDetector, DoubleTapDetector { FlareComponent flareComponent; Test() { _start();

} @override void onTap() { } @override void onDoubleTap() { flareComponent.width += 10; flareComponent.height += 10; flareComponent.x -= 10; flareComponent.y -= 10; } void _start() async { flareComponent = FlareComponent("assets/images/animations/animaton.flr", "animation_name", 306, 228); flareComponent.x = 50; flareComponent.y = 240; add(flareComponent); } @override void render(Canvas canvas) { super.render(canvas); } void update(double t) { super.update(t); } }

I have been unable to find out what is causing this error so I hope you could help me.

erickzanardo commented 4 years ago

Please, use markdown when share stacktrace or code, it is so much more better to read and by not doing so, this issue just referenced a bunch of pull requests and issues that have nothing to do with this issue.

@renancaraujo can you help here?

renancaraujo commented 4 years ago

This was due to a new feature introduced on flare_flutter 2.0.5. The new implementation of the integration between Flare and Flame is compatible with that change.

HesterS commented 4 years ago

Thank you very much! Ik will try this next week.

Op ma 10 aug. 2020 20:37 schreef Renan notifications@github.com:

This was due to a new feature introduced on flare_flutter 2.0.5. The new implementation https://github.com/flame-engine/flame_flare of the integration between Flare and Flame is compatible with that change.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/flame-engine/flame/issues/421#issuecomment-671519937, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLHWROEARI3YCYQ6Q5LE7TSAA46BANCNFSM4O36Y64Q .

erickzanardo commented 4 years ago

The new package is released and flame 0.25.0 has the old Flare implementation deprecated. closing this.