When deploying to Android, I've noticed an issue where videos won't play unless they're set to 'PlayOnAwake' in their properties box.
Our first scene in our game is of a video file, showing our company logo. I have a custcene on start set up to play the video and to wait till it's finished before loading up the next scene.
The game plays fine in the Unity editor but the game is jut a black screen after the Unity splash screen when deployed to Android. Nothing ever happens.
HOWEVER, if I set the video clip to 'PlayOnAwake' it plays the video correctly.
It's as if the Android build isn't reading any of the AC scripts when it loads so doesn't play the video when called.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
When playing videos on Android, AC relies on Unity's Heldheld.PlayFullScreenMovie function.
Movie files in on this platform need to be placed in a StreamingAssets folder, and then their filepath entered into the Action.
Hi Chris...How do we know their file path? Do you mean a local path, such as G:/Unity Project/Assets/Videos?
IIRC it's relative to the StreamingAssets folder.
It's the first parameter in the function above - see Unity's doc page for details on its usage, which includes an example.
I've looked through the documentation and am having problems.
So we've to use Play Clip: Full Screen for Android?
I'm still not grasping the whole path thing as the Unity example only gives absolute paths as an example.
It should be the case that you can use Video Players as normal on Android. The use of StreamingAssets should only be necessary if you set it to "Full Screen" - otherwise, the VideoPlayer should be OK.
What are your AC and Unity versions? Hook your build up to Unity while debugging - what does the Console show?
Latest Unity and AC.
The console reports no errors and a success message.
Like I say, it all plays perfect in the editor but once deployed it just does absolutely nothing after the Unity Splash screen, unless videos are set to 'Play On Awake'
I'm referring to it playing, not building. Connect the Console to your build on the device:
https://answers.unity.com/questions/125049/is-there-any-way-to-view-the-console-in-a-build.html
Ok, I've managed to do that. The console on my Android device simply reads:
NullReferenceException: Object reference not set to an instance of an object.
No References object found. Please set one using the main Adventure Creator window.
-> AC debug logger.
I would need to see the error in full - stacktrace included.
At what time does this error show? If you're starting with the video scene, try starting with a different scene and then switch to it - we'll need to see if this starts as a result of your game starting, of a result of the video being asked to play.
The error shows as soon as the project is started.
I've tried with the menu scene and that does load but there's a video in the background that doesn't. Also, the UI menu is all wonky and partially off-screen.
That's the only error log that it throws at me, nothing else.
Here's the AC section from the adb logcat, is this what you need?
12-12 13:12:52.030 27197 27247 D Unity : - Completed reload, in 0.656 seconds
12-12 13:12:52.403 27197 27247 D Unity : PlayerInitEngineGraphics OK
12-12 13:12:52.407 27197 27247 D Unity : Found 1 native sensors
12-12 13:12:52.408 2262 19935 D SensorBase: Could not open (write-only) SysFs attribute "delay" (Permission denied).
12-12 13:12:52.408 27197 27247 D Unity : Sensor : Accelerometer ( 1) ; 0.076614 / 0.01s ; STK 3-axis Accelerometer / STK
12-12 13:12:52.408 2262 22534 D SensorBase: Could not open (write-only) SysFs attribute "delay" (Permission denied).
12-12 13:12:52.408 27197 27247 D Unity : Sensor : Accelerometer ( 1) ; 0.076614 / 0.01s ; STK 3-axis Accelerometer / STK
12-12 13:12:52.426 27197 27247 D Unity : SetWindow 0 0xe86b1008
12-12 13:12:52.427 27197 27247 D Unity : [EGL] Attaching window :0xe86b1008
12-12 13:12:52.428 27197 27247 D libEGL : call EGLBoolean eglDestroySurface(EGLDisplay, EGLSurface).
12-12 13:12:52.429 27197 27247 D libEGL : call EGLSurface eglCreateWindowSurface(EGLDisplay, EGLConfig, NativeWindowType, const EGLint *). window=0xe86b1008
12-12 13:12:52.429 27197 27247 D libEGL : PortalDevice: check portal found status=0
12-12 13:12:52.429 1677 2121 E BufferQueueProducer: [SurfaceView - com.TayannaStudios.TheDarkSideoftheMoon/com.unity3d.player.UnityPlayerActivity] connect: already connected (cur=1 req=1)
12-12 13:12:52.431 27197 27247 D Unity : ANativeWindow: (2560/1600) RequestedResolution: (0/0) RenderingResolution: (0/0) EGLSurface: (2560/1600)
12-12 13:12:52.436 27197 27247 V MediaRouter: Adding route: RouteInfo{ name=Tablet, description=null, status=null, category=RouteCategory{ name=null types=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO groupable=false }, supportedTypes=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO , presentationDisplay=null }
12-12 13:12:52.440 27197 27247 V MediaRouter: Updating audio routes: AudioRoutesInfo{ type=SPEAKER }
12-12 13:12:52.443 27197 27247 V MediaRouter: Selecting route: RouteInfo{ name=Tablet, description=null, status=null, category=RouteCategory{ name=null types=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO groupable=false }, supportedTypes=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO , presentationDisplay=null }
12-12 13:12:52.540 27197 27197 I Unity : windowFocusChanged: true
12-12 13:12:52.542 2262 30602 W InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@20b1a02 attribute=null, token = android.os.BinderProxy@c6efa1
12-12 13:13:11.217 27197 27247 D Unity : UnloadTime: 2.755750 ms
12-12 13:13:11.401 27197 27247 E Unity : No References object found. Please set one using the main Adventure Creator window
12-12 13:13:11.401 27197 27247 E Unity :
12-12 13:13:11.401 27197 27247 E Unity : -> AC debug logger
12-12 13:13:11.401 27197 27247 E Unity : UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
12-12 13:13:11.401 27197 27247 E Unity : UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
12-12 13:13:11.401 27197 27247 E Unity : UnityEngine.Logger:Log(LogType, Object, Object)
12-12 13:13:11.401 27197 27247 E Unity : UnityEngine.Debug:LogError(Object, Object)
12-12 13:13:11.401 27197 27247 E Unity : AC.ACDebug:LogError(Object, Object)
12-12 13:13:11.401 27197 27247 E Unity : AC.MultiSceneChecker:TestManagerPresence()
12-12 13:13:11.401 27197 27247 E Unity : AC.MultiSceneChecker:Awake()
12-12 13:13:11.401 27197 27247 E Unity :
12-12 13:13:11.401 27197 27247 E Unity : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
12-12 13:13:11.401 27197 27247 E Unity :
12-12 13:13:11.494 2262 4066 W SensorService: sensor 00000000 already enabled in connection 0x752f031700 (ignoring)
12-12 13:13:11.494 2262 4066 D SensorBase: Could not open (write-only) SysFs attribute "delay" (Permission denied).
12-12 13:13:11.495 2262 7149 D SensorBase: Could not open (write-only) SysFs attribute "delay" (Permission denied).
12-12 13:13:11.495 27197 27247 D Unity : Sensor : Accelerometer ( 1) ; 0.076614 / 0.01s ; STK 3-axis Accelerometer / STK
12-12 13:13:11.504 27197 27247 D Unity : Choreographer available: Enabling VSYNC timing
12-12 13:13:11.628 27197 27247 E Unity : NullReferenceException: Object reference not set to an instance of an object
12-12 13:13:11.628 27197 27247 E Unity : at AC.ACScreen.get_safeArea () [0x00006] in <2af2b74c298d4155944656345467196b>:0
12-12 13:13:11.628 27197 27247 E Unity : at AC.MainCamera.SetAspectRatio () [0x0001a] in <2af2b74c298d4155944656345467196b>:0
12-12 13:13:11.628 27197 27247 E Unity : at AC.MainCamera.RecalculateRects () [0x00001] in <2af2b74c298d4155944656345467196b>:0
12-12 13:13:11.628 27197 27247 E Unity : at AC.MainCamera.Start () [0x00001] in <2af2b74c298d4155944656345467196b>:0
12-12 13:13:11.628 27197 27247 E Unity :
12-12 13:13:11.628 27197 27247 E Unity : (Filename: <2af2b74c298d4155944656345467196b> Line: 0)
12-12 13:13:11.628 27197 27247 E Unity :
12-12 13:13:11.660 27197 28549 D Unity : Setting up 1 worker threads for Enlighten.
12-12 13:13:11.662 27197 28550 D Unity : Thread -> id: ffffffffb96fb920 -> priority: 1
12-12 13:13:29.229 11897 15360 E WakeLock: GCM_HB_ALARM release without a matched acquire!
12-12 13:13:29.300 11897 11496 I NetworkScheduler.Stats: Task com.google.android.gms/com.google.android.gms.checkin.EventLogService started execution. cause:2 exec_start_elapsed_seconds: 5928489 [CONTEXT service_id=218 ]
12-12 13:13:29.324 11911 16121 I Checkin : [EventLogChimeraService] Opted in for usage reporting: false
12-12 13:13:29.324 11911 16121 I Checkin : [EventLogChimeraService] Aggregate from 1607777545821 (log), 1607777545821 (data)
12-12 13:13:29.443 11897 9869 I NetworkScheduler.Stats: Task com.google.android.gms/com.google.android.gms.checkin.EventLogService finished executing. cause:2 result: 1 elapsed_millis: 164 uptime_millis: 165 exec_start_elapsed_seconds: 5928489 [CONTEXT service_id=218 ]
The errors aren't related to the video player specifically, but they do suggest that you're having a wider issue in that AC's Managers aren't loading in.
Is the only perceived issue being that of the video not playing, with everything else AC-related working correctly?
The error is reporting that it cannot find the References file inside your Resources folder. This is an important file and necessary for AC to function.
Look inside your Assets/AdventureCreator/Resources folder. That is where the "References" file ought to be - is it present, and what Manager assets file are loaded into it if so?
Oddly enough it seems to have somehow fixed itself now. ABSOLUTELY BAFFLED. However, now it will only run on the device if certain scenes are left out of the actual build. I'm guessing that's to do with faults in the scene?
As in, it won't run at all if certain (non-starting) scenes are in the build?
That is odd, and I can't imagine why that would be. Again, I would recommend the error log / Console as your first stop for any such issue.
Yes that's exactly the issue. It's an odd one. I'll have to work this one out myself. Thanks for all your help though, Chris