Hello,
We are evaluating Scaleform for our game and even though we have read the doc and watched multiple videos, it looks like there are many things that we missed because we are stuck with basic stuff.
We have no experience with Scaleform and not much knowledge of Flash & ActionScript.
So, we installed Flash, we set the classpath of AS3 to be able to find the CLIK libs, the core integration script files are into Assets\Plugins\SF, we made a script that overrides SFCamera and it is attached to our main camera, the flash assets (.fla. as. swf) are in Assets\StreamingAssets.
We made a simple flash file. Only one symbol with only a square drawn in it. In the scene, we move the square around and there is a stop(); at the last frame.
When we start the project, we see our scene loading a little bit out of the Game Screen in the Unity Editor, and then nothing happens. No error, we see the square but it doesn't move. We tried to add some ExternalInterface.Call in the action script but apparently we didn't get any callback in Unity.
When we load the demo project (space ship), everything is fine.
For an unknown reason I can't attach .cs files so I copied the content of my files at the end of the message.
So, we have multiple questions.
Any idea of what could be wrong? I know it's a little large but I don't know what info I can provide to help investigate what is wrong.
Is there any basic tutorial that shows how to make a flash file and the related code in Unity? All the videos are related with projects that we can't find. Also, we would prefer to code as much as possible in Unity and less action script as possible.
Cheers
Francis
using UnityEngine; using UnityEngine; using Scaleform; using Scaleform.GFx; public class SSMainMenu : Movie { protected Value theMovie = null; private testSF parent = null; public SSMainMenu( testSF parent, SFManager sfmgr, SFMovieCreationParams cp ) : base( sfmgr, cp ) { this.parent = parent; SFMgr = sfmgr; this.SetFocus( true ); } public void OnRegisterSWFCallback( Value movieRef ) { theMovie = movieRef; } // to be called by ExternalInterface.Call public void test() { Debug.Log( "test" ); } // to be called by ExternalInterface.Call public void Click( string str ) { Debug.Log( "Click " + str ); } }
using UnityEngine; using System.Runtime.InteropServices; using System; using System.IO; using System.Collections; using Scaleform; public class testSF : SFCamera { public SSMainMenu mainMenu = null; // Hides the Start function in the base SFCamera. Will be called every time the ScaleformCamera (Main Camera game object) // is created. Use new and not override, since return type is different from that of base::Start() new public IEnumerator Start() { #if (UNITY_STANDALONE_WIN || UNITY_EDITOR) && !UNITY_STANDALONE_OSX SF_SetKey( "" ); #elif (UNITY_STANDALONE_OSX || UNITY_EDITOR) && !UNITY_STANDALONE_WIN // SF_SetKey(""); #elif UNITY_IPHONE SF_SetKey("----------------------------------------"); #elif UNITY_ANDROID SF_SetKey(""); #endif //For GL based platforms - Sets a number to use for Unity specific texture management. Adjust this number if //you start to experience black and/or missing textures. SF_SetTextureCount( 500 ); base.Start(); if( WhenToRender == RenderTime.EndOfFrame ) { yield return StartCoroutine( "CallPluginAtEndOfFrame" ); } } // Update is called once per frame void Update () { if( mainMenu == null ) { SFMovieCreationParams creationParams = CreateMovieCreationParams( "square.swf" ); creationParams.TheScaleModeType = ScaleModeType.SM_ShowAll; creationParams.IsInitFirstFrame = true; mainMenu = new SSMainMenu( this, SFMgr, creationParams ); } } }
Hi there!
When you run your scene in Unity, do you see any error messages in the console? If you run the Flash file in the standalone Scaleform player, does the square move? Can you alost post your ActionScript, if you have any?
The C# you posted looks fine upon a cursory review.
Hello,
No error messages in the console.
When I run the standalone Scaleform player, the square move.
No actionScript at the moment.
I really really wanted to keep the test as simple as possible. I'm really out of clues on what could be wrong.
Cheers
Francis
Since I started a new project, I thought I could have changed some project properties or maybe I'm missing some kind of global setting.