Skip to content

Needs to render an image data or video data type to unity texture. #9

@umeshiscreative

Description

@umeshiscreative

I am not able to send the texture to unity. It needs to render the texture in unity and we get data of texture in iOS.
How to return the texture from iOS to unity ? I have data in NSData format. I can as per suggestion convert to other format as well.
But I don't know how to return the texture from ios to unity using extern methods.

  if (event == kUnityRenderingExtEventUpdateTextureBeginV2)
  {
      // UpdateTextureBegin: Generate and return texture image data.
      auto params = reinterpret_cast<UnityRenderingExtTextureUpdateParamsV2*>(data);
      auto frame = params->userData;
     
      IOS_Class *shared = [IOS_Class sharedInstance];
      params->texData = (uint8_t *)(__bridge void*)[shared getData]; // Not able to rendered image to Unity texture.

  }
-(NSData*) getData {
    UIImage *logoImage = [UIImage imageNamed:@"logo.png"
                         inBundle:[NSBundle bundleForClass:self.class]
                            compatibleWithTraitCollection:nil];

    NSLog(@"Image -- %@",logoImage);
    NSData *imageData = UIImagePNGRepresentation(logoImage);
    return imageData;
}

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions